X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/06c2bab0852eea898770b124bed58f024f9b7cb0..63a3cd7a8c737eb4571f27e5f2af37eda0f1c5cc:/src/cocoa/timer.mm diff --git a/src/cocoa/timer.mm b/src/cocoa/timer.mm index 8f112e17e7..2dfe2cb30a 100644 --- a/src/cocoa/timer.mm +++ b/src/cocoa/timer.mm @@ -36,16 +36,6 @@ IMPLEMENT_CLASS(wxTimer, wxTimerBase) -// ======================================================================== -// wxNSTimerDelegate -// ======================================================================== -@interface wxNSTimerDelegate : NSObject -{ -} - -- (void)onNotify:(NSTimer *)theTimer; -@end // interface wxNSTimerDelegate : NSObject - // ======================================================================== // wxNSTimerData // ======================================================================== @@ -57,6 +47,7 @@ IMPLEMENT_CLASS(wxTimer, wxTimerBase) - (id)init; - (id)initWithWxTimer:(wxTimer*)theTimer; - (wxTimer*)timer; +- (void)onNotify:(NSTimer *)theTimer; @end // interface wxNSTimerData : NSObject @implementation wxNSTimerData : NSObject @@ -80,13 +71,10 @@ IMPLEMENT_CLASS(wxTimer, wxTimerBase) { return m_timer; } -@end -@implementation wxNSTimerDelegate : NSObject - (void)onNotify:(NSTimer *)theTimer { - wxNSTimerData* theData = [theTimer userInfo]; - [theData timer]->Notify(); //wxTimerBase method + m_timer->Notify(); //wxTimerBase method } @end @@ -94,8 +82,6 @@ IMPLEMENT_CLASS(wxTimer, wxTimerBase) // wxTimer // ---------------------------------------------------------------------------- -const wxObjcAutoRefFromAlloc wxTimer::sm_cocoaDelegate = [[wxNSTimerDelegate alloc] init]; - wxTimer::~wxTimer() { Stop(); @@ -112,14 +98,14 @@ bool wxTimer::Start(int millisecs, bool oneShot) wxAutoNSAutoreleasePool thePool; - wxNSTimerData *userInfo = [[wxNSTimerData alloc] initWithWxTimer:this]; + wxNSTimerData *timerData = [[wxNSTimerData alloc] initWithWxTimer:this]; m_cocoaNSTimer = [[NSTimer scheduledTimerWithTimeInterval: millisecs / 1000.0 //seconds - target: wxTimer::sm_cocoaDelegate + target: timerData selector: @selector(onNotify:) - userInfo: userInfo + userInfo: nil repeats: oneShot == false] retain]; - [userInfo release]; + [timerData release]; return IsRunning(); }