From e54cfe2b287504d32d7dc18e3b450ab307faaca1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 24 Apr 2000 19:50:48 +0000 Subject: [PATCH] fix for Insert() with tear off menus git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/menu.cpp | 6 ++++++ src/gtk1/menu.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 25d5e2e540..0a4aa86443 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -963,6 +963,12 @@ bool wxMenu::DoInsert(size_t pos, wxMenuItem *item) if ( !GtkAppend(item) ) return FALSE; + if ( m_style & wxMENU_TEAROFF ) + { + // change the position as the first item is the tear-off marker + pos++; + } + GtkMenuShell *menu_shell = GTK_MENU_SHELL(m_factory->widget); gpointer data = g_list_last(menu_shell->children)->data; menu_shell->children = g_list_remove(menu_shell->children, data); diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 25d5e2e540..0a4aa86443 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -963,6 +963,12 @@ bool wxMenu::DoInsert(size_t pos, wxMenuItem *item) if ( !GtkAppend(item) ) return FALSE; + if ( m_style & wxMENU_TEAROFF ) + { + // change the position as the first item is the tear-off marker + pos++; + } + GtkMenuShell *menu_shell = GTK_MENU_SHELL(m_factory->widget); gpointer data = g_list_last(menu_shell->children)->data; menu_shell->children = g_list_remove(menu_shell->children, data);