From 40325b26300153d83d7c9b124886cca94cf93d5d Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 11 Jan 2002 19:14:30 +0000 Subject: [PATCH] corrected wxMenuBar::Insert , ::Append for a correct title even when the menubar is already attached, also removed a menu->attach which is not necessary anymore. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/menu.cpp | 18 ++++++++++++------ src/mac/menu.cpp | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index 17e8679a5b..548f803aab 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -836,11 +836,13 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) m_titles.Insert(title, pos); - menu->Attach(this); + Str255 label ; + wxMenuItem::MacBuildMenuString( label, NULL , NULL , title , false ); + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , label ) ; if ( IsAttached() ) { - if ( pos == (size_t) -1 ) + if ( pos == (size_t) -1 || pos + 1 == m_menus.GetCount() ) { ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; } @@ -946,13 +948,17 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) return FALSE; m_titles.Add(title); + + Str255 label ; + wxMenuItem::MacBuildMenuString( label, NULL , NULL , title , false ); + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , label ) ; if ( IsAttached() ) { - if (s_macInstalledMenuBar == this) - { - ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; - } + if (s_macInstalledMenuBar == this) + { + ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; + } #if wxUSE_ACCEL if ( menu->HasAccels() ) diff --git a/src/mac/menu.cpp b/src/mac/menu.cpp index 17e8679a5b..548f803aab 100644 --- a/src/mac/menu.cpp +++ b/src/mac/menu.cpp @@ -836,11 +836,13 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) m_titles.Insert(title, pos); - menu->Attach(this); + Str255 label ; + wxMenuItem::MacBuildMenuString( label, NULL , NULL , title , false ); + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , label ) ; if ( IsAttached() ) { - if ( pos == (size_t) -1 ) + if ( pos == (size_t) -1 || pos + 1 == m_menus.GetCount() ) { ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; } @@ -946,13 +948,17 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) return FALSE; m_titles.Add(title); + + Str255 label ; + wxMenuItem::MacBuildMenuString( label, NULL , NULL , title , false ); + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , label ) ; if ( IsAttached() ) { - if (s_macInstalledMenuBar == this) - { - ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; - } + if (s_macInstalledMenuBar == this) + { + ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; + } #if wxUSE_ACCEL if ( menu->HasAccels() ) -- 2.47.2