]>
Commit | Line | Data |
---|---|---|
fb896a32 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: src/cocoa/NSControl.mm |
fb896a32 DE |
3 | // Purpose: wxCocoaNSControl |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2003/02/15 | |
fb896a32 | 7 | // Copyright: (c) 2003 David Elliott |
526954c5 | 8 | // Licence: wxWindows licence |
fb896a32 DE |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | // ============================================================================ | |
12 | // declarations | |
13 | // ============================================================================ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | #include "wx/wxprec.h" | |
20 | #ifndef WX_PRECOMP | |
e0c691d1 | 21 | #include "wx/log.h" |
fb896a32 DE |
22 | #endif // WX_PRECOMP |
23 | ||
a24aa427 | 24 | #include "wx/cocoa/objc/objc_uniquifying.h" |
7be6187f | 25 | #include "wx/cocoa/ObjcRef.h" |
fb896a32 DE |
26 | #include "wx/cocoa/NSControl.h" |
27 | ||
e0c691d1 DE |
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 | |
a24aa427 | 39 | WX_DECLARE_GET_OBJC_CLASS(wxNSControlTarget,NSObject) |
e0c691d1 DE |
40 | |
41 | @implementation wxNSControlTarget : NSObject | |
42 | ||
43 | - (void)wxNSControlAction: (id)sender | |
44 | { | |
48580976 | 45 | wxLogTrace(wxTRACE_COCOA,wxT("wxNSControlAction")); |
e0c691d1 | 46 | wxCocoaNSControl *wxcontrol = wxCocoaNSControl::GetFromCocoa(sender); |
2b030203 | 47 | wxCHECK_RET(wxcontrol,wxT("wxNSControlAction received but no wxCocoaNSControl exists!")); |
e0c691d1 DE |
48 | wxcontrol->CocoaTarget_action(); |
49 | } | |
50 | ||
51 | @end //implementation wxNSControlTarget | |
a24aa427 | 52 | WX_IMPLEMENT_GET_OBJC_CLASS(wxNSControlTarget,NSObject) |
e0c691d1 DE |
53 | |
54 | // ============================================================================ | |
55 | // wxNSControl | |
56 | // ============================================================================ | |
fb896a32 DE |
57 | WX_IMPLEMENT_OBJC_INTERFACE(NSControl) |
58 | ||
7be6187f DE |
59 | // New CF-retained observer (this should have been using wxObjcAutoRefFromAlloc to begin with) |
60 | wxObjcAutoRefFromAlloc<wxNSControlTarget*> s_cocoaNSControlTarget = [[WX_GET_OBJC_CLASS(wxNSControlTarget) alloc] init]; | |
61 | // For compatibility with old code | |
62 | struct objc_object *wxCocoaNSControl::sm_cocoaTarget = s_cocoaNSControlTarget; | |
e0c691d1 | 63 |