Interaction between GTK+ and C++



Hi,

Has anyone tried to wrap GTK+ in C++ without using GTKmm?
That is, making calls to GTK?s C-language API from C++ objects?
If so, has anyone documented the paradigms/techniques/gotchas,
or published sample code?

Specifically, how does one manage the lifespan of interdependent
widgets and C++ objects? Is it feasible to have both event-driven
GTK callbacks which reference C++ objects and externally-driven
calls to the C++ objects which reference these same widgets?
How does one manage the lifespan of such objects and widgets?

For example, an instance "obj" of class "MyWrapper" contains
a pointer to a widget "widg", and the address of "obj" has
been passed as a user-data argument to a GTK signal handler
for "widg".

How might one manage the lifespans of "obj" and "widg" given
that someone could both (i) call "delete" on "obj", and
(ii) call "gtk_widget_destroy" on "widg"?

Is it just a bad idea to try to mix event-driven code with
external triggers?

Any comments/feedback you might have would be very much appreciated.

Brian

_________________________________________
 Brian Hanley, Software Developer
 FlexTrade Systems - Great Neck, NY 11021
 brian hanley flextrade com
 +1 (516) 627-8993 Ext. 238
_________________________________________




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