Re: having a scollable widget



thanks havoc.

i am using gtk 1.3.2 to develop this widget for two reasons: so as not
to have to rewrite the widget later when 2.0 comes out, and the app i'm
developing this for uses gtkwaveform. the most up to date version of
gtkwaveform is only for 1.3.2.

so for 1.3.x, the widget should listen for the
set_scroll_adjustments_signal then use gdk_window_scroll? do you
recommend just inheriting from GtkLayout?

thanks alot. i'll have to try this after some sleep!


Havoc Pennington wrote:

gregor waltz villanova edu writes:
how do you make your widget so that it can be scrolled in a scrolled
window widget?

You implement the set_scroll_adjustments signal, and you put the
signal ID in GtkWidgetClass::set_scroll_adjustments_signal in your
class_init function. Look at GtkLayout, GtkCList, etc. for examples.
This is a hack because GTK 1.2 lacks interfaces. It is equivalent to a
GtkScrollable interface, conceptually.

i saw that there is a GDK_SCROLL event in 1.3.2, but attaching to it
doesn't seem to produce any events when scrolled. i read in the archive
that this event is for scroll button mice. is that all it's for?

Yes, these events control the scrollbar, your widget should respond to
value_changed on the scroll adjustments and ignore the scroll events.

i have GdkWindows in this widget. they stay in the same position when
the widget is scrolled. what do i need to do to make them move
appropriately?


If the widget has windows in the scroll region, the right thing to do
in 1.2 is derive from GtkLayout. Otherwise you have to do the stuff
that GtkLayout does, which is pretty scary (have a look in
gtklayout.c). GnomeCanvas is an example of a subclass of GtkLayout.

In 2.0, you simply call gdk_window_scroll() on a window and it
scrolls, unlike in GTK 1.2 where windows have a size limit of 32000,
in 2.0 the size of a window is represented by a 32-bit
int. gdk_window_scroll() does the scary GtkLayout stuff.

Havoc

-- 

-greg


100 buckets of bits on the bus
100 buckets of bits
Take one down, short it to ground
FF buckets of bits on the bus

FF buckets of bits on the bus
FF buckets of bits
Take one down, short it to ground
FE buckets of bits on the bus...

ad infinitum...




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