Re: Disable Alt+F4



Hi,

Am Montag, den 14.12.2009, 04:12 +0100 schrieb Milosz Derezynski:

>   bool
>   on_my_toplevel_delete_handler( GdkEventAny* G_GNUC_UNUSED )

Just as a side note, the unused attribute is not necessary if you omit
the parameter name, as you did.

>   int main( int argc, char* argv[])
>   {
>     Gtk::Main kit (argc, argc);
>     Gtk::Window my_toplevel ;
>     // some other code to setup the app in between
> 
>  my_toplevel.signal_delete_event().connect( sigc::ptr_fun( &on_my_toplevel_delete_handler ), true /* important! */ );
>     my_toplevel.show();
>     kit.run();

Note that you can still use Gtk::Main::run(my_toplevel) for simplicity.
It connects signal_hide() to Gtk::Main::quit(), not delete_event.  The
window will not be hidden in response to delete_event if you return true
from the handler to stop the signal emission.

Cheers,
--Daniel




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