Add support for uniquifying to all wxCocoa Objective-C classes.
Patch from Mark Taylor. Copyright 2007 Software 2000 Ltd. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
#ifndef __WX_COCOA_NSTABLEDATASOURCE_H__
|
#ifndef __WX_COCOA_NSTABLEDATASOURCE_H__
|
||||||
#define __WX_COCOA_NSTABLEDATASOURCE_H__
|
#define __WX_COCOA_NSTABLEDATASOURCE_H__
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#import <Foundation/NSObject.h>
|
#import <Foundation/NSObject.h>
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -28,5 +30,6 @@
|
|||||||
objectValueForTableColumn: (NSTableColumn *)tableColumn
|
objectValueForTableColumn: (NSTableColumn *)tableColumn
|
||||||
row: (int)rowIndex;
|
row: (int)rowIndex;
|
||||||
@end // wxCocoaNSTableDataSource
|
@end // wxCocoaNSTableDataSource
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxCocoaNSTableDataSource,NSObject)
|
||||||
|
|
||||||
#endif // _WX_COCOA_NSTABLEDATASOURCE_H_
|
#endif // _WX_COCOA_NSTABLEDATASOURCE_H_
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
#ifndef __WX_COCOA_OBJC_NSMENU_H__
|
#ifndef __WX_COCOA_OBJC_NSMENU_H__
|
||||||
#define __WX_COCOA_OBJC_NSMENU_H__
|
#define __WX_COCOA_OBJC_NSMENU_H__
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#import <AppKit/NSMenu.h>
|
#import <AppKit/NSMenu.h>
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -24,5 +26,6 @@
|
|||||||
- (void)dealloc;
|
- (void)dealloc;
|
||||||
|
|
||||||
@end // WXNSMenu
|
@end // WXNSMenu
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(WXNSMenu,NSMenu)
|
||||||
|
|
||||||
#endif //ndef __WX_COCOA_OBJC_NSMENU_H__
|
#endif //ndef __WX_COCOA_OBJC_NSMENU_H__
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end // WXNSMenu
|
@end // WXNSMenu
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(WXNSMenu,NSMenu)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// @class wxNSMenuNotificationObserver
|
// @class wxNSMenuNotificationObserver
|
||||||
@@ -43,14 +44,13 @@
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
struct objc_object *wxCocoaNSMenu::sm_cocoaObserver = [[wxNSMenuNotificationObserver alloc] init];
|
|
||||||
|
|
||||||
- (void)menuDidAddItem: (NSNotification *)notification;
|
- (void)menuDidAddItem: (NSNotification *)notification;
|
||||||
- (void)menuDidChangeItem: (NSNotification *)notification;
|
- (void)menuDidChangeItem: (NSNotification *)notification;
|
||||||
- (void)menuDidRemoveItem: (NSNotification *)notification;
|
- (void)menuDidRemoveItem: (NSNotification *)notification;
|
||||||
- (void)menuDidSendAction: (NSNotification *)notification;
|
- (void)menuDidSendAction: (NSNotification *)notification;
|
||||||
- (void)menuWillSendAction: (NSNotification *)notification;
|
- (void)menuWillSendAction: (NSNotification *)notification;
|
||||||
@end // interface wxNSMenuNotificationObserver
|
@end // interface wxNSMenuNotificationObserver
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxNSMenuNotificationObserver,NSObject)
|
||||||
|
|
||||||
@implementation wxNSMenuNotificationObserver : NSObject
|
@implementation wxNSMenuNotificationObserver : NSObject
|
||||||
|
|
||||||
@@ -90,12 +90,15 @@ struct objc_object *wxCocoaNSMenu::sm_cocoaObserver = [[wxNSMenuNotificationObse
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end // implementation wxNSMenuNotificationObserver
|
@end // implementation wxNSMenuNotificationObserver
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSMenuNotificationObserver,NSObject)
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// wxCocoaNSMenu
|
// wxCocoaNSMenu
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSMenu)
|
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSMenu)
|
||||||
|
|
||||||
|
struct objc_object *wxCocoaNSMenu::sm_cocoaObserver = [[WX_GET_OBJC_CLASS(wxNSMenuNotificationObserver) alloc] init];
|
||||||
|
|
||||||
void wxCocoaNSMenu::AssociateNSMenu(WX_NSMenu cocoaNSMenu, unsigned int flags)
|
void wxCocoaNSMenu::AssociateNSMenu(WX_NSMenu cocoaNSMenu, unsigned int flags)
|
||||||
{
|
{
|
||||||
if(cocoaNSMenu)
|
if(cocoaNSMenu)
|
||||||
|
@@ -14,6 +14,8 @@
|
|||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#include "wx/cocoa/NSScroller.h"
|
#include "wx/cocoa/NSScroller.h"
|
||||||
#import <AppKit/NSScroller.h>
|
#import <AppKit/NSScroller.h>
|
||||||
|
|
||||||
@@ -28,6 +30,7 @@ WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSScroller)
|
|||||||
|
|
||||||
- (void)wxNSScrollerAction: (id)sender;
|
- (void)wxNSScrollerAction: (id)sender;
|
||||||
@end // wxNSScrollerTarget
|
@end // wxNSScrollerTarget
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxNSScrollerTarget,NSObject)
|
||||||
|
|
||||||
@implementation wxNSScrollerTarget : NSObject
|
@implementation wxNSScrollerTarget : NSObject
|
||||||
- (void)wxNSScrollerAction: (id)sender
|
- (void)wxNSScrollerAction: (id)sender
|
||||||
@@ -38,11 +41,12 @@ WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSScroller)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end // implementation wxNSScrollerTarget
|
@end // implementation wxNSScrollerTarget
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSScrollerTarget,NSObject)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// class wxCocoaNSScroller
|
// class wxCocoaNSScroller
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
const wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSScroller::sm_cocoaTarget = [[wxNSScrollerTarget alloc] init];
|
const wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSScroller::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSScrollerTarget) alloc] init];
|
||||||
|
|
||||||
void wxCocoaNSScroller::AssociateNSScroller(WX_NSScroller cocoaNSScroller)
|
void wxCocoaNSScroller::AssociateNSScroller(WX_NSScroller cocoaNSScroller)
|
||||||
{
|
{
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "wx/cocoa/NSTabView.h"
|
#include "wx/cocoa/NSTabView.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#include <AppKit/NSTabView.h>
|
#include <AppKit/NSTabView.h>
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -27,6 +29,7 @@
|
|||||||
- (void)tabView:(NSTabView*)tabView didSelectTabViewItem:(NSTabViewItem*)tabViewItem;
|
- (void)tabView:(NSTabView*)tabView didSelectTabViewItem:(NSTabViewItem*)tabViewItem;
|
||||||
- (BOOL)tabView:(NSTabView*)tabView shouldSelectTabViewItem:(NSTabViewItem*)tabViewItem;
|
- (BOOL)tabView:(NSTabView*)tabView shouldSelectTabViewItem:(NSTabViewItem*)tabViewItem;
|
||||||
@end // interface wxNSTabViewDelegate : NSObject
|
@end // interface wxNSTabViewDelegate : NSObject
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxNSTabViewDelegate,NSObject)
|
||||||
|
|
||||||
@implementation wxNSTabViewDelegate : NSObject
|
@implementation wxNSTabViewDelegate : NSObject
|
||||||
- (void)tabView:(NSTabView*)tabView didSelectTabViewItem:(NSTabViewItem*)tabViewItem
|
- (void)tabView:(NSTabView*)tabView didSelectTabViewItem:(NSTabViewItem*)tabViewItem
|
||||||
@@ -45,13 +48,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end // implementation wxNSTabViewDelegate : NSObject
|
@end // implementation wxNSTabViewDelegate : NSObject
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSTabViewDelegate,NSObject)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// class wxCocoaNSTabView
|
// class wxCocoaNSTabView
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSTabView)
|
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSTabView)
|
||||||
|
|
||||||
wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSTabView::sm_cocoaDelegate = [[wxNSTabViewDelegate alloc] init];
|
wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSTabView::sm_cocoaDelegate = [[WX_GET_OBJC_CLASS(wxNSTabViewDelegate) alloc] init];
|
||||||
|
|
||||||
void wxCocoaNSTabView::AssociateNSTabView(WX_NSTabView cocoaNSTabView)
|
void wxCocoaNSTabView::AssociateNSTabView(WX_NSTabView cocoaNSTabView)
|
||||||
{
|
{
|
||||||
|
@@ -53,4 +53,5 @@ WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSTableView)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end // implementation wxCocoaNSTableDataSource
|
@end // implementation wxCocoaNSTableDataSource
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxCocoaNSTableDataSource,NSObject)
|
||||||
|
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include "wx/cocoa/NSWindow.h"
|
#include "wx/cocoa/NSWindow.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#import <Foundation/NSNotification.h>
|
#import <Foundation/NSNotification.h>
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
#include "wx/cocoa/objc/NSWindow.h"
|
#include "wx/cocoa/objc/NSWindow.h"
|
||||||
@@ -53,6 +55,7 @@
|
|||||||
- (void)wxMenuItemAction: (NSMenuItem *)menuItem;
|
- (void)wxMenuItemAction: (NSMenuItem *)menuItem;
|
||||||
- (BOOL)validateMenuItem: (NSMenuItem *)menuItem;
|
- (BOOL)validateMenuItem: (NSMenuItem *)menuItem;
|
||||||
@end //interface wxNSWindowDelegate
|
@end //interface wxNSWindowDelegate
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxNSWindowDelegate,NSObject)
|
||||||
|
|
||||||
@implementation wxNSWindowDelegate : NSObject
|
@implementation wxNSWindowDelegate : NSObject
|
||||||
|
|
||||||
@@ -141,6 +144,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end //implementation wxNSWindowDelegate
|
@end //implementation wxNSWindowDelegate
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSWindowDelegate,NSObject)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// class wxCocoaNSWindow
|
// class wxCocoaNSWindow
|
||||||
@@ -151,7 +155,7 @@ WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSWindow)
|
|||||||
wxCocoaNSWindow::wxCocoaNSWindow(wxTopLevelWindowCocoa *tlw)
|
wxCocoaNSWindow::wxCocoaNSWindow(wxTopLevelWindowCocoa *tlw)
|
||||||
: m_wxTopLevelWindowCocoa(tlw)
|
: m_wxTopLevelWindowCocoa(tlw)
|
||||||
{
|
{
|
||||||
m_cocoaDelegate = [[wxNSWindowDelegate alloc] init];
|
m_cocoaDelegate = [[WX_GET_OBJC_CLASS(wxNSWindowDelegate) alloc] init];
|
||||||
[m_cocoaDelegate setWxCocoaInterface: this];
|
[m_cocoaDelegate setWxCocoaInterface: this];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -80,6 +80,8 @@
|
|||||||
|
|
||||||
#include "wx/combobox.h"
|
#include "wx/combobox.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/window.h"
|
#include "wx/window.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
@@ -132,6 +134,7 @@ void wxCocoaNSComboBox::DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox)
|
|||||||
- (void)comboBoxWillDismiss:(NSNotification *)notification;
|
- (void)comboBoxWillDismiss:(NSNotification *)notification;
|
||||||
- (void)comboBoxWillPopUp:(NSNotification *)notification;
|
- (void)comboBoxWillPopUp:(NSNotification *)notification;
|
||||||
@end // wxPoserNSComboBox
|
@end // wxPoserNSComboBox
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxPoserNSComboBox,NSComboBox)
|
||||||
|
|
||||||
//WX_IMPLEMENT_POSER(wxPoserNSComboBox);
|
//WX_IMPLEMENT_POSER(wxPoserNSComboBox);
|
||||||
@implementation wxPoserNSComboBox : NSComboBox
|
@implementation wxPoserNSComboBox : NSComboBox
|
||||||
@@ -158,6 +161,7 @@ void wxCocoaNSComboBox::DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end // implementation wxPoserNSComboBox
|
@end // implementation wxPoserNSComboBox
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxPoserNSComboBox,NSComboBox)
|
||||||
|
|
||||||
#include "wx/cocoa/autorelease.h"
|
#include "wx/cocoa/autorelease.h"
|
||||||
#include "wx/cocoa/string.h"
|
#include "wx/cocoa/string.h"
|
||||||
@@ -198,7 +202,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID winid,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_cocoaNSView = NULL;
|
m_cocoaNSView = NULL;
|
||||||
SetNSComboBox([[wxPoserNSComboBox alloc] initWithFrame:MakeDefaultNSRect(size)]);
|
SetNSComboBox([[WX_GET_OBJC_CLASS(wxPoserNSComboBox) alloc] initWithFrame:MakeDefaultNSRect(size)]);
|
||||||
[m_cocoaNSView release];
|
[m_cocoaNSView release];
|
||||||
[GetNSTextField() setStringValue:wxNSStringWithWxString(value.c_str())];
|
[GetNSTextField() setStringValue:wxNSStringWithWxString(value.c_str())];
|
||||||
[GetNSControl() sizeToFit];
|
[GetNSControl() sizeToFit];
|
||||||
|
@@ -98,7 +98,7 @@ The listbox contents are sorted in alphabetical order.
|
|||||||
[GetNSTableView() setHeaderView: nil];
|
[GetNSTableView() setHeaderView: nil];
|
||||||
|
|
||||||
// Set up the data source
|
// Set up the data source
|
||||||
m_cocoaDataSource = [[wxCocoaNSTableDataSource alloc] init];
|
m_cocoaDataSource = [[WX_GET_OBJC_CLASS(wxCocoaNSTableDataSource) alloc] init];
|
||||||
[GetNSTableView() setDataSource:m_cocoaDataSource];
|
[GetNSTableView() setDataSource:m_cocoaDataSource];
|
||||||
|
|
||||||
// Add the single column
|
// Add the single column
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "wx/cocoa/mbarman.h"
|
#include "wx/cocoa/mbarman.h"
|
||||||
#include "wx/cocoa/autorelease.h"
|
#include "wx/cocoa/autorelease.h"
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
#import <Foundation/NSNotification.h>
|
#import <Foundation/NSNotification.h>
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
- (void)windowWillClose: (NSNotification *)notification;
|
- (void)windowWillClose: (NSNotification *)notification;
|
||||||
#endif // 0
|
#endif // 0
|
||||||
@end // interface wxMenuBarManagerObserver : NSObject
|
@end // interface wxMenuBarManagerObserver : NSObject
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxMenuBarManagerObserver,NSObject)
|
||||||
|
|
||||||
@implementation wxMenuBarManagerObserver : NSObject
|
@implementation wxMenuBarManagerObserver : NSObject
|
||||||
- (id)init
|
- (id)init
|
||||||
@@ -100,6 +102,7 @@
|
|||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
@end // implementation wxMenuBarManagerObserver : NSObject
|
@end // implementation wxMenuBarManagerObserver : NSObject
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxMenuBarManagerObserver,NSObject)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxMenuBarManager
|
// wxMenuBarManager
|
||||||
@@ -108,7 +111,7 @@ wxMenuBarManager *wxMenuBarManager::sm_mbarmanInstance = NULL;
|
|||||||
|
|
||||||
wxMenuBarManager::wxMenuBarManager()
|
wxMenuBarManager::wxMenuBarManager()
|
||||||
{
|
{
|
||||||
m_observer = [[wxMenuBarManagerObserver alloc]
|
m_observer = [[WX_GET_OBJC_CLASS(wxMenuBarManagerObserver) alloc]
|
||||||
initWithWxMenuBarManager:this];
|
initWithWxMenuBarManager:this];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:m_observer
|
[[NSNotificationCenter defaultCenter] addObserver:m_observer
|
||||||
selector:@selector(windowDidBecomeKey:)
|
selector:@selector(windowDidBecomeKey:)
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
@@ -44,6 +46,7 @@ WX_DECLARE_HASH_MAP(int, wxMDIChildFrame*, wxIntegerHash, wxIntegerEqual, wxIntM
|
|||||||
- (id)initWithWxMDIParentFrame: (wxMDIParentFrame *)mdiParent;
|
- (id)initWithWxMDIParentFrame: (wxMDIParentFrame *)mdiParent;
|
||||||
- (void)windowDidBecomeMain: (NSNotification *)notification;
|
- (void)windowDidBecomeMain: (NSNotification *)notification;
|
||||||
@end // interface wxMDIParentFrameObserver : NSObject
|
@end // interface wxMDIParentFrameObserver : NSObject
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxMDIParentFrameObserver,NSObject)
|
||||||
|
|
||||||
@implementation wxMDIParentFrameObserver : NSObject
|
@implementation wxMDIParentFrameObserver : NSObject
|
||||||
- (id)init
|
- (id)init
|
||||||
@@ -67,6 +70,7 @@ WX_DECLARE_HASH_MAP(int, wxMDIChildFrame*, wxIntegerHash, wxIntegerEqual, wxIntM
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end // implementation wxMDIParentFrameObserver : NSObject
|
@end // implementation wxMDIParentFrameObserver : NSObject
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxMDIParentFrameObserver,NSObject)
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// wxMDIParentFrame
|
// wxMDIParentFrame
|
||||||
@@ -79,7 +83,7 @@ void wxMDIParentFrame::Init()
|
|||||||
{
|
{
|
||||||
m_clientWindow = NULL;
|
m_clientWindow = NULL;
|
||||||
m_currentChild = NULL;
|
m_currentChild = NULL;
|
||||||
m_observer = [[wxMDIParentFrameObserver alloc]
|
m_observer = [[WX_GET_OBJC_CLASS(wxMDIParentFrameObserver) alloc]
|
||||||
initWithWxMDIParentFrame:this];
|
initWithWxMDIParentFrame:this];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:m_observer
|
[[NSNotificationCenter defaultCenter] addObserver:m_observer
|
||||||
selector:@selector(windowDidBecomeMain:)
|
selector:@selector(windowDidBecomeMain:)
|
||||||
|
@@ -46,7 +46,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
|
|||||||
bool wxMenu::Create(const wxString& title, long style)
|
bool wxMenu::Create(const wxString& title, long style)
|
||||||
{
|
{
|
||||||
wxAutoNSAutoreleasePool pool;
|
wxAutoNSAutoreleasePool pool;
|
||||||
m_cocoaNSMenu = [[WXNSMenu alloc] initWithTitle: wxNSStringWithWxString(title)];
|
m_cocoaNSMenu = [[WX_GET_OBJC_CLASS(WXNSMenu) alloc] initWithTitle: wxNSStringWithWxString(title)];
|
||||||
AssociateNSMenu(m_cocoaNSMenu);
|
AssociateNSMenu(m_cocoaNSMenu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
@@ -53,6 +55,7 @@
|
|||||||
- (void)wxMenuItemAction: (id)sender;
|
- (void)wxMenuItemAction: (id)sender;
|
||||||
- (BOOL)validateMenuItem: (id)menuItem;
|
- (BOOL)validateMenuItem: (id)menuItem;
|
||||||
@end //interface wxNSMenuItemTarget
|
@end //interface wxNSMenuItemTarget
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxNSMenuItemTarget,NSObject)
|
||||||
|
|
||||||
@implementation wxNSMenuItemTarget : NSObject
|
@implementation wxNSMenuItemTarget : NSObject
|
||||||
|
|
||||||
@@ -74,6 +77,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end //implementation wxNSMenuItemTarget
|
@end //implementation wxNSMenuItemTarget
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSMenuItemTarget,NSObject)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxMenuItemCocoa implementation
|
// wxMenuItemCocoa implementation
|
||||||
@@ -81,7 +85,7 @@
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
|
||||||
wxMenuItemCocoaHash wxMenuItemCocoa::sm_cocoaHash;
|
wxMenuItemCocoaHash wxMenuItemCocoa::sm_cocoaHash;
|
||||||
|
|
||||||
wxObjcAutoRefFromAlloc<struct objc_object *> wxMenuItemCocoa::sm_cocoaTarget = [[wxNSMenuItemTarget alloc] init];
|
wxObjcAutoRefFromAlloc<struct objc_object *> wxMenuItemCocoa::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSMenuItemTarget) alloc] init];
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxMenuItemBase
|
// wxMenuItemBase
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "wx/cocoa/autorelease.h"
|
#include "wx/cocoa/autorelease.h"
|
||||||
#include "wx/cocoa/string.h"
|
#include "wx/cocoa/string.h"
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#import <AppKit/NSTabView.h>
|
#import <AppKit/NSTabView.h>
|
||||||
#import <AppKit/NSTabViewItem.h>
|
#import <AppKit/NSTabViewItem.h>
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
- (NSImage*)image;
|
- (NSImage*)image;
|
||||||
- (void)setImage:(NSImage*)image;
|
- (void)setImage:(NSImage*)image;
|
||||||
@end // interface WXCTabViewImageItem : NSTabViewItem
|
@end // interface WXCTabViewImageItem : NSTabViewItem
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(WXCTabViewImageItem,NSTabViewItem)
|
||||||
|
|
||||||
@implementation WXCTabViewImageItem : NSTabViewItem
|
@implementation WXCTabViewImageItem : NSTabViewItem
|
||||||
- (id)init
|
- (id)init
|
||||||
@@ -120,6 +122,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end // implementation WXCTabViewImageItem : NSTabViewItem
|
@end // implementation WXCTabViewImageItem : NSTabViewItem
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(WXCTabViewImageItem,NSTabViewItem)
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// wxNotebookEvent
|
// wxNotebookEvent
|
||||||
@@ -218,7 +221,7 @@ bool wxNotebook::InsertPage( size_t pos,
|
|||||||
{
|
{
|
||||||
wxAutoNSAutoreleasePool pool;
|
wxAutoNSAutoreleasePool pool;
|
||||||
m_pages.Insert(page,pos);
|
m_pages.Insert(page,pos);
|
||||||
NSTabViewItem *tvitem = [[WXCTabViewImageItem alloc] initWithIdentifier:nil];
|
NSTabViewItem *tvitem = [[WX_GET_OBJC_CLASS(WXCTabViewImageItem) alloc] initWithIdentifier:nil];
|
||||||
[tvitem setLabel: wxNSStringWithWxString(title)];
|
[tvitem setLabel: wxNSStringWithWxString(title)];
|
||||||
const wxBitmap *bmp = (imageId!=-1)?m_imageList->GetBitmapPtr(imageId):NULL;
|
const wxBitmap *bmp = (imageId!=-1)?m_imageList->GetBitmapPtr(imageId):NULL;
|
||||||
if(bmp)
|
if(bmp)
|
||||||
|
@@ -23,6 +23,8 @@
|
|||||||
#include "wx/cocoa/string.h"
|
#include "wx/cocoa/string.h"
|
||||||
#include "wx/cocoa/log.h"
|
#include "wx/cocoa/log.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#import <AppKit/NSSound.h>
|
#import <AppKit/NSSound.h>
|
||||||
#import <Foundation/NSData.h>
|
#import <Foundation/NSData.h>
|
||||||
|
|
||||||
@@ -39,6 +41,7 @@ static bool s_loopCurrentSound = false;
|
|||||||
// Delegate methods
|
// Delegate methods
|
||||||
- (void)sound:(NSSound *)theSound didFinishPlaying:(BOOL)finishedPlaying;
|
- (void)sound:(NSSound *)theSound didFinishPlaying:(BOOL)finishedPlaying;
|
||||||
@end // interface wxNSSoundDelegate : NSObject
|
@end // interface wxNSSoundDelegate : NSObject
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxNSSoundDelegate,NSObject)
|
||||||
|
|
||||||
@implementation wxNSSoundDelegate : NSObject
|
@implementation wxNSSoundDelegate : NSObject
|
||||||
|
|
||||||
@@ -66,8 +69,9 @@ static bool s_loopCurrentSound = false;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end // wxNSSoundDelegate
|
@end // wxNSSoundDelegate
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSSoundDelegate,NSObject)
|
||||||
|
|
||||||
const wxObjcAutoRefFromAlloc<struct objc_object*> wxSound::sm_cocoaDelegate = [[wxNSSoundDelegate alloc] init];
|
const wxObjcAutoRefFromAlloc<struct objc_object*> wxSound::sm_cocoaDelegate = [[WX_GET_OBJC_CLASS(wxNSSoundDelegate) alloc] init];
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// wxSound
|
// wxSound
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
#include "wx/cocoa/private/timer.h"
|
#include "wx/cocoa/private/timer.h"
|
||||||
#include "wx/cocoa/autorelease.h"
|
#include "wx/cocoa/autorelease.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#import <Foundation/NSTimer.h>
|
#import <Foundation/NSTimer.h>
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
@@ -40,6 +42,7 @@
|
|||||||
- (wxCocoaTimerImpl*)timer;
|
- (wxCocoaTimerImpl*)timer;
|
||||||
- (void)onNotify:(NSTimer *)theTimer;
|
- (void)onNotify:(NSTimer *)theTimer;
|
||||||
@end // interface wxNSTimerData : NSObject
|
@end // interface wxNSTimerData : NSObject
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxNSTimerData,NSObject)
|
||||||
|
|
||||||
@implementation wxNSTimerData : NSObject
|
@implementation wxNSTimerData : NSObject
|
||||||
- (id)init
|
- (id)init
|
||||||
@@ -68,6 +71,7 @@
|
|||||||
m_timer->Notify();
|
m_timer->Notify();
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSTimerData,NSObject)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxCocoaTimerImpl
|
// wxCocoaTimerImpl
|
||||||
@@ -89,7 +93,7 @@ bool wxCocoaTimerImpl::Start(int millisecs, bool oneShot)
|
|||||||
|
|
||||||
wxAutoNSAutoreleasePool thePool;
|
wxAutoNSAutoreleasePool thePool;
|
||||||
|
|
||||||
wxNSTimerData *timerData = [[wxNSTimerData alloc] initWithWxTimer:this];
|
wxNSTimerData *timerData = [[WX_GET_OBJC_CLASS(wxNSTimerData) alloc] initWithWxTimer:this];
|
||||||
m_cocoaNSTimer = [[NSTimer
|
m_cocoaNSTimer = [[NSTimer
|
||||||
scheduledTimerWithTimeInterval: millisecs / 1000.0 //seconds
|
scheduledTimerWithTimeInterval: millisecs / 1000.0 //seconds
|
||||||
target: timerData
|
target: timerData
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include "wx/cocoa/string.h"
|
#include "wx/cocoa/string.h"
|
||||||
|
|
||||||
|
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <AppKit/NSWorkspace.h>
|
#import <AppKit/NSWorkspace.h>
|
||||||
|
|
||||||
@@ -104,6 +106,7 @@ protected:
|
|||||||
-(id)init:(void*)handle processIdentifier:(long)pid;
|
-(id)init:(void*)handle processIdentifier:(long)pid;
|
||||||
- (void)termHandler:(NSNotification *)aNotification;
|
- (void)termHandler:(NSNotification *)aNotification;
|
||||||
@end
|
@end
|
||||||
|
WX_DECLARE_GET_OBJC_CLASS(wxTaskHandler,NSObject)
|
||||||
|
|
||||||
@implementation wxTaskHandler : NSObject
|
@implementation wxTaskHandler : NSObject
|
||||||
|
|
||||||
@@ -135,6 +138,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
WX_IMPLEMENT_GET_OBJC_CLASS(wxTaskHandler,NSObject)
|
||||||
|
|
||||||
long wxExecute(const wxString& command,
|
long wxExecute(const wxString& command,
|
||||||
int sync,
|
int sync,
|
||||||
@@ -179,7 +183,7 @@ long wxExecute(const wxString& command,
|
|||||||
|
|
||||||
if(sync & wxEXEC_ASYNC)
|
if(sync & wxEXEC_ASYNC)
|
||||||
{
|
{
|
||||||
[[wxTaskHandler alloc]init:handle
|
[[WX_GET_OBJC_CLASS(wxTaskHandler) alloc]init:handle
|
||||||
processIdentifier:[theTask processIdentifier]];
|
processIdentifier:[theTask processIdentifier]];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user