may as well make it the target instead of the userInfo.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35942
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
private:
WX_NSTimer m_cocoaNSTimer;
private:
WX_NSTimer m_cocoaNSTimer;
- static const wxObjcAutoRefFromAlloc<struct objc_object *> sm_cocoaDelegate;
DECLARE_ABSTRACT_CLASS(wxTimer)
};
DECLARE_ABSTRACT_CLASS(wxTimer)
};
IMPLEMENT_CLASS(wxTimer, wxTimerBase)
IMPLEMENT_CLASS(wxTimer, wxTimerBase)
-// ========================================================================
-// wxNSTimerDelegate
-// ========================================================================
-@interface wxNSTimerDelegate : NSObject
-{
-}
-
-- (void)onNotify:(NSTimer *)theTimer;
-@end // interface wxNSTimerDelegate : NSObject
-
// ========================================================================
// wxNSTimerData
// ========================================================================
// ========================================================================
// wxNSTimerData
// ========================================================================
- (id)init;
- (id)initWithWxTimer:(wxTimer*)theTimer;
- (wxTimer*)timer;
- (id)init;
- (id)initWithWxTimer:(wxTimer*)theTimer;
- (wxTimer*)timer;
+- (void)onNotify:(NSTimer *)theTimer;
@end // interface wxNSTimerData : NSObject
@implementation wxNSTimerData : NSObject
@end // interface wxNSTimerData : NSObject
@implementation wxNSTimerData : NSObject
-@implementation wxNSTimerDelegate : NSObject
- (void)onNotify:(NSTimer *)theTimer
{
- (void)onNotify:(NSTimer *)theTimer
{
- wxNSTimerData* theData = [theTimer userInfo];
- [theData timer]->Notify(); //wxTimerBase method
+ m_timer->Notify(); //wxTimerBase method
// wxTimer
// ----------------------------------------------------------------------------
// wxTimer
// ----------------------------------------------------------------------------
-const wxObjcAutoRefFromAlloc<struct objc_object*> wxTimer::sm_cocoaDelegate = [[wxNSTimerDelegate alloc] init];
-
wxTimer::~wxTimer()
{
Stop();
wxTimer::~wxTimer()
{
Stop();
wxAutoNSAutoreleasePool thePool;
wxAutoNSAutoreleasePool thePool;
- wxNSTimerData *userInfo = [[wxNSTimerData alloc] initWithWxTimer:this];
+ wxNSTimerData *timerData = [[wxNSTimerData alloc] initWithWxTimer:this];
m_cocoaNSTimer = [[NSTimer
scheduledTimerWithTimeInterval: millisecs / 1000.0 //seconds
m_cocoaNSTimer = [[NSTimer
scheduledTimerWithTimeInterval: millisecs / 1000.0 //seconds
- target: wxTimer::sm_cocoaDelegate
selector: @selector(onNotify:)
selector: @selector(onNotify:)
repeats: oneShot == false] retain];
repeats: oneShot == false] retain];