Re: Theming for outline expanders for GtkTreeView

Darin Adler <darin eazel com> writes:
> Chris Lahey was just asking me a bunch of questions about outline expanders.
> I wanted to mention the set of things we probably need to theme them
> properly. One goal here is to be able to have really nice triangle-style
> expanders like the Macintosh ones that work even better than on Macintosh in
> some themes. And we could have the simple +/- ones in other themes.
> Here are the issues. I hope this is not too late for 2.0.
>     - expander image in both open and closed state
>     - expander image prelit for both open and closed state
>     - expander image tracked for both open and closed state, and a flag to
> say whether clicking on the expander tracks like a button or not (since +/-
> might want to just take effect on button down)
>     - simple animation sequence for going from open to close or vice versa
> (since for the triangles, you want a few frames of rotating to happen for
> the best look)
>     - flag to say whether lines are preferred or not -- I guess some
> applications might want to force lines even with the arrow style? Not sure
> how to make that look good.

The current state of the code is as follows:

 - There's a theme engine function to draw an expander; 
   it is simply instructed to draw open or closed. It does
   get a state (prelit/selected) I think
 - GtkTreeView uses the engine function, old trees do not
 - There is no way to affect this from a non-engine theme
 - There's no way to do animation
 - There's no way to handle tracks like a button vs. not
 - There's no way to have lines

Another thing we are theming is the alternating row colors as found in
Nautilus; this is done with paint_flat_box, and the detail argument
reflects whether the row is even or odd. Applications set a hint
indicating that alternating row colors are useful (i.e. for a
single-column tree they are pointless, so they are off by default;
apps can set a hint saying they are useful; the theme engine can
decide whether to draw the alternating colors in either case).

> What should I do to help get this right for GTK 2?
> [Things aren't so good in Nautilus 1.0, because we have two tree views (one
> in the Tree sidebar panel and one in the Help sidebar panel) that use
> expanders that look different from each other, and they are not themed at
> all.]

So we were copying Nautilus tree appearance a bit, with the goal to
get rid of the horrible hardcoding you have now. ;-) But we probably
don't have all the stuff you need.

I think the #1 thing the Nautilus team could do at this point is to
rewrite the tree mode with GtkTreeView, and make all changes you need
to GtkTreeView (both with respect to this theming/appearance stuff and
also API/functionality-wise). This would give us a good torture test
for the widget and ensure you can use the stock functionality in the

With accessibility, i18n, themes, etc. it's becoming more and more
important to use stock functionality, since custom functionality tends
to break all those things.

If you aren't that ambitious, maybe just hack on the tree view a bit
to add some of the additional features you mentioned above.


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