GtkContainers, GtkFixed, signals, and The Way



I'd really like to implement this old Window Interface library based on
Motif with GtkBoxes, but I simply cannot accurately predict when the
application code needs an hbox or a vbox, or switch an old hbox to a vbox.
The library I'm trying to implement with Gtk must be able to put boxes
within boxes at any location in any order.

As far as I can tell when looking at the GtkContainers, my only choice is to
attempt to manage everything within GtkFixeds, except that when building a
Gtk GUI, none of the widgets know their dimensions and locations until
they're just about to be rendered.  I have been able to pass around some
useful information using gtk_widget_set_size_request(), but as soon as I try
to listen for "configure-event", "size-allocate", or "size-request" and
attempt to make additional gtk_widget_set_size_request()s I start an
infinite loop where the window keeps growing to accommodate its hungry
children.  Another negative side effect of using a bunch of
gtk_widget_set_size_request()s everywhere is that I rob the user's ability
to shrink all windows to less than their original sizes (annoying).

I've been trying to avoid GtkFixed because I'll end up doing a lot of work
that Gtk wants to do for me, but at this point I'm forced to attempt to
manage everything on my own.

So how am I 'supposed' to disobey Gtk and micromanage every GtkFixed's
position and size when the window is first shown to the user and after they
make their own adjustments?  Are "configure-event",  "size-request", and
"size-allocate" the core signals I need to focus on or am I going about this
entirely the wrong way?

An example problem I've run into involves my root application window.  I add
a GtkFixed to the GtkWindow to put the rest of the widgets inside, but when
I try to keep the GtkFixed widget the same size as the GtkWindow, so that
the other widgets know how much space they have to work with, the window
just gets bigger every time the GtkFixed asks how big the window is and
fills it up.

I need some more balanced size negotiation.  At what exact point does the
parent know what it has to work with so that the child can calulate how much
of that the child actually wants?

Suggestions on where to look for extensive use of GtkFixed or other ways of
implementing a lower level packing system would be a big help.

~Thanks



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]