void UnsetInvokingWindow( wxWindow *win );
// common part of Append and Insert
- bool GtkAppend(wxMenu *menu, const wxString& title);
+ bool GtkAppend(wxMenu *menu, const wxString& title, int pos=-1);
#ifndef __WXGTK20__
GtkAccelGroup *m_accel;
// common code for all constructors:
void Init();
- // common part of Append and Insert
- bool GtkAppend(wxMenuItem *item);
+ // common part of Append (if pos == -1) and Insert
+ bool GtkAppend(wxMenuItem *item, int pos=-1);
GtkWidget *m_prevRadio;
void UnsetInvokingWindow( wxWindow *win );
// common part of Append and Insert
- bool GtkAppend(wxMenu *menu, const wxString& title);
+ bool GtkAppend(wxMenu *menu, const wxString& title, int pos=-1);
#ifndef __WXGTK20__
GtkAccelGroup *m_accel;
// common code for all constructors:
void Init();
- // common part of Append and Insert
- bool GtkAppend(wxMenuItem *item);
+ // common part of Append (if pos == -1) and Insert
+ bool GtkAppend(wxMenuItem *item, int pos=-1);
GtkWidget *m_prevRadio;
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;
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;
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;
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;