[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
destroying widgets on C++
- From: Germano Leichsenring <germano s3ws6 seg kobe-u ac jp>
- To: gtk-app-devel-list redhat com
- Subject: destroying widgets on C++
- Date: Tue, 24 Nov 1998 21:43:47 +0900
I have a class which have a window in it; I want the class to be destroyed
when the widget is destroyed, and the widget be destroyed when the class is
destroyed. I've been trying it for a while, but can't find a solution that
works. Has anybody done that?
myclass::myclass()
{
destroy_handler =
gtk_signal_connect(GTK_OBJECT(toplevel_window), "destroy",
GTK_SIGNAL_FUNC(myclass_quit_CB),
(void*)this);
}
myclass::~myclass()
{
gtk_signal_disconnect(GTK_OBJECT(toplevel_window),destroy_handler);
if(GTK_IS_WIDGET(toplevel_window))
gtk_widget_destroy(toplevel_window);
}
myclass_quit_CB(GtkWidget *widget2,
myclass* data,
GtkWidget* widget)
{
delete data;
}
the problem on this is:
- if I destroy the class, the widget is destroyed;
- but if I destroy the widget, i'm destroying the widget 2 times.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]