#ifndef _WX_COCOA_NSAPPLICATION_H__
#define _WX_COCOA_NSAPPLICATION_H__
+#include "wx/cocoa/objc/objc_uniquifying.h"
+
// ========================================================================
// wxNSApplicationDelegate
// ========================================================================
// Delegate methods
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication;
@end // interface wxNSApplicationDelegate : NSObject
+WX_DECLARE_GET_OBJC_CLASS(wxNSApplicationDelegate,NSObject)
// ========================================================================
// wxNSApplicationObserver
// Other notifications
- (void)controlTintChanged:(NSNotification *)notification;
@end // interface wxNSApplicationObserver : NSObject
+WX_DECLARE_GET_OBJC_CLASS(wxNSApplicationObserver,NSObject)
#endif //ndef _WX_COCOA_NSAPPLICATION_H__
#ifndef __WX_COCOA_OBJC_NSVIEW_H__
#define __WX_COCOA_OBJC_NSVIEW_H__
+#include "wx/cocoa/objc/objc_uniquifying.h"
+
#import <AppKit/NSView.h>
// ============================================================================
- (void)otherMouseUp:(NSEvent *)theEvent;
- (void)resetCursorRects;
@end // WXNSView
+WX_DECLARE_GET_OBJC_CLASS(WXNSView,NSView)
#endif //ndef __WX_COCOA_OBJC_NSVIEW_H__
#include "wx/log.h"
#endif // WX_PRECOMP
+#include "wx/cocoa/objc/objc_uniquifying.h"
#include "wx/cocoa/NSButton.h"
#import <AppKit/NSButton.h>
- (void)wxNSButtonAction: (id)sender;
@end // wxNSButtonTarget
+WX_DECLARE_GET_OBJC_CLASS(wxNSButtonTarget,NSObject)
@implementation wxNSButtonTarget : NSObject
- (void)wxNSButtonAction: (id)sender
}
@end // implementation wxNSButtonTarget
+WX_IMPLEMENT_GET_OBJC_CLASS(wxNSButtonTarget,NSObject)
// ============================================================================
// class wxCocoaNSButton
// ============================================================================
-const wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSButton::sm_cocoaTarget = [[wxNSButtonTarget alloc] init];
+const wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSButton::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSButtonTarget) alloc] init];
void wxCocoaNSButton::AssociateNSButton(WX_NSButton cocoaNSButton)
{
#include "wx/log.h"
#endif // WX_PRECOMP
+#include "wx/cocoa/objc/objc_uniquifying.h"
#include "wx/cocoa/NSControl.h"
#import <Foundation/NSObject.h>
- (void)wxNSControlAction: (id)sender;
@end //interface wxNSControlTarget
+WX_DECLARE_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
@implementation wxNSControlTarget : NSObject
}
@end //implementation wxNSControlTarget
+WX_IMPLEMENT_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
// ============================================================================
// wxNSControl
// ============================================================================
WX_IMPLEMENT_OBJC_INTERFACE(NSControl)
-struct objc_object *wxCocoaNSControl::sm_cocoaTarget = [[wxNSControlTarget alloc] init];
+struct objc_object *wxCocoaNSControl::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSControlTarget) alloc] init];
#include "wx/window.h"
#endif // WX_PRECOMP
+#include "wx/cocoa/objc/objc_uniquifying.h"
#include "wx/cocoa/NSView.h"
#import <Foundation/NSNotification.h>
}
@end // implementation WXNSView
+WX_IMPLEMENT_GET_OBJC_CLASS(WXNSView,NSView)
+
+// ============================================================================
+// @class wxNSViewNotificationObserver
+// ============================================================================
@interface wxNSViewNotificationObserver : NSObject
{
}
-// FIXME: Initializing like this is a really bad idea. If for some reason
-// we ever require posing as an NSObject we won't be able to since an instance
-// will have already been created here. Of course, catching messages for
-// NSObject seems like a LOT of overkill, so I doubt we ever will anyway!
-void *wxCocoaNSView::sm_cocoaObserver = [[wxNSViewNotificationObserver alloc] init];
-
- (void)notificationFrameChanged: (NSNotification *)notification;
@end // interface wxNSViewNotificationObserver
+WX_DECLARE_GET_OBJC_CLASS(wxNSViewNotificationObserver,NSObject)
@implementation wxNSViewNotificationObserver : NSObject
}
@end // implementation wxNSViewNotificationObserver
+WX_IMPLEMENT_GET_OBJC_CLASS(wxNSViewNotificationObserver,NSObject)
+
+void *wxCocoaNSView::sm_cocoaObserver = [[WX_GET_OBJC_CLASS(wxNSViewNotificationObserver) alloc] init];
bool wxApp::sm_isEmbedded = false; // Normally we're not a plugin
// wxNSApplicationObserver singleton.
-static wxObjcAutoRefFromAlloc<wxNSApplicationObserver*> sg_cocoaAppObserver = [[wxNSApplicationObserver alloc] init];
+static wxObjcAutoRefFromAlloc<wxNSApplicationObserver*> sg_cocoaAppObserver = [[WX_GET_OBJC_CLASS(wxNSApplicationObserver) alloc] init];
// ========================================================================
// wxNSApplicationDelegate
}
@end // implementation wxNSApplicationDelegate : NSObject
+WX_IMPLEMENT_GET_OBJC_CLASS(wxNSApplicationDelegate,NSObject)
// ========================================================================
// wxNSApplicationObserver
}
@end // implementation wxNSApplicationObserver : NSObject
+WX_IMPLEMENT_GET_OBJC_CLASS(wxNSApplicationObserver,NSObject)
// ========================================================================
// wxApp
if(!sm_isEmbedded)
{
// Enable response to application delegate messages
- m_cocoaAppDelegate = [[wxNSApplicationDelegate alloc] init];
+ m_cocoaAppDelegate = [[WX_GET_OBJC_CLASS(wxNSApplicationDelegate) alloc] init];
[m_cocoaApp setDelegate:m_cocoaAppDelegate];
}
#endif
#include "wx/cocoa/autorelease.h"
+#include "wx/cocoa/objc/objc_uniquifying.h"
#import <AppKit/NSControl.h>
#import <AppKit/NSCell.h>
- (void)otherMouseUp:(NSEvent *)theEvent;
- (void)resetCursorRects;
@end // wxNonControlNSControl
+WX_DECLARE_GET_OBJC_CLASS(wxNonControlNSControl,NSControl)
@implementation wxNonControlNSControl : NSControl
}
@end // wxNonControlNSControl
+WX_IMPLEMENT_GET_OBJC_CLASS(wxNonControlNSControl,NSControl)
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
BEGIN_EVENT_TABLE(wxControl, wxControlBase)
return false;
wxLogTrace(wxTRACE_COCOA,wxT("Created control with id=%d"),GetId());
m_cocoaNSView = NULL;
- SetNSControl([[wxNonControlNSControl alloc] initWithFrame: MakeDefaultNSRect(size)]);
+ SetNSControl([[WX_GET_OBJC_CLASS(wxNonControlNSControl) alloc] initWithFrame: MakeDefaultNSRect(size)]);
// NOTE: YES we want to release this (to match the alloc).
// DoAddChild(this) will retain us again since addSubView doesn't.
[m_cocoaNSView release];
{
if(!CreateControl(parent,winid,pos,size,style,validator,name))
return false;
- SetNSView([[WXNSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
+ SetNSView([[WX_GET_OBJC_CLASS(WXNSView) alloc] initWithFrame: MakeDefaultNSRect(size)]);
[m_cocoaNSView release];
if(m_parent)
m_parent->CocoaAddChild(this);
#include "wx/cocoa/objc/NSView.h"
#include "wx/cocoa/objc/NSWindow.h"
#import <AppKit/NSPanel.h>
+
// ----------------------------------------------------------------------------
// globals
// ----------------------------------------------------------------------------
else
newWindow = [[WXNSWindow alloc] initWithContentRect:cocoaRect styleMask:cocoaStyle backing:NSBackingStoreBuffered defer:NO];
// Make sure the default content view is a WXNSView
- [newWindow setContentView: [[WXNSView alloc] initWithFrame: [[newWindow contentView] frame]]];
+ [newWindow setContentView: [[WX_GET_OBJC_CLASS(WXNSView) alloc] initWithFrame: [[newWindow contentView] frame]]];
// Associate the window and view
SetNSWindow(newWindow);
@interface wxDummyNSView : NSView
- (NSView *)hitTest:(NSPoint)aPoint;
@end
+WX_DECLARE_GET_OBJC_CLASS(wxDummyNSView,NSView)
@implementation wxDummyNSView : NSView
- (NSView *)hitTest:(NSPoint)aPoint
}
@end
+WX_IMPLEMENT_GET_OBJC_CLASS(wxDummyNSView,NSView)
// ========================================================================
// wxWindowCocoaHider
{
wxASSERT(owner);
wxASSERT(owner->GetNSViewForHiding());
- m_dummyNSView = [[wxDummyNSView alloc]
+ m_dummyNSView = [[WX_GET_OBJC_CLASS(wxDummyNSView) alloc]
initWithFrame:[owner->GetNSViewForHiding() frame]];
[m_dummyNSView setAutoresizingMask: [owner->GetNSViewForHiding() autoresizingMask]];
AssociateNSView(m_dummyNSView);
@interface wxFlippedNSClipView : NSClipView
- (BOOL)isFlipped;
@end
+WX_DECLARE_GET_OBJC_CLASS(wxFlippedNSClipView,NSClipView)
@implementation wxFlippedNSClipView : NSClipView
- (BOOL)isFlipped
}
@end
+WX_IMPLEMENT_GET_OBJC_CLASS(wxFlippedNSClipView,NSClipView)
// ========================================================================
// wxWindowCocoaScrollView
/* Replace the default NSClipView with a flipped one. This ensures
scrolling is "pinned" to the top-left instead of bottom-right. */
- NSClipView *flippedClip = [[wxFlippedNSClipView alloc]
+ NSClipView *flippedClip = [[WX_GET_OBJC_CLASS(wxFlippedNSClipView) alloc]
initWithFrame: [[m_cocoaNSScrollView contentView] frame]];
[m_cocoaNSScrollView setContentView:flippedClip];
[flippedClip release];
// TODO: create the window
m_cocoaNSView = NULL;
- SetNSView([[WXNSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
+ SetNSView([[WX_GET_OBJC_CLASS(WXNSView) alloc] initWithFrame: MakeDefaultNSRect(size)]);
[m_cocoaNSView release];
if (m_parent)