]> git.saurik.com Git - wxWidgets.git/commitdiff
Provide target/action mechanism for subclasses to use
authorDavid Elliott <dfe@tgwbd.org>
Mon, 8 Sep 2003 19:00:45 +0000 (19:00 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Mon, 8 Sep 2003 19:00:45 +0000 (19:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23431 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/cocoa/NSControl.h
src/cocoa/NSControl.mm

index 36233401c239186fdb848a1f703841b296d53919..92785ac86dc211406470ec6eb4103619b3c135ca 100644 (file)
@@ -19,8 +19,11 @@ WX_DECLARE_OBJC_HASHMAP(NSControl);
 class wxCocoaNSControl
 {
     WX_DECLARE_OBJC_INTERFACE(NSControl)
-protected:
+public:
+    virtual void CocoaTarget_action() {}
 //    virtual void Cocoa_didChangeText(void) = 0;
+protected:
+    static struct objc_object *sm_cocoaTarget;
 };
 
 #endif // _WX_COCOA_NSCONTROL_H_
index 01bd97f2979f6b3d318e5c567534321c885faa71..53d42d16971c7c76e05886117240e5c05f620c74 100644 (file)
 
 #include "wx/wxprec.h"
 #ifndef WX_PRECOMP
+    #include "wx/log.h"
 #endif // WX_PRECOMP
 
 #include "wx/cocoa/NSControl.h"
 
-// ----------------------------------------------------------------------------
-// globals
-// ----------------------------------------------------------------------------
+#import <Foundation/NSObject.h>
+
+// ============================================================================
+// @class wxNSControlTarget
+// ============================================================================
+@interface wxNSControlTarget : NSObject
+{
+}
+
+- (void)wxNSControlAction: (id)sender;
+@end //interface wxNSControlTarget
+
+@implementation wxNSControlTarget : NSObject
+
+- (void)wxNSControlAction: (id)sender
+{
+    wxLogDebug("wxNSControlAction");
+    wxCocoaNSControl *wxcontrol = wxCocoaNSControl::GetFromCocoa(sender);
+    wxCHECK_RET(wxcontrol,"wxNSControlAction received but no wxCocoaNSControl exists!");
+    wxcontrol->CocoaTarget_action();
+}
+
+@end //implementation wxNSControlTarget
+
+// ============================================================================
+// wxNSControl
+// ============================================================================
 WX_IMPLEMENT_OBJC_INTERFACE(NSControl)
 
+struct objc_object *wxCocoaNSControl::sm_cocoaTarget = [[wxNSControlTarget alloc] init];
+