Re: [gtkmm] Callback for signal_delete_event



Am Mon, 2002-10-07 um 10.24 schrieb Pierre Sarrazin:
> What is the right signature for a method that must act as a
> callback for signal_delete_event()?
> 
> I am using gtkmm 1.3.23 and libgnomeuimm 1.3.10.
> 
> I have a class that is derived from Gnome::UI::App and its
> constructor has this statement:
> 
>     signal_delete_event().connect(slot(this, &MyApp::onExit));

That should be:

    signal_delete_event().connect(SigC::slot(*this, &MyApp::onExit));

libsigc++-1.1 only accepts references as object parameter, not pointers.

> The callback is the following:
> 
>     bool
>     MyApp::onExit(GdkEventAny *)
>     {
>         Gtk::Main::quit();
>         return true;
>     }
> 
> This signature seems to follow what this page suggests:
> http://www.gtkmm.org/gtkmm2/reference/html/classGtk_1_1Widget.html

That's OK.  However, if you only want to call Gtk::Main::quit() you can
make gtkmm do that for you.  See Gtk::Main::run(Gtk::Window& window).

--Daniel





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