Howto manage objects in DrawingArea?



Hello,
yet another noob question:
i need to draw objects like Bezier curves or text onto a DrawingArea.
I derived a own class from DrawingArea and made classes for every object
i want to draw (e.g. BezierCurve). All these objects have a draw() method.
But to draw the object this method of course needs to have a pointer to
the DrawingArea. Not only to get the GDK::Window to draw on but also to
get some properties like the offset and zoom, so the object knows at
which position it should draw.

My question is how to manage this nicely?
Until now i passed every object a pointer to my DrawingArea class, but
this is very ugly i think.
Especially since i have an inclusion cycle because the DrawingArea
header needs to include the objects headers which again need to include
the DrawingArea.
How can i manage this access better? e.g. how to the gtk widgets do it,
what happens when i add a widget to a container. How does it know where
it should draw itself on?

thanks a lot in advance

buergi


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