]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/menu.mm
Fixed Mac CodeWarrior compilation (there's no <sys/types.h>).
[wxWidgets.git] / src / cocoa / menu.mm
index d1e0df837da9bd277f100dbff0f028757a8e69f3..3c69ea748198f3b4aaefd49b673cb1a44e2e8680 100644 (file)
@@ -42,15 +42,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
 
 bool wxMenu::Create(const wxString& title, long style)
 {
-#if 0
-    if(!title)
-        return CocoaCreate("wxMenu");
-#endif
-    return CocoaCreate(title);
+    wxAutoNSAutoreleasePool pool;
+    m_cocoaNSMenu = [[NSMenu alloc] initWithTitle: [NSString stringWithCString: title.c_str()]];
+    return true;
 }
 
 wxMenu::~wxMenu()
 {
+    [m_cocoaNSMenu release];
 }
 
 bool wxMenu::DoAppend(wxMenuItem *item)
@@ -87,8 +86,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow)
 
 bool wxMenuBar::Create(long style)
 {
-    if(!CocoaCreate("wxMenuBar"))
-        return false;
+    wxAutoNSAutoreleasePool pool;
+    m_cocoaNSMenu = [[NSMenu alloc] initWithTitle: @"wxMenuBar"];
+
     NSMenuItem *dummyItem = [[NSMenuItem alloc] initWithTitle:@"App menu"
         /* Note: title gets clobbered by app name anyway */
         action:nil keyEquivalent:@""];
@@ -99,6 +99,7 @@ bool wxMenuBar::Create(long style)
 
 wxMenuBar::~wxMenuBar()
 {
+    [m_cocoaNSMenu release];
 }
 
 bool wxMenuBar::Append( wxMenu *menu, const wxString &title )