Hi,
I'm new to write gtk widget. I'm planning to write a picasa style scrollbar,
firstly, write vertical one.
The new scrollbar inherit from GtkVScrollbar and with a vscale data member:
struct _GtkVPScrollbar
{
GtkVScrollbar vscrollbar;
GtkWidget *vscale;
}
The new scrollbar override realize, map, size request and size allocate and
expose.
In realize, the new scrollbar calls parent class, GtkVScrollbar's realize.
Vscale uses new GdkWindowAttr to create new gdk window for GtkRange's
event_window. The widget window use new scrollbar widget's parent window:
vscale->window = gtk_widget_get_parent_window (widget);
GTK_RANGE (vscale)->event_window = gdk_window_new
(gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
In map, size request and size allocate and expose, parent class' functions
of the new scrollbar widget and vscale are called respectively.
Now, there is an event window covered on original scrollbar and receives
mouse click events, but it is only a gray rectangle. The slider of vscale is
not shown correctly. I guess in expose, I can't just call parent class'
function directly but should do something more. But I don't have any idea of
what to do more.
If possible, please give me some point to continue the widget programming.
I've read some tutorials but they only said about basic new widget from
scratch, draw line or box; another is composite widget inherit from a
container, but I prefer inherit from GtkScrollbar.
Sorry for my poor English. It' welcome to discuss this issue with me
directly.
Regards,
Eric Tsai
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list