]> git.saurik.com Git - wxWidgets.git/commitdiff
* Move m_cocoaNSMenu out of wxCocoaNSMenu and into wxMenu and wxMenuBar
authorDavid Elliott <dfe@tgwbd.org>
Fri, 5 Sep 2003 14:00:53 +0000 (14:00 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Fri, 5 Sep 2003 14:00:53 +0000 (14:00 +0000)
* Comment out wxPoserNSMenu (it's not needed for now, may never be)

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

include/wx/cocoa/NSMenu.h
include/wx/cocoa/menu.h
src/cocoa/NSMenu.mm
src/cocoa/menu.mm

index 4e9043f61b2424d2275403bd5828df592e76a2d1..354d4738d4da72b599dfc2571c836aa002ee7cfb 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      David Elliott
 // Modified by:
 // Created:     2002/12/09
-// RCS-ID:      $Id
+// RCS-ID:      $Id$
 // Copyright:   (c) 2002 David Elliott
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -24,27 +24,6 @@ WX_DECLARE_OBJC_HASHMAP(NSMenu);
 class wxCocoaNSMenu
 {
     WX_DECLARE_OBJC_INTERFACE(NSMenu)
-// ------------------------------------------------------------------------
-// initialization
-// ------------------------------------------------------------------------
-public:
-    inline wxCocoaNSMenu()
-    {
-        m_cocoaNSMenu = NULL;
-    }
-    ~wxCocoaNSMenu();
-// ------------------------------------------------------------------------
-// Cocoa specifics
-// ------------------------------------------------------------------------
-public:
-    bool CocoaCreate(const wxString &title);
-    inline WX_NSMenu GetNSMenu() { return m_cocoaNSMenu; }
-protected:
-    WX_NSMenu m_cocoaNSMenu;
-// ------------------------------------------------------------------------
-// Implementation
-// ------------------------------------------------------------------------
-protected:
 };
 
 #endif // _WX_COCOA_NSMENU_H_
index 814599dea01d756fc515ff963fe17dbda8d6a090..8a75b3868716122e7a9dd8471e185bc5fc365383 100644 (file)
@@ -34,6 +34,16 @@ public:
 
     virtual ~wxMenu();
 
+// ------------------------------------------------------------------------
+// Cocoa specifics
+// ------------------------------------------------------------------------
+public:
+    inline WX_NSMenu GetNSMenu() { return m_cocoaNSMenu; }
+protected:
+    WX_NSMenu m_cocoaNSMenu;
+// ------------------------------------------------------------------------
+// Implementation
+// ------------------------------------------------------------------------
 protected:
     // implement base class virtuals
     virtual bool DoAppend(wxMenuItem *item);
@@ -66,6 +76,17 @@ public:
     bool Create(long style = 0);
     virtual ~wxMenuBar();
 
+// ------------------------------------------------------------------------
+// Cocoa specifics
+// ------------------------------------------------------------------------
+public:
+    inline WX_NSMenu GetNSMenu() { return m_cocoaNSMenu; }
+protected:
+    WX_NSMenu m_cocoaNSMenu;
+// ------------------------------------------------------------------------
+// Implementation
+// ------------------------------------------------------------------------
+public:
     wxMenuItemList m_items;             // the list of menu items
 
     // implement base class virtuals
index 45089152892c8aba695823dedc6af1dc8daca814..bbf68e96d58065f6832891e83ede6ea62fa495cd 100644 (file)
@@ -4,37 +4,21 @@
 // Author:      David Elliott
 // Modified by:
 // Created:     2002/12/09
-// RCS-ID:      $Id
+// RCS-ID:      $Id$
 // Copyright:   (c) 2002 David Elliott
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
 #include "wx/wxprec.h"
+#if wxUSE_MENUS
 #ifndef WX_PRECOMP
     #include "wx/log.h"
 #endif // WX_PRECOMP
 
 #include "wx/cocoa/NSMenu.h"
-#include "wx/cocoa/ObjcPose.h"
-#include "wx/cocoa/autorelease.h"
-
-#import <Foundation/NSString.h>
-#import <AppKit/NSMenu.h>
-
-#if wxUSE_MENUS
-
-// ----------------------------------------------------------------------------
-// globals
-// ----------------------------------------------------------------------------
+//#include "wx/cocoa/ObjcPose.h"
 
+#if 0 // There is no reason to pose for NSMenu at this time.
 // ============================================================================
 // @class wxPoserNSMenu
 // ============================================================================
@@ -48,21 +32,6 @@ WX_IMPLEMENT_POSER(wxPoserNSMenu);
 @implementation wxPoserNSMenu : NSMenu
 
 @end // wxPoserNSMenu
-
-// ============================================================================
-// wxCocoaNSMenu implementation
-// ============================================================================
-bool wxCocoaNSMenu::CocoaCreate(const wxString &title)
-{
-    wxAutoNSAutoreleasePool pool;
-    wxLogDebug("CocoaCreate: "+title);
-    m_cocoaNSMenu = [[NSMenu alloc] initWithTitle: [NSString stringWithCString: title.c_str()]];
-    return true;
-}
-
-wxCocoaNSMenu::~wxCocoaNSMenu()
-{
-    [m_cocoaNSMenu release];
-}
+#endif // 0
 
 #endif // wxUSE_MENUS
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 )