- if (pos == -1)
- gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
- else
- gtk_menu_shell_insert(GTK_MENU_SHELL(m_menu), menuItem, pos);
- }
- else if ( mitem->IsSubMenu() )
- {
- // text has "_" instead of "&" after mitem->SetText()
- wxString text( mitem->GetText() );
-
-#ifdef __WXGTK20__
- menuItem = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( text ) );
-#else
- menuItem = gtk_menu_item_new_with_label( wxGTK_CONV( text ) );
- GtkLabel *label = GTK_LABEL( GTK_BIN(menuItem)->child );
- // set new text
- gtk_label_set_text( label, wxGTK_CONV( text ) );
- // reparse key accel
- guint accel_key = gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV( text ) );
- if (accel_key != GDK_VoidSymbol)
- {
- gtk_widget_add_accelerator (menuItem,
- "activate_item",
- gtk_menu_ensure_uline_accel_group(GTK_MENU(m_menu)),
- accel_key,
- GDK_MOD1_MASK,
- GTK_ACCEL_LOCKED);
- }
-#endif
-
- gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem), mitem->GetSubMenu()->m_menu );
- if (pos == -1)
- gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
- else
- gtk_menu_shell_insert(GTK_MENU_SHELL(m_menu), menuItem, pos);
-
- gtk_widget_show( mitem->GetSubMenu()->m_menu );
-
- // if adding a submenu to a menu already existing in the menu bar, we
- // must set invoking window to allow processing events from this
- // submenu
- if ( m_invokingWindow )
- wxMenubarSetInvokingWindow(mitem->GetSubMenu(), m_invokingWindow);
-
- m_prevRadio = NULL;