// Author: David Elliott
// Modified by:
// Created: 2002/12/09
-// RCS-ID: $Id:
+// RCS-ID: $Id$
// Copyright: (c) 2002 David Elliott
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
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_
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);
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
// 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
// ============================================================================
@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
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)
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:@""];
wxMenuBar::~wxMenuBar()
{
+ [m_cocoaNSMenu release];
}
bool wxMenuBar::Append( wxMenu *menu, const wxString &title )