]> git.saurik.com Git - wxWidgets.git/commitdiff
corrected wxMenuBar::Insert , ::Append for a correct title even when the menubar...
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 11 Jan 2002 19:14:30 +0000 (19:14 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 11 Jan 2002 19:14:30 +0000 (19:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/menu.cpp
src/mac/menu.cpp

index 17e8679a5b085b4b117bb69fd553e999d87fb751..548f803aab13b2efc73c0d141d528943c1a27a67 100644 (file)
@@ -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() )
index 17e8679a5b085b4b117bb69fd553e999d87fb751..548f803aab13b2efc73c0d141d528943c1a27a67 100644 (file)
@@ -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() )