}
PostCreation();
-
+
ApplyWidgetStyle();
}
m_widget = GTK_WIDGET(m_menubar);
PostCreation();
-
+
ApplyWidgetStyle();
}
{
menu->SetInvokingWindow( win );
-#if (GTK_MINOR_VERSION > 0)
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
wxWindow *top_frame = win;
while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
top_frame = top_frame->GetParent();
/* support for native hot keys */
- gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(top_frame->m_widget) );
+ GtkObject *obj = GTK_OBJECT(top_frame->m_widget);
+ if ( !g_slist_find( menu->m_accel->attach_objects, obj ) )
+ gtk_accel_group_attach( menu->m_accel, obj );
#endif
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
top_frame = top_frame->GetParent();
/* support for native key accelerators indicated by underscroes */
- gtk_accel_group_attach( m_accel, GTK_OBJECT(top_frame->m_widget) );
+ GtkObject *obj = GTK_OBJECT(top_frame->m_widget);
+ if ( !g_slist_find( m_accel->attach_objects, obj ) )
+ gtk_accel_group_attach( m_accel, obj );
#endif
wxMenuList::Node *node = m_menus.GetFirst();
if ( !GtkAppend(menu, title) )
return FALSE;
+ if (pos+1 >= m_menus.GetCount())
+ return TRUE;
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL(m_factory->widget);
gpointer data = g_list_last(menu_shell->children)->data;
menu_shell->children = g_list_remove(menu_shell->children, data);
wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
{
- if ( !wxMenuBarBase::Replace(pos, menu, title) )
- return (wxMenu*) NULL;
-
// remove the old item and insert a new one
wxMenu *menuOld = Remove(pos);
if ( menuOld && !Insert(pos, menu, title) )
if ( !menu )
return (wxMenu*) NULL;
+/*
GtkMenuShell *menu_shell = GTK_MENU_SHELL(m_factory->widget);
+
printf( "factory entries before %d\n", (int)g_slist_length(m_factory->items) );
printf( "menu shell entries before %d\n", (int)g_list_length( menu_shell->children ) );
-
+*/
+
// unparent calls unref() and that would delete the widget so we raise
// the ref count to 2 artificially before invoking unparent.
gtk_widget_ref( menu->m_menu );
gtk_widget_unparent( menu->m_menu );
-
+
gtk_widget_destroy( menu->m_owner );
-
+
+/*
printf( "factory entries after %d\n", (int)g_slist_length(m_factory->items) );
printf( "menu shell entries after %d\n", (int)g_list_length( menu_shell->children ) );
-
+*/
+
return menu;
}
static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
{
if (g_isIdle) wxapp_install_idle_handler();
-
+
int id = menu->FindMenuIdByMenuItem(widget);
/* should find it for normal (not popup) menu */