Allow many Objective-C classes to be uniquified at runtime.
[wxWidgets.git] / src / cocoa / NSControl.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        cocoa/NSControl.cpp
3 // Purpose:     wxCocoaNSControl
4 // Author:      David Elliott
5 // Modified by:
6 // Created:     2003/02/15
7 // RCS-ID:      $Id: 
8 // Copyright:   (c) 2003 David Elliott
9 // Licence:     wxWidgets licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/wxprec.h"
21 #ifndef WX_PRECOMP
22     #include "wx/log.h"
23 #endif // WX_PRECOMP
24
25 #include "wx/cocoa/objc/objc_uniquifying.h"
26 #include "wx/cocoa/NSControl.h"
27
28 #import <Foundation/NSObject.h>
29
30 // ============================================================================
31 // @class wxNSControlTarget
32 // ============================================================================
33 @interface wxNSControlTarget : NSObject
34 {
35 }
36
37 - (void)wxNSControlAction: (id)sender;
38 @end //interface wxNSControlTarget
39 WX_DECLARE_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
40
41 @implementation wxNSControlTarget : NSObject
42
43 - (void)wxNSControlAction: (id)sender
44 {
45     wxLogTrace(wxTRACE_COCOA,wxT("wxNSControlAction"));
46     wxCocoaNSControl *wxcontrol = wxCocoaNSControl::GetFromCocoa(sender);
47     wxCHECK_RET(wxcontrol,wxT("wxNSControlAction received but no wxCocoaNSControl exists!"));
48     wxcontrol->CocoaTarget_action();
49 }
50
51 @end //implementation wxNSControlTarget
52 WX_IMPLEMENT_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
53
54 // ============================================================================
55 // wxNSControl
56 // ============================================================================
57 WX_IMPLEMENT_OBJC_INTERFACE(NSControl)
58
59 struct objc_object *wxCocoaNSControl::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSControlTarget) alloc] init];
60