Re: Wrapping Box Container



On Wed, 2010-09-01 at 10:51 -0400, Havoc Pennington wrote:
> Hi,
> 
> On Wed, Sep 1, 2010 at 6:37 AM, Tristan Van Berkom
> <tristanvb openismus com> wrote:
> > SPREAD_EVEN is exactly that.. adding extra space between the children as
> > spacing, and there is SPREAD_EXPAND for the other (not sure if that
> > could be better explained).
> 
> that's what I was saying, just that the docs could use a small wording
> tweak. (because "distributing extra space between children" could mean
> either "among the children" - what I read the first few times - or "in
> between" them as spacing)
> 
> > What would we prefer here ? A single AttachOptions type which can
> > be used amongst many containers or a custom enumeration ?
> 
> I think AttachOptions is just broken, personally (though it beats
> booleans for readability). FILL should be in an enum with start, end,
> center since it is logically exclusive with those. SHRINK is just
> broken (widgets should never get less than their min size). So only
> EXPAND is a valid flag.
> 
> Obviously the main gist of my comments would be most useful if
> actually fixing up FILL and padding to be props of widget instead of
> props of containers.

Ok I just pushed in a new and slightly changed api:

void                  
gtk_wrap_box_insert_child_with_padding (GtkWrapBox  *layout,
                                        GtkWidget   *widget,
                                        gint         index,
                                        guint        horizontal_padding,
                                        guint        vertical_padding,
				        GtkWrapBoxPacking packing);


I collapsed both the horizontal and vertical expand/fill options into
a single enumeration:

/**
 * GtkWrapBoxPacking:
 * @GTK_WRAP_BOX_H_EXPAND: Whether the child expands horizontally.
 * @GTK_WRAP_BOX_H_FILL:   Whether the child fills its allocated
horizontal space.
 * @GTK_WRAP_BOX_V_EXPAND: Whether the child expands vertically.
 * @GTK_WRAP_BOX_V_FILL:   Whether the child fills its allocated
vertical space.
 *
 * Specifies how widgets will expand/fill vertically and
 * horizontally when placed inside a #GtkWrapBox.
 */
typedef enum
{
  GTK_WRAP_BOX_H_EXPAND = 1 << 0,
  GTK_WRAP_BOX_H_FILL   = 1 << 1,
  GTK_WRAP_BOX_V_EXPAND = 1 << 2,
  GTK_WRAP_BOX_V_FILL   = 1 << 3
} GtkWrapBoxPacking;


I also took care of renaming SPREAD_BEGIN --> SPREAD_START
and named the padding options "horizontal-padding"/"vertical-padding"
to be more consistent with the rest of the wrap-box api (generally
I think those are more readable than "xpad"/"ypad").

There should be no more trailing whitespace in gtkwrapbox.h as well...

Thoughts anyone ? its still early enough I can come back and change
some details...

Cheers,
          -Tristan





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