static void
wxMenubarUnsetInvokingWindow(wxMenu* menu, wxWindow* win, GtkWindow* tlw = NULL)
{
- menu->SetInvokingWindow( (wxWindow*) NULL );
+ menu->SetInvokingWindow( NULL );
// support for native hot keys
if (menu->m_accel)
void wxMenuBar::UnsetInvokingWindow( wxWindow *win )
{
- m_invokingWindow = (wxWindow*) NULL;
+ m_invokingWindow = NULL;
wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
wxMenu *menuOld = Remove(pos);
if ( menuOld && !Insert(pos, menu, title) )
{
- return (wxMenu*) NULL;
+ return NULL;
}
// either Insert() succeeded or Remove() failed and menuOld is NULL
{
wxMenu *menu = wxMenuBarBase::Remove(pos);
if ( !menu )
- return (wxMenu*) NULL;
+ return NULL;
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu->m_owner), NULL);
gtk_container_remove(GTK_CONTAINER(m_menubar), menu->m_owner);
if ( menuForItem )
{
- *menuForItem = result ? result->GetMenu() : (wxMenu *)NULL;
+ *menuForItem = result ? result->GetMenu() : NULL;
}
return result;
}
}
+// "can_activate_accel" from menu item
+extern "C" {
+static gboolean can_activate_accel(GtkWidget*, guint, wxMenu* menu)
+{
+ menu->UpdateUI();
+ // always allow our "activate" handler to be called
+ return true;
+}
+}
+
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
void wxMenu::Init()
// NB: keep reference to the menu so that it is not destroyed behind
// our back by GTK+ e.g. when it is removed from menubar:
g_object_ref(m_menu);
- g_object_ref_sink(m_menu);
+ gtk_object_sink(GTK_OBJECT(m_menu));
- m_owner = (GtkWidget*) NULL;
+ m_owner = NULL;
// Tearoffs are entries, just like separators. So if we want this
// menu to be a tear-off one, we just append a tearoff entry
}
else
{
+ g_signal_connect(menuItem, "can_activate_accel",
+ G_CALLBACK(can_activate_accel), this);
g_signal_connect (menuItem, "activate",
G_CALLBACK(menuitem_activate),
mitem);