From: David Elliott Date: Fri, 26 Mar 2004 20:37:27 +0000 (+0000) Subject: Create real separator items instead of items without titles X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/67352554ffd3eea1b706a7f3609b093122602b90 Create real separator items instead of items without titles (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 --- diff --git a/src/cocoa/menuitem.mm b/src/cocoa/menuitem.mm index fdc0620a3e..43c111f79c 100644 --- a/src/cocoa/menuitem.mm +++ b/src/cocoa/menuitem.mm @@ -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()