Re: Outliner widget



Gary Benson <gary inauspicious org> writes:

Hi all,

Over the past few weeks I've been contemplating writing an outliner for
GNOME, the core of which will be an outliner widget which I'm about to try
and write; the screenshot on http://www.outliners.com/ gives a fair idea
of what I'm intending (a picture tells a thousand words and all that).  
Currently I'm a little lost as to where to start, and I'd appreciate some
feedback on my current thoughts.

Initially, I thought that a tree view would be a good starting point, but
I've become convinced that it would be very hard to implement what I want
with one. My current thinking involves a recursive tree of three custom
widgets that mirror the organisation of the data being represented.

This looks like fun project!  I'm not sure that the tree is really what
you want, but you may be able to do some simple outlining with it.  The
other thing you might be 

The highest level widget, Outline, would be a scrolled window containing
an OutlineGroup, which would simply be a vertical box containing
OutlineElements. The OutlineElement itself would be the lowest level
widget comprising the arrow on the left (used both as a drag handle and to
hide the subtree), and a GtkTextView on the right, below which would
optionally be an OutlineGroup (see crappy ASCII art below).

 +-------+------------------+
 |       | +--------------+ |
 | Arrow | | GtkTextView  | |
 |       | +--------------+ |
 |       | | OutlineGroup | |
 |       | +--------------+ |
 +-------+------------------+

Now for the questions:

What would be good parent classes be for my three widgets?

The arrow would probably be a toggle button. Is it possible to make it so
that double-clicking is required to toggle it, so that single click may be
used to select the subtree? Is it possible to override the renderer for a
widget or do I need to make a custom one? Is it possible to make the arrow
stay at the top of its hbox cell or do I need a fixed container in there?

I think you'll be best making a custom widget here to get the right
behaviour.  There's a disclosure arrow widget floating around somewhere
that may be better place to start looking at.

Folding would probably be accomplished by enclosing the GtkTextView/
OutlineGroup vbox in an event box and setting its height to that of a line 
of text when folded. Does this sound reasonable or is there a better way?

It's a reasonable start, but you'll probably be tweaking it more as it
starts coming together...

-Jonathan



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