Re: [gtk-list] General GDK cluelessness (on my part)




On Wed, 2 Jun 1999, Rob Huffstedtler wrote:
> I've been fiddling with GTK+/GDK for about a month now, and I have most of
> the GTK stuff down enough that I'm able to write simple apps with it and
> be fairly pleased with the result.  The GDK stuff is a bit harder, mostly
> because it is not as well documented.  I bought the Harlow book (which I
> have mixed feelings about) and it has been somewhat helpful, but there are
> a few things I just don't grok.
>

In addition to Eric's book, I'd recommend picking up the Xlib Programming
Manual. This will fill you in on some conceptual background that you might
be having trouble with. The Xlib man pages can be helpful too, though they
don't really have the conceptual explanations.
 
> 1)What are some opinions as to where one should declare their backing
> pixmap, their configure and expose events, etc.  Should the pixmap be
> global or should it get passed around as a parameter?
>

I would have one backing pixmap associated with each drawing area, in the
style of the "scribble" example in the tutorial. 
 
> 2)The Harlow book uses a GdkRectangle called update_rectangle in the
> functions he uses for drawing.  He assigns it position , widht and height,
> but never does anything with it other than pass it into the
> gtk_widget_draw function.  Just guessing, the GdkREctangle is the area of
> the widget that needs to be redrawn?  Is this in the docs somewhere?  Did
> I just overlook it?
> 

The rectangle passed to gtk_widget_draw() is the area that needs
redrawing. Normally you'd use this rectangle to set the clipping rectangle
of the graphics contexts you draw with.

> 3)Does anyone have some sample code that uses GDK that isn't a huge
> application like GIMP?
> 

Hmm, I can't think of a good example there.

Most of the Gnome apps use the GnomeCanvas instead of a drawing area now. 
The "scribble" thing in the tutorial is the only real example I can
think of. 

You might look at the default theme engine in gtk/gtkstyle.c, and all the
widgets' draw functions.

Havoc




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