Re: ensuring that a resize has been actualised
- From: Sergio Perticone <g4ll0ws gmail com>
- To: gtkmm mailing-list <gtkmm-list gnome org>
- Subject: Re: ensuring that a resize has been actualised
- Date: Sun, 24 Jun 2007 18:16:04 +0200
Bartosz Kostrzewa wrote:
Hi,
in gimmage I catch the configure_event signal in order to resize the
image to fit the viewing area if the user resizes the window.
I query the width and height of an internal widget (a scrolled window)
but connect to the top window's configure_event signal because for some
strange reason the internal widget does not emit the signal (even though
it is clearly resized together with the top window). This of course
brings the problem that the resizing is not actually finished when I
query width/height and I zoom the image to the wrong size.
I even tried working around it by querying only the size of the top
level window and subtracting the height/width of all other widgets, but
even that does not give the correct values. Uncommenting the iteration
forcing does not help either!
----------------
// AppWindow.cpp
signal_configure_event().connect_notify(sigc::mem_fun(*this,&AppWindow::on_my_configure_event));
[...]
void AppWindow::on_my_configure_event( GdkEventConfigure* event )
{
std::cout << "configure event" << std::endl;
//while(Gtk::Main::events_pending()) Gtk::Main::iteration();
ImageBox.ScaleImage2(ImageScroller.get_width()-4,
ImageScroller.get_height()-4,&scalefactor);
}
Uhm, "-4" may be good for you environment, but you can't assume that
it's good for _all_ configurations.
-----------
when I do this instead, nothing happens, but it would be REALLY great if
this worked!
ImageScroller.signal_configure_event()...
------------
Any ideas?
IMO you should use signal_check_resize() for the main window; for instance:
AppWindow::AppWindow(/*...*/)
// ...
{
// ...
signal_check_resize().connect(sigc::mem_fun(*this,
&AppWindow::on_window_resize));
// ...
}
void AppWindow::on_window_resize()
{
// for ImageScroller I meant the ScrolledWindow:
int width =
static_cast<int>(ImageScroller.get_hadjustment()->get_page_size();
int height =
static_cast<int>(ImageScroller.get_vadjustment()->get_page_size();
ImageBox.ScaleImage2(width, height, &scalefactor);
}
I hope this is what you're looking for,
>
> -Bartek
s.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]