Re: grid widget (was Re: possible removal of GtkWrapBox)

On Thu, 2010-10-07 at 10:55 -0400, Matthias Clasen wrote:
> On Thu, Oct 7, 2010 at 10:48 AM, Tristan Van Berkom
> <tristanvb openismus com> wrote:
> > However I would really appreciate it if a widget's placement
> > inside a container can still be clearly introspected and defined
> > with container child properties (in other words I think the widget
> > should be built with child properties and the 'cursor' be a
> > convenience API layer of sorts).
> To me, what Havoc described really sounds like a layer of convenience
> api or 'gridbuilder' on top of a widget that has child properties
> similar to what my GtkGrid has.

   to reply to your previous mail about hfw management in general,
I havent thought out GtkTable management in full detail (or implemented
it) but here are some starting points:

   a.) Tabular widgets need to prioritize one of the request modes,
       the table either does height-for-width or width-for-height.

       My best guess is that it should be the majority of the request
       modes of it's children. 

       Then what happens at request time becomes pretty obvious (when
       requesting a height-for-width table in width-for-height mode,
       its important to return the height-for-minimum-width), at
       allocation time however..

   b.) At allocation time you need to actually prioritize one dimension,
       so you need to do the following for height-for-width:
       - Get the available allocated width
       - Gather the MAX()s of all minimum/natural sizes of
         widgets in a column and add them to a GtkRequestedSize array
       - Allocate widths using gtk_distribute_natural_allocation()
       - Further distribute remaining expand space if any
         appropriately to expanding columns
       - Now you have the allocated widths, go for heights... gather
         the MAX()s of the heights of rows taking into account
         the already allocated width of each column.
       - Naturally distribute vertical space again with
       - Distribute remaining expand vertical space

   b.) It goes without saying but obviously you save alot of lines of
       code when writing functions that take an 'orientation' argument
       and are orientation independent.

   c.) The remaining problem becomes widgets which span several rows 
       or columns, however there is code which can be inspected that
       does this, see tabular GtkComboBox menus.

       The approach taken there is, when asking for say, a widget
       that spans 3 columns' width... the minimum and natural width
       for that widget *for that column* is devided by 3.

       Widgets that span columns just take up the space that your
       code decided to allocate to those columns (same will go
       for rows).

Hope this is of some use ;-)


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