+ gtk_signal_connect( GTK_OBJECT(menuItem), "select",
+ GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
+ (gpointer*)this );
+
+ gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
+ GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
+ (gpointer*)this );
+
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem), subMenu->m_menu );
+
+ mitem->SetMenuItem(menuItem);
+ mitem->SetSubMenu(subMenu);
+
+ m_items.Append( mitem );
+}
+
+void wxMenu::Append( wxMenuItem *item )
+{
+ m_items.Append( item );
+
+ GtkWidget *menuItem = (GtkWidget*) NULL;
+
+ if (item->IsSeparator())
+ menuItem = gtk_menu_item_new();
+ else if (item->IsSubMenu())
+ menuItem = gtk_menu_item_new_with_label(item->GetText().mbc_str());
+ else
+ menuItem = item->IsCheckable() ? gtk_check_menu_item_new_with_label(item->GetText().mbc_str())
+ : gtk_menu_item_new_with_label(item->GetText().mbc_str());
+
+ if (!item->IsSeparator())
+ {
+ gtk_signal_connect( GTK_OBJECT(menuItem), "select",
+ GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
+ (gpointer*)this );
+
+ gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
+ GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
+ (gpointer*)this );
+
+ if (!item->IsSubMenu())
+ {
+ gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
+ GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
+ (gpointer*)this );
+ }
+ }
+
+ gtk_menu_append( GTK_MENU(m_menu), menuItem );
+ gtk_widget_show( menuItem );
+ item->SetMenuItem(menuItem);
+}
+
+int wxMenu::FindItem( const wxString itemString ) const
+{
+ wxString s = _T("");
+ for ( const wxChar *pc = itemString; *pc != _T('\0'); pc++ )
+ {
+ if (*pc == _T('&'))
+ {
+ pc++; /* skip it */
+#if (GTK_MINOR_VERSION > 0)
+ s << _T('_');
+#endif
+ }
+ s << *pc;
+ }
+
+ wxNode *node = m_items.First();
+ while (node)
+ {
+ wxMenuItem *item = (wxMenuItem*)node->Data();
+ if (item->GetText() == s)
+ {
+ return item->GetId();
+ }
+ node = node->Next();
+ }
+
+ return wxNOT_FOUND;