[gtkmm] glade-2 + on_realize()



If I have a

class MyWindow : public Gtk::Window

I know how to override Gtk::Window::on_realize(), and it works.

I'm trying now to understand how to achieve the same with glade-2 and
gtkmm2-2.2.3. So I'm building a very simple application - it has only a
Gtk::Window. I define a "realize" signal for this window, with the handler
on_window1_realize().

Glade creates the code below (only the relevant parts shown, for brevity)
and I put a cout in the "realize" handler, yet when I run the application,
the handler is not being called. Any idea what I'm doing wrong? Should I
set/add any events? Is it not the "realize" signal that I'm looking for? I
can post the .glade file if need be.

Thanks!


class window1_glade : public Gtk::Window
{

        GlademmData *gmm_data;
protected:
        window1_glade();
        ~window1_glade();
private:
        virtual void on_window1_realize() = 0;
};


window1_glade::window1_glade() : Gtk::Window(Gtk::WINDOW_TOPLEVEL)
{

   Gtk::Window *window1 = this;
   gmm_data = new GlademmData(get_accel_group());
   window1->set_title(_("window1"));
   window1->set_modal(false);
   window1->property_window_position().set_value(Gtk::WIN_POS_NONE);
   window1->set_resizable(true);
   window1->property_destroy_with_parent().set_value(false);
   window1->show();
   window1->signal_realize().connect(SigC::slot(*this,
&window1_glade::on_window1_realize));
}

class window1 : public window1_glade
{
        void on_window1_realize();
};

// user defined handler
void window1::on_window1_realize()
{
    std::cout << __FILE__ << ": " << __FUNCTION__ << std::endl;
}








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