diff --git a/include/wx/cocoa/NSControl.h b/include/wx/cocoa/NSControl.h index 36233401c2..92785ac86d 100644 --- a/include/wx/cocoa/NSControl.h +++ b/include/wx/cocoa/NSControl.h @@ -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_ diff --git a/src/cocoa/NSControl.mm b/src/cocoa/NSControl.mm index 01bd97f297..53d42d1697 100644 --- a/src/cocoa/NSControl.mm +++ b/src/cocoa/NSControl.mm @@ -19,12 +19,39 @@ #include "wx/wxprec.h" #ifndef WX_PRECOMP + #include "wx/log.h" #endif // WX_PRECOMP #include "wx/cocoa/NSControl.h" -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- +#import + +// ============================================================================ +// @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]; +