Padding API
- From: Havoc Pennington <hp redhat com>
- To: murrayc usa net, Calum Benson <calum benson sun com>, "usability gnome org" <usability gnome org>, gtk-devel-list gnome org
- Subject: Padding API
- Date: Tue, 10 Dec 2002 19:37:22 -0500
On Tue, Dec 10, 2002 at 05:32:00PM -0600, Gregory Merchan wrote:
> One way to do this that might work for other things is a padding widget.
> I imagine it'd be a GtkBin subclass:
>
> struct _GtkPad
> {
> GtkBin bin;
> guint pad_left;
> guint pad_right;
> guint pad_top;
> guint pad_bottom;
> }
>
Yes, I think that's a decent idea. I've often needed this and ended up
sticking an empty GtkAlignment somewhere and setting its size as a
random bit of padding. In general I think many layouts would be
simpler if you could just say "insert padding here" - the problem is
that GTK always has "border width" or "xpad" or "xscale" when you
really want to independently vary all 4 sides. I find that I almost
never want to pad 2 or 4 sides, I always want a single 12-pixel
spacer.
The feature could alternatively be done as:
gtk_alignment_set_pad (GtkAlignment *align,
GtkSideType side,
int padding);
this would avoid creating a new widget. The padding would have to hang
off the GtkAlignment as object data for now to avoid breaking ABI, but
we could demand-create the object data only if we have a nonzero pad.
GtkSideType is deprecated but it's simple to undeprecate.
One downside of using GtkAlignment is just that gtk_alignment_new()
has annoying arguments, but we could have gtk_alignment_new_padding()
perhaps.
Another option is to add this feature to all GtkContainer and make
gtk_container_set_border_width() into a convenience wrapper that sets
all 4 padding values, but I think that's pretty much too
backward-incompatible.
Another option is an interface GtkPaddable or something that any
widget can implement.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]