Re: drawing in a not-callback-function
- From: "Brian J. Tarricone" <bjt23 cornell edu>
- To: gtk-app-devel-list gnome org
- Subject: Re: drawing in a not-callback-function
- Date: Tue, 02 Oct 2007 11:45:05 -0700
Daniel Dieterle wrote:
Hi,
i'm just beginning to collect some experience with gtk+ and glade.
My goal is to draw regularly a circle on an other position. I think the
right way doing this, is to use a timer-function. It should be something
like this:
gint draw_satellite( gpointer data )
{
gdk_draw_points( widget->window, gc_earth, (GdkPoint
*)&orbit_satellite[j], 1 );
satellite_position++;
}
gtk_timeout_add( 100, draw_satellite, NULL );
My problem is, that i can't imaging, how i can access the
"widget-window".
In a normal callback-function i get this value by a call of reference.
In general, you shouldn't be doing any drawing anywhere except in your
widget's expose handler. If you want to trigger a draw, you'd use
gtk_widget_queue_draw_area() (or gtk_widget_queue_draw() to just trigger
a redraw of the entire widget).
For the expose handler, if you have your own widget implementation,
you'd override GTK_WIDGET_CLASS(your_widget_class)->expose_event in your
widget's class_init() function, or, if it's not your own widget, you can
connect to the widget's "expose-event" signal. Do your drawing in that
handler.
-brian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]