Re: GtkConstrain

[META: my isp's having some severe mail problems, so i can currently only
 read/answer mail remotely from, which amounts to,
 gtk-devel-list and gnome-hackers]

On 28 Mar 2000, Havoc Pennington wrote:

> Hi,
> Jonathan reminded me about this old widget I had laying around, which
> may be of interest.
> It allows you to group widgets such that they all request the same
> size. It's useful if you have two widgets you would like to line up
> nicely, but the two widgets can't be in the same container.
> For example, say you have a dialog, with two frames holding groups of
> options. The entries (for example) in the two frames should have the
> same size. It's easy to use GtkTable within a frame to achieve this,
> but the table can't span the two frames. So, GtkConstrain can be used.
> GtkConstrain does not guarantee two widgets will end up with the same
> size, obviously, since it only affects the size request.

in the code, i don't see how you hook into the size requisition of
other widget's in the group, are you only constraining the size of
GtkConstrain's child?
i've written something similar, though probably more flexible, thingy
for beast. i don't use a container there, since i need widgets to get
dynamically added/removed from the group, and they can reside in arbitrary
containers. (the full implementation is in beast/beast-gtk/bstutils.[hc])
header portion appended.
(TO_USIZE constrains to the dimensions specified by gtk_kennel_resize(),
a function gtk_kennel_set_reference_widget() for TO_WIDGET is actually
still missing from the implementation, but can easily be added).

> Havoc


/* --- Gtk+ Kennel --- */
typedef enum
} GtkKennelType;
typedef    struct _GtkKennel              GtkKennel;
GtkKennel* gtk_kennel_new                (GtkKennelType          width_constrain,
                                          GtkKennelType          height_constrain);
void       gtk_kennel_configure          (GtkKennel             *kennel,
                                          GtkKennelType          width_constrain,
                                          GtkKennelType          height_constrain);
GtkKennel* gtk_kennel_ref                (GtkKennel             *kennel);
void       gtk_kennel_unref              (GtkKennel             *kennel);
void       gtk_kennel_add                (GtkKennel             *kennel,
                                          GtkWidget             *widget);
void       gtk_kennel_remove             (GtkKennel             *kennel,
                                          GtkWidget             *widget);
void       gtk_kennel_resize             (GtkKennel             *kennel,
                                          guint                  width,
                                          guint                  height);

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