]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/NSControl.mm
Fix bug in Unix wxFileSystemWatcher implementation when watch is deleted.
[wxWidgets.git] / src / cocoa / NSControl.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/NSControl.mm
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: wxWindows 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/ObjcRef.h"
27 #include "wx/cocoa/NSControl.h"
28
29 #import <Foundation/NSObject.h>
30
31 // ============================================================================
32 // @class wxNSControlTarget
33 // ============================================================================
34 @interface wxNSControlTarget : NSObject
35 {
36 }
37
38 - (void)wxNSControlAction: (id)sender;
39 @end //interface wxNSControlTarget
40 WX_DECLARE_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
41
42 @implementation wxNSControlTarget : NSObject
43
44 - (void)wxNSControlAction: (id)sender
45 {
46 wxLogTrace(wxTRACE_COCOA,wxT("wxNSControlAction"));
47 wxCocoaNSControl *wxcontrol = wxCocoaNSControl::GetFromCocoa(sender);
48 wxCHECK_RET(wxcontrol,wxT("wxNSControlAction received but no wxCocoaNSControl exists!"));
49 wxcontrol->CocoaTarget_action();
50 }
51
52 @end //implementation wxNSControlTarget
53 WX_IMPLEMENT_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
54
55 // ============================================================================
56 // wxNSControl
57 // ============================================================================
58 WX_IMPLEMENT_OBJC_INTERFACE(NSControl)
59
60 // New CF-retained observer (this should have been using wxObjcAutoRefFromAlloc to begin with)
61 wxObjcAutoRefFromAlloc<wxNSControlTarget*> s_cocoaNSControlTarget = [[WX_GET_OBJC_CLASS(wxNSControlTarget) alloc] init];
62 // For compatibility with old code
63 struct objc_object *wxCocoaNSControl::sm_cocoaTarget = s_cocoaNSControlTarget;
64