Re: legacy-free grid container



On Mon, Sep 6, 2010 at 1:48 PM, Havoc Pennington

>
> The basic idea of GtkGrid is:
>
> * it just puts things in rows and columns, and implements homogeneity;
> expand, fill, padding are now all in Widget
> * it is an infinite grid, not a fixed size at construct time like
> GtkTable. so you don't have to keep construct size in sync with what
> you add. It auto-resizes to hold stuff.
> * the coordinate system goes into negative numbers, so you can add
> things on either side of the axes
> * its "default" mode if you just container_add() is like a box, in
> that it just keeps appending children to the axis. they are then in a
> single-row or column table. this lets it replace Box.
> * but you can also do an add_at(grid, child, x, y, cells_wide,
> cells_high) (note, coords then WxH in cells, rather than annoying
> "attach points" where you have to change both numbers to move)
> * you could also do add_by(grid, existing_child, child,
> side_of_existing_child, cells_wide, cells_high) which lets you build
> things up relatively. this is nice because if you want a stack of
> stuff above the foobar, and you insert something before the foobar,
> you don't have to go and redo all your coordinates
> * have separate "h" and "v" homogeneous flags to force all rows or all
> columns to be the same height
> * have separate "h" and "v" spacing which would be the same between
> all rows or all columns

Sounds like a nice plan to obsolete both GtkBox and GtkTable in GTK 4.

> * an issue: the naming of the cell-based access (x,y) is a mess if you
> allow it to be GtkOrientable like box. but if you require an
> add_on_axis(orientation, child) then it's not as convenient as box.

I don't think cell-based access is going to be a problem. The way I
see it, the orientation will determine if plain add() works like an
hbox or like a vbox, and changing the orientation of an already
populated grid will simply flip all x/y coordinates of existing
children.

One thing to keep in mind is that GtkBox has been updated to do
hfw/wfh, but GtkTable hasn't yet. If we decide to go for a new, more
flexible container, we should perhaps not waste time on making
GtkTable do hfw and instead focus on GtkGrid.

Matthias


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