]> git.saurik.com Git - wxWidgets.git/commitdiff
Create real separator items instead of items without titles
authorDavid Elliott <dfe@tgwbd.org>
Fri, 26 Mar 2004 20:37:27 +0000 (20:37 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Fri, 26 Mar 2004 20:37:27 +0000 (20:37 +0000)
(NOTE: Use diff -w to see what this really changes)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26373 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/menuitem.mm

index fdc0620a3e7d1ee6e412cb268a97617952d6c3f8..43c111f79c75e32d0ab48550bba2d91da47fb6bc 100644 (file)
@@ -135,17 +135,22 @@ wxMenuItemCocoa::wxMenuItemCocoa(wxMenu *pParentMenu,
           : wxMenuItemBase(pParentMenu, itemid, strName, strHelp, kind, pSubMenu)
 {
     wxAutoNSAutoreleasePool pool;
-    NSString *menuTitle = wxInitNSStringWithWxString([NSString alloc],wxStripMenuCodes(strName));
-    m_cocoaNSMenuItem = [[NSMenuItem alloc] initWithTitle:menuTitle action:@selector(wxMenuItemAction:) keyEquivalent:@""];
-    sm_cocoaHash.insert(wxMenuItemCocoaHash::value_type(m_cocoaNSMenuItem,this));
-    [m_cocoaNSMenuItem setTarget:sm_cocoaTarget];
-    if(pSubMenu)
+    if(m_kind == wxITEM_SEPARATOR)
+        m_cocoaNSMenuItem = [[NSMenuItem separatorItem] retain];
+    else
     {
-        wxASSERT(pSubMenu->GetNSMenu());
-        [pSubMenu->GetNSMenu() setTitle:menuTitle];
-        [m_cocoaNSMenuItem setSubmenu:pSubMenu->GetNSMenu()];
+        NSString *menuTitle = wxInitNSStringWithWxString([NSString alloc],wxStripMenuCodes(strName));
+        m_cocoaNSMenuItem = [[NSMenuItem alloc] initWithTitle:menuTitle action:@selector(wxMenuItemAction:) keyEquivalent:@""];
+        sm_cocoaHash.insert(wxMenuItemCocoaHash::value_type(m_cocoaNSMenuItem,this));
+        [m_cocoaNSMenuItem setTarget:sm_cocoaTarget];
+        if(pSubMenu)
+        {
+            wxASSERT(pSubMenu->GetNSMenu());
+            [pSubMenu->GetNSMenu() setTitle:menuTitle];
+            [m_cocoaNSMenuItem setSubmenu:pSubMenu->GetNSMenu()];
+        }
+        [menuTitle release];
     }
-    [menuTitle release];
 }
 
 wxMenuItem::~wxMenuItem()