X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb896a322a2ed53d393ee738765ddd3f72cee004..d2e66707deb10dea6f92e3e4092f8a43ef942a5d:/src/cocoa/NSControl.mm diff --git a/src/cocoa/NSControl.mm b/src/cocoa/NSControl.mm index 01bd97f297..0bcac4f44b 100644 --- a/src/cocoa/NSControl.mm +++ b/src/cocoa/NSControl.mm @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: cocoa/NSControl.cpp +// Name: src/cocoa/NSControl.mm // Purpose: wxCocoaNSControl // Author: David Elliott // Modified by: // Created: 2003/02/15 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -19,12 +19,46 @@ #include "wx/wxprec.h" #ifndef WX_PRECOMP + #include "wx/log.h" #endif // WX_PRECOMP +#include "wx/cocoa/objc/objc_uniquifying.h" +#include "wx/cocoa/ObjcRef.h" #include "wx/cocoa/NSControl.h" -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- +#import + +// ============================================================================ +// @class wxNSControlTarget +// ============================================================================ +@interface wxNSControlTarget : NSObject +{ +} + +- (void)wxNSControlAction: (id)sender; +@end //interface wxNSControlTarget +WX_DECLARE_GET_OBJC_CLASS(wxNSControlTarget,NSObject) + +@implementation wxNSControlTarget : NSObject + +- (void)wxNSControlAction: (id)sender +{ + wxLogTrace(wxTRACE_COCOA,wxT("wxNSControlAction")); + wxCocoaNSControl *wxcontrol = wxCocoaNSControl::GetFromCocoa(sender); + wxCHECK_RET(wxcontrol,wxT("wxNSControlAction received but no wxCocoaNSControl exists!")); + wxcontrol->CocoaTarget_action(); +} + +@end //implementation wxNSControlTarget +WX_IMPLEMENT_GET_OBJC_CLASS(wxNSControlTarget,NSObject) + +// ============================================================================ +// wxNSControl +// ============================================================================ WX_IMPLEMENT_OBJC_INTERFACE(NSControl) +// New CF-retained observer (this should have been using wxObjcAutoRefFromAlloc to begin with) +wxObjcAutoRefFromAlloc s_cocoaNSControlTarget = [[WX_GET_OBJC_CLASS(wxNSControlTarget) alloc] init]; +// For compatibility with old code +struct objc_object *wxCocoaNSControl::sm_cocoaTarget = s_cocoaNSControlTarget; +