accelerators outside menu



hi all,

I was using a couple of accelerators on the menu of my application and all was fine until I created the fullscreen mode, which hides the menu, and naturally the menu accelerators are disabled.

what would be the best way to create an application wide accelerators that would stay alive when the window go full-screen ?

I saw the Widget::add_accelerator method, and the AccelGroup class in the reference documentations, but the abstraction is still not totally clear, besides some details.

... after some searching around and trying out ... I found keyval possible values listed here: /usr/include/gtk-2.0/gdk/gdkkeysyms.h ... but I still don't know what are the possible values for the (Glib::ustring) "accel_signal", and what it means ... Any hints ?

thanks :)


...

an hour later ... I still can't make the accelerators work. I tried, inside my GtkWindow derivate construtor:

    ...
    m_accelerators  = get_accel_group();
    Glib::RefPtr<Glib::Object> accelertable = m_accelerators; // ???? 
    if ( ! m_accelerators ) throw missing_widget( "Gtk::Window::get_accel_group() returned empty!" );
    m_accelerators->activate( /*GQuark ???*/ Glib::Quark("fullscreen"), /* accelertable ??? */ accelertable, 'F', Gdk::CONTROL_MASK );
    m_accelerators->signal_accel_activate().connect( sigc::mem_fun( *this, &MyWindow::on_fullscreen ) );
    ...

it compiled fine, and also ran, but Ctrl+F never activate anything :( ... Any ideas ?


I also tried:    
    ...
     m_accelerators  = get_accel_group();
    add_accelerator( "fullscreen", m_accelerators, 'F', /* Modifiers GDK::CONTROL_MASK */ Gdk::RELEASE_MASK, Gtk::ACCEL_VISIBLE );
    ..

but it complains:

 Gtk-WARNING **: gtkwidget.c:3260: widget `gtkmm__GtkWindow' has no activatable signal "fullscreen" without arguments

well, understandable ... but I couldn't find where to associate the "accel_signal" (a string) to an actual signal which I could connect to.


any help would be greatly appreciated :)

thnks!

jan





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