GtkTextView sizing

Hi all,

I'm trying to write an outliner for GNOME (something like that shown in
the screenshot on, and I'm making it a widget
so it can easily be embedded in applications. I'm having problems getting
the component widgets to scale the way I want them, particularly the

By way of explanation, it will eventually comprise the following classes:

  XiaoOutline -- top level class that the application will stick in a 
    window. Will be a GtkScrolledWindow containing a XiaoGroup

  XiaoGroup -- a vertical box containing XiaoItems

  XiaoItem -- a widget comprising an handle on the left, and a GtkTextView 
    and a XiaoGroup on the right, ie:

         |            | +-------------+ |
         | XiaoHandle | | GtkTextView | |
         |            | +-------------+ |
         |            | |  XiaoGroup  | |
         |            | +-------------+ |
    Folding is accomplished by forcing the right-hand-side vbox to be the 
    height of one line of text in the GtkTextView.

  XiaoHandle -- a little arrow that you use to fold/select/drag the 
    XiaoItem with.

I'd like each GtkTextView to:

 - Word wrap (this works)
 - Grow to as big as it has to be to fit its contents, and never scroll 
   outside that region (since scrolling will happen at XiaoOutline level).
 - When growing horizontally, try to constrain itself to the width of the 
   visible area, but always fill the whole visible area.
 - Grow vertically as much as it likes.

I expect I could do this with GtkTables, but that way means that you have 
to deal with the entire document at once instead of handling it as a 
recursive structure, which would complicate things enormously.

It's kind of hard to explain, so I've attached a tarball of my current
efforts so that if you are feeling helpful you can compile it and see for
yourself. I haven't written a makefile yet, but "gcc *.c -o xiao
`pkg-config --cflags --libs gtk+-2.0`" does the trick :). The only file
that matters for this problem is xiaoitem.c.

In the current version there is no XiaoOutline: I just stuck a 
XiaoGroup in a window and it should -- in theory -- stretch the window to 
how big it should be (this would all be wrapped in a GtkScrollView of 

When you start the program, and don't touch anything, item 4 should be 
wider, since it can be. I'd like for items 2 and 3 to have stretched out 
the window so they weren't wrapped. Also, if you click in item one and 
start typing, it scrolls itself so that parts of itself are hidden.

Can anyone suggest how I might fix this, or do I need to rethink what I 
want it to do?

Thanks in advance,

[ gary inauspicious org ][ GnuPG 85A8F78B ][ ]

Attachment: xiao.tar.gz
Description: GNU Zip compressed data

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