return GtkAppend(menu, title);
}
-bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title)
+bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title, int pos)
{
wxString str( wxReplaceUnderscore( title ) );
gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
- gtk_menu_shell_append( GTK_MENU_SHELL(m_menubar), menu->m_owner );
+ if (pos == -1)
+ gtk_menu_shell_append( GTK_MENU_SHELL(m_menubar), menu->m_owner );
+ else
+ gtk_menu_shell_insert( GTK_MENU_SHELL(m_menubar), menu->m_owner, pos );
gtk_signal_connect( GTK_OBJECT(menu->m_owner), "activate",
GTK_SIGNAL_FUNC(gtk_menu_open_callback),
// TODO
- if ( !GtkAppend(menu, title) )
+ if ( !GtkAppend(menu, title, (int)pos) )
return FALSE;
return TRUE;
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
{
+ if ( *pc == wxT('\t'))
+ break;
+
if ( *pc == wxT('_') )
{
// GTK 1.2 escapes "xxx_xxx" to "xxx__xxx"
gtk_widget_destroy( m_menu );
}
-bool wxMenu::GtkAppend(wxMenuItem *mitem)
+bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos)
{
GtkWidget *menuItem;
// TODO
menuItem = gtk_menu_item_new();
#endif
- gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
-
+ 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() )
{
#endif
gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem), mitem->GetSubMenu()->m_menu );
- gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
+ 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 );
GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
(gpointer)this );
- gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
+ 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
menuItem = gtk_pixmap_menu_item_new ();
GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
(gpointer)this );
- gtk_menu_append( GTK_MENU(m_menu), menuItem );
+ 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
GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
(gpointer)this );
- gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
+ 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);
}
guint accel_key;
return NULL;
// TODO
- if ( !GtkAppend(item) )
+ if ( !GtkAppend(item, (int)pos) )
return NULL;
return item;