X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0c691d13c4bf3e537a6b1de8d69bb30f9538776..57bf907d8e45ced18486d74c04f41c06034b7e65:/src/cocoa/NSControl.mm diff --git a/src/cocoa/NSControl.mm b/src/cocoa/NSControl.mm index 53d42d1697..6c3f4a22fc 100644 --- a/src/cocoa/NSControl.mm +++ b/src/cocoa/NSControl.mm @@ -6,7 +6,7 @@ // Created: 2003/02/15 // RCS-ID: $Id: // Copyright: (c) 2003 David Elliott -// Licence: wxWindows license +// Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -22,6 +22,8 @@ #include "wx/log.h" #endif // WX_PRECOMP +#include "wx/cocoa/objc/objc_uniquifying.h" +#include "wx/cocoa/ObjcRef.h" #include "wx/cocoa/NSControl.h" #import @@ -35,23 +37,28 @@ - (void)wxNSControlAction: (id)sender; @end //interface wxNSControlTarget +WX_DECLARE_GET_OBJC_CLASS(wxNSControlTarget,NSObject) @implementation wxNSControlTarget : NSObject - (void)wxNSControlAction: (id)sender { - wxLogDebug("wxNSControlAction"); + wxLogTrace(wxTRACE_COCOA,wxT("wxNSControlAction")); wxCocoaNSControl *wxcontrol = wxCocoaNSControl::GetFromCocoa(sender); - wxCHECK_RET(wxcontrol,"wxNSControlAction received but no wxCocoaNSControl exists!"); + 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) -struct objc_object *wxCocoaNSControl::sm_cocoaTarget = [[wxNSControlTarget alloc] init]; +// 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;