+ menuItem = gtk_pixmap_menu_item_new ();
+ GtkWidget *label = gtk_accel_label_new ( wxGTK_CONV( text ) );
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_container_add (GTK_CONTAINER (menuItem), label);
+
+ gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), menuItem);
+ guint accel_key;
+ GdkModifierType accel_mods;
+
+ // accelerator for the item, as specified by its label
+ // (ex. Ctrl+O for open)
+ gtk_accelerator_parse(GetHotKey(*mitem).c_str(), &accel_key,
+ &accel_mods);
+ if (accel_key != GDK_VoidSymbol)
+ {
+ gtk_widget_add_accelerator (menuItem,
+ "activate_item",
+ m_accel,
+ accel_key, accel_mods,
+ GTK_ACCEL_VISIBLE);
+ }
+
+ // accelerator for the underlined char (ex ALT+F for the File menu)
+ 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);
+ }
+
+ gtk_widget_show (label);
+
+ mitem->SetLabelWidget(label);
+
+ GtkWidget* pixmap = gtk_pixmap_new( gdk_pixmap, gdk_bitmap );
+ gtk_widget_show(pixmap);
+ gtk_pixmap_menu_item_set_pixmap(GTK_PIXMAP_MENU_ITEM( menuItem ), pixmap);
+
+ gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
+ GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
+ (gpointer)this );
+
+ if (pos == -1)
+ gtk_menu_append( GTK_MENU(m_menu), menuItem );
+ else
+ gtk_menu_insert( GTK_MENU(m_menu), menuItem, pos );
+ gtk_widget_show( menuItem );
+#endif
+
+ m_prevRadio = NULL;
+ }
+ else // a normal item
+ {
+ // text has "_" instead of "&" after mitem->SetText() so don't use it
+ wxString text( mitem->GetText() );
+
+ switch ( mitem->GetKind() )
+ {
+ case wxITEM_CHECK:
+ {
+#ifdef __WXGTK20__
+ menuItem = gtk_check_menu_item_new_with_mnemonic( wxGTK_CONV( text ) );
+#else
+ menuItem = gtk_check_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
+ m_prevRadio = NULL;
+ break;
+ }
+
+ case wxITEM_RADIO:
+ {
+ GSList *group = NULL;
+ if ( m_prevRadio == NULL )
+ {
+ // start of a new radio group
+#ifdef __WXGTK20__
+ m_prevRadio = menuItem = gtk_radio_menu_item_new_with_mnemonic( group, wxGTK_CONV( text ) );
+#else
+ m_prevRadio = menuItem = gtk_radio_menu_item_new_with_label( group, 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
+ }
+ else // continue the radio group
+ {
+#ifdef __WXGTK20__
+ group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (m_prevRadio));
+ m_prevRadio = menuItem = gtk_radio_menu_item_new_with_mnemonic( group, wxGTK_CONV( text ) );
+#else
+ group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (m_prevRadio));
+ m_prevRadio = menuItem = gtk_radio_menu_item_new_with_label( group, 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);
+ }