13
0
livetrax/libs/gtkmm2/tests/scrolledwindow/main.cc
Paul Davis 449aab3c46 rollback to 3428, before the mysterious removal of libs/* at 3431/3432
git-svn-id: svn://localhost/ardour2/branches/3.0@3435 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-06-02 21:41:35 +00:00

66 lines
1.3 KiB
C++

#include <gtkmm.h>
#include <gtk/gtk.h>
#include <stdio.h>
void on_viewport_destroyed(GtkWidget* widget, gpointer)
{
GTK_VIEWPORT(widget);
g_warning("viewport destroyed");
}
void on_gtklabel_destroyed(GtkWidget*, gpointer)
{
g_warning("gtklabel destroyed");
}
class DerivedLabel : public Gtk::Label
{
public:
DerivedLabel() {}
virtual ~DerivedLabel() { printf("~DerivedLabel\n");}
};
class DerivedScrolledWindow : public Gtk::ScrolledWindow
{
public:
DerivedScrolledWindow() {}
virtual ~DerivedScrolledWindow() { printf("~DerivedScrolledWindow\n");}
};
class Instance
{
public:
Instance()
{
//m_pLabel = new DerivedLabel();
m_ScrolledWindow.add( m_pLabel );
g_signal_connect (G_OBJECT(m_ScrolledWindow.get_child()->gobj()), "destroy", G_CALLBACK(on_viewport_destroyed), NULL);
g_signal_connect (G_OBJECT(m_pLabel.gobj()), "destroy", G_CALLBACK(on_gtklabel_destroyed), NULL);
}
virtual ~Instance()
{
printf("~Instance() 1\n");
//m_ScrolledWindow.remove(); //Removes m_pLabel;
printf("~Instance() 2\n");
//delete m_pLabel;
printf("~Instance() 3\n");
}
protected:
DerivedLabel m_pLabel;
DerivedScrolledWindow m_ScrolledWindow;
};
int main ( int argc, char *argv[] ) {
Gtk::Main main( argc, argv );
Instance instance;
}