* Move m_cocoaNSMenu out of wxCocoaNSMenu and into wxMenu and wxMenuBar
* 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
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
// Author: David Elliott
|
// Author: David Elliott
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 2002/12/09
|
// Created: 2002/12/09
|
||||||
// RCS-ID: $Id:
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2002 David Elliott
|
// Copyright: (c) 2002 David Elliott
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -24,27 +24,6 @@ WX_DECLARE_OBJC_HASHMAP(NSMenu);
|
|||||||
class wxCocoaNSMenu
|
class wxCocoaNSMenu
|
||||||
{
|
{
|
||||||
WX_DECLARE_OBJC_INTERFACE(NSMenu)
|
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_
|
#endif // _WX_COCOA_NSMENU_H_
|
||||||
|
@@ -34,6 +34,16 @@ public:
|
|||||||
|
|
||||||
virtual ~wxMenu();
|
virtual ~wxMenu();
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// Cocoa specifics
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
inline WX_NSMenu GetNSMenu() { return m_cocoaNSMenu; }
|
||||||
|
protected:
|
||||||
|
WX_NSMenu m_cocoaNSMenu;
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// Implementation
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
protected:
|
protected:
|
||||||
// implement base class virtuals
|
// implement base class virtuals
|
||||||
virtual bool DoAppend(wxMenuItem *item);
|
virtual bool DoAppend(wxMenuItem *item);
|
||||||
@@ -66,6 +76,17 @@ public:
|
|||||||
bool Create(long style = 0);
|
bool Create(long style = 0);
|
||||||
virtual ~wxMenuBar();
|
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
|
wxMenuItemList m_items; // the list of menu items
|
||||||
|
|
||||||
// implement base class virtuals
|
// implement base class virtuals
|
||||||
|
@@ -4,37 +4,21 @@
|
|||||||
// Author: David Elliott
|
// Author: David Elliott
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 2002/12/09
|
// Created: 2002/12/09
|
||||||
// RCS-ID: $Id:
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2002 David Elliott
|
// Copyright: (c) 2002 David Elliott
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// declarations
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// headers
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
#if wxUSE_MENUS
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/cocoa/NSMenu.h"
|
#include "wx/cocoa/NSMenu.h"
|
||||||
#include "wx/cocoa/ObjcPose.h"
|
//#include "wx/cocoa/ObjcPose.h"
|
||||||
#include "wx/cocoa/autorelease.h"
|
|
||||||
|
|
||||||
#import <Foundation/NSString.h>
|
|
||||||
#import <AppKit/NSMenu.h>
|
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// globals
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
#if 0 // There is no reason to pose for NSMenu at this time.
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// @class wxPoserNSMenu
|
// @class wxPoserNSMenu
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -48,21 +32,6 @@ WX_IMPLEMENT_POSER(wxPoserNSMenu);
|
|||||||
@implementation wxPoserNSMenu : NSMenu
|
@implementation wxPoserNSMenu : NSMenu
|
||||||
|
|
||||||
@end // wxPoserNSMenu
|
@end // wxPoserNSMenu
|
||||||
|
#endif // 0
|
||||||
// ============================================================================
|
|
||||||
// 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 // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
|
@@ -42,15 +42,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
|
|||||||
|
|
||||||
bool wxMenu::Create(const wxString& title, long style)
|
bool wxMenu::Create(const wxString& title, long style)
|
||||||
{
|
{
|
||||||
#if 0
|
wxAutoNSAutoreleasePool pool;
|
||||||
if(!title)
|
m_cocoaNSMenu = [[NSMenu alloc] initWithTitle: [NSString stringWithCString: title.c_str()]];
|
||||||
return CocoaCreate("wxMenu");
|
return true;
|
||||||
#endif
|
|
||||||
return CocoaCreate(title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenu::~wxMenu()
|
wxMenu::~wxMenu()
|
||||||
{
|
{
|
||||||
|
[m_cocoaNSMenu release];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMenu::DoAppend(wxMenuItem *item)
|
bool wxMenu::DoAppend(wxMenuItem *item)
|
||||||
@@ -87,8 +86,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow)
|
|||||||
|
|
||||||
bool wxMenuBar::Create(long style)
|
bool wxMenuBar::Create(long style)
|
||||||
{
|
{
|
||||||
if(!CocoaCreate("wxMenuBar"))
|
wxAutoNSAutoreleasePool pool;
|
||||||
return false;
|
m_cocoaNSMenu = [[NSMenu alloc] initWithTitle: @"wxMenuBar"];
|
||||||
|
|
||||||
NSMenuItem *dummyItem = [[NSMenuItem alloc] initWithTitle:@"App menu"
|
NSMenuItem *dummyItem = [[NSMenuItem alloc] initWithTitle:@"App menu"
|
||||||
/* Note: title gets clobbered by app name anyway */
|
/* Note: title gets clobbered by app name anyway */
|
||||||
action:nil keyEquivalent:@""];
|
action:nil keyEquivalent:@""];
|
||||||
@@ -99,6 +99,7 @@ bool wxMenuBar::Create(long style)
|
|||||||
|
|
||||||
wxMenuBar::~wxMenuBar()
|
wxMenuBar::~wxMenuBar()
|
||||||
{
|
{
|
||||||
|
[m_cocoaNSMenu release];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMenuBar::Append( wxMenu *menu, const wxString &title )
|
bool wxMenuBar::Append( wxMenu *menu, const wxString &title )
|
||||||
|
Reference in New Issue
Block a user