Re: composite widget and custom draw with cairo



2006/9/16, Tommi Sakari Uimonen <tuimonen cc hut fi>:
Hello.

I managed to modify the tictactoe example so that I could draw on top of
the 3x3 button grid with cairo. I followed the tutorial of creating custom
widgets and added expose event to the tictactoe.

But when I replaced the buttons with my own custom widgets based on
GtkDrawingArea, the tictactoe's expose even was not called anymore.

GtkDrawingArea has its own GdkWindow, which in this case means that
the area of the tictactoe's GdkWindow is actually not visible.

My custom widget uses cairo also and has its own expose event.

I need to draw on top of the custom child widgets. Any Ideas what could be
the problem?

If you can just derive from something else than the DrawingArea, that
would probably be the easiest route.

Otherwise it means either covering the child windows and doing some
compositing (or magic trickery with widget->window) or, less
hackishly, connecting to the exposes of the child widgets and drawing
in there (but this means you need to calculate where the child widget
is and draw in pieces which may or may not be feasible).

Either way, overlaying graphics on child widgets is not that simple
(when they have windows of their own). In general, you should not do
that unless you *know* if the children won't have windows (ie. only in
fixed-structure widgets).

P.S. This is on the borderline of being a question of developing
*with* GTK+ not GTK+ itself, which means the proper address is
gtk-app-devel- or gtk-list. Not sure how custom widgets fit in the
picture (if there even is a "policy" for them) so not cc:ing. Widget
development sounds more approperiate for this list IMO. There probably
should be a mention on the listinfo page about this, whichever way it
is preferred.

--
Kalle Vahlman, zuh iki fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi



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