30.08.2006 Scroll-Area and Sliders

See: http://blogs.testbit.eu/timj/2006/08/30/30082006-scroll-area-and-sliders/ (page moved)

It has been a while since i last blogged about Rapicorn and worked on new features for it. So here are some updates.

In order to get a scrollable area implemented, i first started out with the h/v slider implementations. That in turn required sorting out of the basic threading and main loop models (Rapicorn supports thread-per-window mode) to get timers going. I then ended up implementing 3 different gadgets to make up the sliders: SliderArea, SliderTrough and SliderSkid. I managed to keep the code generic enough with regards to packing abilities and movement to support horizontal and vertical scales as well as scrollbars with these 3 gadgets.

For the curious, an XML excerpt that packs together the necessary frames, buttons, boxes, ambience (shading) and functional gadgets for a vslider is here: Rapicorn vslider definition (23 lines).

Since Rapicorn currently has to support Gtk+/Gdk >= 2.6.x as rendering backend, scrolling had to be implemented with gdk_draw_drawable() + gdk_event_get_graphics_expose(). Once this dependency can be raised, we’ll use gdk_window_move_region() however. Tonight, i managed to complete the coordinate offset handling and got event processing going inside the scroll area, so here’s a button toggled inside a scroll area:

A couple other things also got fixed, like the Appearance/ColorScheme handling. E.g. here’s a blue test window, where the color scheme is derived from a set of just 3 base colors:

I’ll probably put up another tarball soon, after some polishing of the build setup and the window/main loop destruction phases.