//to compile, type:
//g++ -g -Wall `pkg-config --cflags --libs gtkmm-2.4` -o inheritance inheritance.cc
#include <gtkmm.h>

using namespace sigc ;
using namespace Glib ;
using namespace Gtk ;

class FWindow : public Gtk::Window {
    VBox *m_vbox ;

    void init ()
    {
        set_default_size (500, 400) ;

        m_vbox = manage (new VBox) ;
        Window::add (*m_vbox) ;
        Button *button = manage (new Button ("click me !")) ;
        button->signal_clicked ().connect (mem_fun (*this,
                                                    &FWindow::on_click)) ;

        HBox *hbox = manage (new HBox) ;
        hbox->pack_end (*button, PACK_SHRINK) ;
        m_vbox->pack_end (*hbox, PACK_SHRINK) ;
        m_vbox->show_all () ;
    }

    void on_click ()
    {
        MessageDialog dialog (*this, "Woot, you clicked !") ;
        dialog.run () ;
    }

public:

    FWindow (const ustring &a_title="Fancy window !",
            WindowType a_type=WINDOW_TOPLEVEL) :
        Window (a_type)
    {
        init () ;
        set_title (a_title) ;
    }

    ~FWindow ()
    {
    }

    void add (Widget &a_widget)
    {
        m_vbox->pack_start (a_widget) ;
    }
};//end class Window


int
main (int argc, char ** argv)
{
    Main init (argc, argv) ;

    Label label ("Hooray, this is a fancy text!") ;
    FWindow my_window ;
    my_window.add (label) ;
    my_window.show_all () ;

    Gtk::Main::run (my_window) ;
}

