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



On Thu, 2010-10-07 at 09:23 -0400, Havoc Pennington wrote:

> Don't know if this will make sense to anyone else but I do think it's
> useful to take some real-world layouts and see how much typing they'd
> require

This is a very interesting exercise, and the pseudocode for those
examples *is* really nice and concise.

However, who writes UIs by hand these days?  Doesn't everyone just use
Glade?

(I know, I know; we all have a complex part in $project where you need
to code the layout by hand.  Or you have historical hand-coded UIs.
Life is hard.)

I don't know how many other examples you considered while thinking about
your API, but let's see about those three:

1. Gedit's about dialog.  This is just GtkAboutDialog, correct?  GTK+
has all the hand-coded stuff; Gedit doesn't have to worry.

2. Calculator.  It's done with .ui files!  There's a .ui file for each
important section or mode (advanced, financial, programming), which then
get put into the window.

3. Display properties.  It's done with a .ui file as well!

I'd love to see a list of common UI patterns that people use, or the
common quirks, or the common special-cases they need to do.  Here are a
few:

* Our HIG-beloved sections with indented contents in dialog boxes.
There is no official solution to this, and various apps do different
hacks to achieve them.

* Groups of widgets that need to be shown/hidden,
sensitized/desensitized upon different conditions.  Sometimes you can
get away with sticking them in the same container and just operating on
the container.  Other times you need to keep a hand-build list of those
widgets and really operate on them by hand.  What gets painful sometimes
is that windows get unexpected sizing if you hide a few widgets.

* Baselines!!!  I think we could make things automatically look prettier
if we let certain containers hang off a label's baseline.  For example:

   Foo bar   +--------+   Baz beep
   [______]  |        |   [__________]
             |        |
   [ ] Blah  |        |   [ ] Blih bluh
             +--------+

Those are a few labeled widgets around a list widget or something
equally "obtrusive".  GTK+ should let you guarantee that the labels on
each side are aligned on their baselines, *without* requiring you to
carefully sync up the spacings on both sides.  Extended-layout
originally had something about baselines; I don't know if this is still
in the branch, or if it works at all.

* Fixing the bugs like "a table with an empty row still gets both
spacings around the row applied" - I was in the middle of fixing that
one, but didn't finish.  That would help when you have to hide/show
widgets at runtime.

I *think* Matthias's grid widget is a "GtkTable with WFH that can be
used in place of GtkBox", but still intended to be used from Glade,
mostly.

(Having a helper API like the one you propose to fill up an existing
table/grid/whatever sounds nice; I just don't know if it is a lot of
complexity that won't get used much in the end.  Such an API would be
really for code only, not something that you expect to be a
GtkBuildable.)

>From your other mail:

> One litmus test for "too much redundancy" is if you have to change two
> lines to add or remove a widget.

If you are making your UIs with Glade, it would help for Glade's
usability to be improved in a similar fashion.  We should study what
kinds of tricks people use to rearrange widgets... creating a temporary
window, inserting a container, then cutting&pasting widgets into it to
create a holding space, is pretty cumbersome.

  Federico



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