Switching accelerators
- From: "Andrew E. Makeev" <andrew solvo ru>
- To: gtkmm-list <gtkmm-list gnome org>, gtk-list <gtk-list gnome org>
- Subject: Switching accelerators
- Date: Wed, 20 Dec 2006 17:29:01 +0300
Good day,
I am using window with notebook that has few pages.
Each page contains complex toolbar + widgets and GtkTreeView with
ListStore as model.
Toolbar has REFRESH button that allows user to update data from DB.
"F5" accelerator is connected to that toolbutton.
Glib::RefPtr< Gtk::ActionGroup > m_refMainGrod;
Gtk::Toolbar toolbar;
{
...
Glib::RefPtr<Gtk::Action> action = Gtk::Action::create
( "refresh", Gtk::Stock::REFRESH, "", instanceProperties.m_refresh );
m_refMainGroup->add
( action,
Gtk::AccelKey( "F5",
Glib::ustring( "<Actions>/MainGroup/" ) + toolbar.get_name() + "/refresh" ),
sigc::bind( sigc::mem_fun( *this,
&GridToolbar::actions_handler ),
REFRESH ) );
Gtk::ToolItem* item = action->create_tool_item();
item->set_tooltip( *instanceProperties.tooltips, instanceProperties.m_refresh );
item->set_expand( false );
item->set_homogeneous( false );
toolbar.append( *item );
/*
Here I am trying to change active accelerator when notebook page is
switched. So, connecting to map/unmap signals.
*/
item->signal_map().connect
( sigc::bind( sigc::mem_fun( *this, &GridToolbar::connect_accelerators ), action ) );
item->signal_unmap().connect
( sigc::bind( sigc::mem_fun( *this, &GridToolbar::disconnect_accelerators ), action ) );
...
}
void GridToolbar::connect_accelerators( Glib::RefPtr< Gtk::Action > action )
{
action->set_accel_group( grid_->m_Form->getWindow()->get_accel_group() );
action->connect_accelerator();
}
void GridToolbar::disconnect_accelerators( Glib::RefPtr< Gtk::Action > action )
{
action->disconnect_accelerator();
}
All works well until I pack toolbar into ScrolledWindow, and I have no
option to avoid that, unfortunatelly.
I should use gtk_scrolled_window_add_with_viewport(), because my widget
doesn't support scrolling innate, and that causes to drop GTK_NO_WINDOW
flag (GtkViewport does that).
When I was following signals I discovered that widget with GTK_NO_WINDOW
send SIGNAL_UNMAP for all children, but if that flag unset widget just
called gdk_window_hide(), and all underlaying childred has not received
SIGNAL_UNMAP.
Is it bug or some documented "feature"?
versions: Gtk+-2.4.13, Gtkmm-2.4.11 on Linux AS4-64
1. Is there a RIGHT way to switch accelerators, different from using
signal_map/signal_unmap?
2. Or should I just connect my handler to signal_unmap on widget that
yet receives the signal?
Thanks in advance,
-andrew
P.S.
Sorry, for english.
If someone would help but couldn't understood me well, let me know,
please.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]