Hello,
I have put some GtkButtons inside a Gtk V WrapBox (which is
a container) and then I've put this very GtkVWrapBox inside
a GtkWindow.
A GtkVWrapBox's job consists in placing all the GtkButtons
it contains in columns on its left-hand side.
If enough height is available, the GtkVWrapBox will
place all the GtkButtons in a single column on the left-hand side.
Otherwise, it will create as many columns as needed, thus requiring
more WIDTH to display the extra columns.
When the MOUSE resizes the GtkWindow which embarks my GtkVWrapBox,
I can't force this GtkWindow to resize properly to accomodate
the GtkVWrapBox. The result is that the GtkVWrapBox shrinks the
GtkButtons it contains to fit the space it is allowed by the
GtkWindow : this shrinkage is not a desired effect.
I am able to compute the space needed by the GtkVWrapBox to
display the GtkButtons full size. (by means of "gtk_widget_size_request"
on the GtkButtons it contains)
The problem is :
---------------
When the GtkWindow is resized with the mouse, I can't have it resized
according to the constraints I have calculated with gtk_widget_size_request.
When the GtkWindow is resized with the mouse, it seems to receive two
signals from the "window manager"(?) :
1) "size-request" and
2) "size-allocate"
I tried the following strategies to solve my problem :
1)Issue a "gtk_widget_set_size_request" on the GtkWindow in the
"size-request"
callback.
2)Issue a "gtk_widget_set_size_request" on the GtkWindow in the
"size-allocate"
callback.
3)Issue a "gtk_window_setsize" (GTK) on the GtkWindow in the "size-request"
callback.
4)Issue a "gtk_window_setsize" (GTK) on the GtkWindow in the "size-allocate"
callback.
5)Issue a "gdk_window_setsize" (GDK) on the GtkWindow->window in the
"size-request" callback.
6)Issue a "gdk_window_setsize" (GDK) on the GtkWindow->window in the
"size-allocate" callback.
7)Issue a "gtk_window_set_geometry_hints" on the GtkWindow in the
"size-request" callback.
9)Issue a "gtk_window_set_geometry_hints" on the GtkWindow in the
"size-allocate" callback.
I also programmed my GtkWindow with gtk_window_set_geometry_hints to
have it resized by increments (increment in height : the height of a
GtkButton inside my GtkVWrapBox / increment in width : the width of a
GtkButton inside my GtkVWrapBox)
HINT :
------
The GIMP also embarks a GtkWrapBox. When the window is resized with
the mouse, it does so by moving its right-bottom corner by increments.
But the trick is that if the height is reduced and the GtkVWrapBox is
on the brink of creating a new column to compensate for the loss of
height, the GtkWindow ANTICIPATES by both decrementing its height
and incrementing its width AT THE SAME TIME.
Does anyone knows how to do that ?
Thanks.