Re: help with pixmaps




I've taken gnome-list out of there.  No point in spamming two lists for
the same question.

> The gdk_draw_* routines draw onto a GdkWindow, which is a wrapper for an X

Do you know where the docs are for this?  I couldn't find anything in the
www.gtk.org that I could refer to.  

> window.  Almost every widget has a GdkWindow, except for a few small ones
> like GtkLabel, where they draw on their parent's window.  A GtkDrawingArea
> widget is a good widget for directly drawing onto, since you will not
> mess around with the what the widget draws.

Yeah, thats what I figured would be the right thing to do.  According to
what you've said every widget has a GdkWindow associated with it.  How do
figure out what the GdkWindow is say for GtkWidget?  Do you use the
realize function (ie gtk_realize(app)?  

Looks like I better go and read through the whole gtk/gdk stuff more
thoroughly.  A more basic question is how do you find the GdkWindow for a
GtkWidget?  (GdkWindow *)app (where app is of type (GtkWidget *))?

> After the widget is realised, the GTK_WIDGET(wid)->window attribute will
> be set to the GdkWindow for the object.  You can then draw on the window.

Okay.. I think I understand this.

> You will want to connect to the expose_event signal, as the contents of a
> GdkWindow must be redrawn when it is exposed.  Alternatively, you could
> create a GdkPixmap (an offscreen buffer.  It can be drawn on with the
> gdk_draw_* routines, but you don't need to worry about exposure details),

This would work best because you do double buffering and cut down on
flickering although I believe GTK takes care of this for you.  

> do all you drawing on that and do a gdk_draw_pixmap() to draw the pixmap
> to the window on exposures.

Sounds good.  Sorry if I sound ignorant. I know programming but I've never
had to code user interfaces.  I've been avoiding it for 5 years now. :-)
Coding user interfaces seems very unexciting and I feel more like a
virtual plumber than a programmer.  (all those callbacks ya know)

For such a simple app it seems difficult.  I would have tried to use just
text but that seems like just a bit less complicated than my original
idea!

	regards,
	sri

---------------------------------------------------------------------------
Sri Ramkrishna         /|\ Unix is very user friendly, its just very picky
email: sri@aracnet.com -|- on who it is friendly to. -- Unknown? 
phone: 503-356-1078    \|/ 
---------------------------------------------------------------------------
                        |





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