Re: GtkLayout: correct use or kludge?



Havoc Pennington wrote:

greg <gregor waltz villanova edu> writes:
the widget is basically a container in which the children get scrolled
differently. one child gets scrolled in both directions, while others
are only scrolled by one or none. so, the latter widgets are stationary
in at least one direction. all of the children are visible at all times;
they never scroll off the viewable area as would happen if they were
scrolled normally.

Ouch, this is going to be a real pain in the ass to do smoothly. Well,
"no scrolling" is easy; just make the child a child of layout->window
not layout->bin_window - except the layout has no API for that, so
you'll need a custom container widget using layout code,
probably. Scrolling in one direction I don't know how you'll do.

tell me about it :P i *did* actually have it sort of working before
using gdkwindows to hold and move the objects instead of a single
bin_window; REALLY messy though...


i was about to try one of two ideas, but before i start i was hoping to
get some opinions.

1) use a gtklayout to hold everything. move the children on scroll
events accordingly by setting their attribute (x,y) position. then use
gdk_window_lower to put the fully scrollable child under everthing so it
doesn't obscure other children when scrolled.

2) use a layout to hold multiple layouts. each child layout is given a
viewable area (size) and attached to the appropriate scroll bars.

i think 2 sounds better, but i'm not sure yet. any ideas?

Neither of those sounds really right...

The idea of a layout is that child widgets are automatically scrolled
for you. So you may not want to use a layout, if you're doing this -
you'll have to scroll, then move the one-dimension children back in
one dimension, which will flicker and jump, and require a confusing
calculation of some kind.

Maybe have a look at the GtkLayout test in testgtk, that could be
helpful.

well, i think i have it now. it works pretty well. it's sooo much better
than what i was doing before at least :)

i want to get rid of as many usizes as possible, make it into a widget,
and get rid of the hard coded parameters, but you can see a small proof
of concept example here:

www.epix.net/~motorbt/test.zip


i basically used my second idea with multiple layouts, but i used a
table to hold the scrollbars and layouts.

and to think this project has been on hold for nearly a year because of
this. i should have had this idea SOONER! i always do things the "HARD
way"(TM) before doing it the "Right Way"(TM) ;o

thanks
-- 

-greg

http://neenjatech.org

Passionate hatred can give meaning and purpose to an empty life.
                -- Eric Hoffer



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