monodll_statline2.o \
monodll_stattext.o \
monodll_textctrl.o \
+ monodll_timer.o \
monodll_toolbar.o \
monodll_tooltip.o \
monodll_toplevel.o \
monodll_paletteg.o \
monodll_regiong.o \
monodll_statusbr.o \
- monodll_tabg.o \
- monodll_timer.o
+ monodll_tabg.o
@COND_TOOLKIT_COCOA@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS)
COND_TOOLKIT_GTK___GUI_SRC_OBJECTS = \
monodll_accel.o \
monolib_statline2.o \
monolib_stattext.o \
monolib_textctrl.o \
+ monolib_timer.o \
monolib_toolbar.o \
monolib_tooltip.o \
monolib_toplevel.o \
monolib_paletteg.o \
monolib_regiong.o \
monolib_statusbr.o \
- monolib_tabg.o \
- monolib_timer.o
+ monolib_tabg.o
@COND_TOOLKIT_COCOA@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_1)
COND_TOOLKIT_GTK___GUI_SRC_OBJECTS_1 = \
monolib_accel.o \
coredll_statline2.o \
coredll_stattext.o \
coredll_textctrl.o \
+ coredll_timer.o \
coredll_toolbar.o \
coredll_tooltip.o \
coredll_toplevel.o \
coredll_paletteg.o \
coredll_regiong.o \
coredll_statusbr.o \
- coredll_tabg.o \
- coredll_timer.o
+ coredll_tabg.o
@COND_TOOLKIT_COCOA@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_2)
COND_TOOLKIT_GTK___GUI_SRC_OBJECTS_2 = \
coredll_accel.o \
corelib_statline2.o \
corelib_stattext.o \
corelib_textctrl.o \
+ corelib_timer.o \
corelib_toolbar.o \
corelib_tooltip.o \
corelib_toplevel.o \
corelib_paletteg.o \
corelib_regiong.o \
corelib_statusbr.o \
- corelib_tabg.o \
- corelib_timer.o
+ corelib_tabg.o
@COND_TOOLKIT_COCOA@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_3)
COND_TOOLKIT_GTK___GUI_SRC_OBJECTS_3 = \
corelib_accel.o \
@COND_TOOLKIT_WINCE_USE_GUI_1@monodll_timer.o: $(srcdir)/src/msw/timer.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/timer.cpp
-@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monodll_timer.o: $(srcdir)/src/generic/timer.cpp $(MONODLL_ODEP)
-@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
-
@COND_TOOLKIT_X11_USE_GUI_1@monodll_timer.o: $(srcdir)/src/generic/timer.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@monodll_timer.o: $(srcdir)/src/mac/carbon/timer.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/carbon/timer.cpp
+@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monodll_timer.o: $(srcdir)/src/cocoa/timer.mm $(MONODLL_ODEP)
+@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/cocoa/timer.mm
+
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monodll_timer.o: $(srcdir)/src/os2/timer.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/os2/timer.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1@monolib_timer.o: $(srcdir)/src/msw/timer.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/timer.cpp
-@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monolib_timer.o: $(srcdir)/src/generic/timer.cpp $(MONOLIB_ODEP)
-@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
-
@COND_TOOLKIT_X11_USE_GUI_1@monolib_timer.o: $(srcdir)/src/generic/timer.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@monolib_timer.o: $(srcdir)/src/mac/carbon/timer.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/carbon/timer.cpp
+@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@monolib_timer.o: $(srcdir)/src/cocoa/timer.mm $(MONOLIB_ODEP)
+@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/cocoa/timer.mm
+
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monolib_timer.o: $(srcdir)/src/os2/timer.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/os2/timer.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1@coredll_timer.o: $(srcdir)/src/msw/timer.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/timer.cpp
-@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@coredll_timer.o: $(srcdir)/src/generic/timer.cpp $(COREDLL_ODEP)
-@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
-
@COND_TOOLKIT_X11_USE_GUI_1@coredll_timer.o: $(srcdir)/src/generic/timer.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@coredll_timer.o: $(srcdir)/src/mac/carbon/timer.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/carbon/timer.cpp
+@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@coredll_timer.o: $(srcdir)/src/cocoa/timer.mm $(COREDLL_ODEP)
+@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/cocoa/timer.mm
+
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@coredll_timer.o: $(srcdir)/src/os2/timer.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/os2/timer.cpp
@COND_TOOLKIT_WINCE_USE_GUI_1@corelib_timer.o: $(srcdir)/src/msw/timer.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/timer.cpp
-@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@corelib_timer.o: $(srcdir)/src/generic/timer.cpp $(CORELIB_ODEP)
-@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
-
@COND_TOOLKIT_X11_USE_GUI_1@corelib_timer.o: $(srcdir)/src/generic/timer.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/timer.cpp
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@corelib_timer.o: $(srcdir)/src/mac/carbon/timer.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/carbon/timer.cpp
+@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@corelib_timer.o: $(srcdir)/src/cocoa/timer.mm $(CORELIB_ODEP)
+@COND_TOOLKIT_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/cocoa/timer.mm
+
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@corelib_timer.o: $(srcdir)/src/os2/timer.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/os2/timer.cpp
src/cocoa/statline2.mm
src/cocoa/stattext.mm
src/cocoa/textctrl.mm
+ src/cocoa/timer.mm
src/cocoa/toolbar.mm
src/cocoa/tooltip.mm
src/cocoa/toplevel.mm
src/generic/regiong.cpp
src/generic/statusbr.cpp
src/generic/tabg.cpp
- src/generic/timer.cpp
</set>
<set var="COCOA_HDR" hints="files">
wx/cocoa/NSApplication.h
wx/cocoa/statline.h
wx/cocoa/stattext.h
wx/cocoa/textctrl.h
+ wx/cocoa/timer.h
wx/cocoa/toolbar.h
wx/cocoa/toplevel.h
wx/cocoa/window.h
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: timer.h
+// Purpose: Cocoa wxTimer class
+// Author: Ryan Norton
+// Id: $Id$
+// Copyright: (c) Ryan Norton
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __WX_TIMER_H__
+#define __WX_TIMER_H__
+
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
+ #pragma interface "timer.h"
+#endif
+
+#include "wx/cocoa/ObjcRef.h"
+
+//-----------------------------------------------------------------------------
+// wxTimer
+//-----------------------------------------------------------------------------
+
+DECLARE_WXCOCOA_OBJC_CLASS(NSTimer);
+
+class WXDLLEXPORT wxTimer : public wxTimerBase
+{
+public:
+ wxTimer() { Init(); }
+ wxTimer(wxEvtHandler *owner, int timerid = -1) : wxTimerBase(owner, timerid)
+ { Init(); }
+ ~wxTimer();
+
+ virtual bool Start(int millisecs = -1, bool oneShot = false);
+ virtual void Stop();
+
+ virtual bool IsRunning() const;
+
+ inline WX_NSTimer GetNSTimer()
+ { return m_cocoaNSTimer; }
+
+protected:
+ void Init();
+
+private:
+ WX_NSTimer m_cocoaNSTimer;
+ static const wxObjcAutoRefFromAlloc<struct objc_object *> sm_cocoaDelegate;
+
+ DECLARE_ABSTRACT_CLASS(wxTimer)
+};
+
+#endif // __WX_TIMER_H__
#include "wx/motif/timer.h"
#elif defined(__WXGTK__)
#include "wx/gtk/timer.h"
-#elif defined(__WXX11__) || defined(__WXMGL__) || defined(__WXCOCOA__)
+#elif defined(__WXX11__) || defined(__WXMGL__)
#include "wx/generic/timer.h"
+#elif defined (__WXCOCOA__)
+ #include "wx/cocoa/timer.h"
#elif defined(__WXMAC__)
#include "wx/mac/timer.h"
#elif defined(__WXPM__)
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: src/cocoa/timer.mm
+// Purpose: wxTimer for wxCocoa
+// Author: Ryan Norton
+// Modified by:
+// Created: 2005-02-04
+// RCS-ID: $Id$
+// Copyright: (c) Ryan Norton
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if wxUSE_TIMER
+
+#ifndef WX_PRECOMP
+ #include "wx/timer.h"
+#endif
+
+#import <Foundation/NSTimer.h>
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+IMPLEMENT_CLASS(wxTimer, wxTimerBase)
+
+// ========================================================================
+// wxNSTimerDelegate
+// ========================================================================
+@interface wxNSTimerDelegate : NSObject
+{
+}
+
+- (void)onNotify:(NSTimer *)theTimer;
+@end // interface wxNSTimerDelegate : NSObject
+
+// ========================================================================
+// wxNSTimerData
+// ========================================================================
+@interface wxNSTimerData : NSObject
+{
+ wxTimer* m_timer;
+}
+
+- (id)setTimer:(wxTimer*)theTimer;
+- (wxTimer*)timer;
+@end // interface wxNSTimerData : NSObject
+
+@implementation wxNSTimerData : NSObject
+- (id)setTimer:(wxTimer*)theTimer;
+{
+ m_timer = theTimer;
+ return self;
+}
+- (wxTimer*)timer
+{
+ return m_timer;
+}
+@end
+
+@implementation wxNSTimerDelegate : NSObject
+- (void)onNotify:(NSTimer *)theTimer
+{
+ wxNSTimerData* theData = [theTimer userInfo];
+ [theData timer]->Notify(); //wxTimerBase method
+}
+@end
+
+// ----------------------------------------------------------------------------
+// wxTimer
+// ----------------------------------------------------------------------------
+
+const wxObjcAutoRefFromAlloc<struct objc_object*> wxTimer::sm_cocoaDelegate = [[wxNSTimerDelegate alloc] init];
+
+wxTimer::~wxTimer()
+{
+ Stop();
+}
+
+void wxTimer::Init()
+{
+ m_cocoaNSTimer = NULL;
+}
+
+bool wxTimer::Start(int millisecs, bool oneShot)
+{
+ m_cocoaNSTimer = [[NSTimer
+ scheduledTimerWithTimeInterval: millisecs / 1000.0 //seconds
+ target: wxTimer::sm_cocoaDelegate
+ selector: @selector(onNotify:)
+ userInfo: [[wxNSTimerData alloc] setTimer:this]
+ repeats: oneShot == false] retain];
+
+ return IsRunning();
+}
+
+void wxTimer::Stop()
+{
+ if (m_cocoaNSTimer)
+ {
+ [m_cocoaNSTimer invalidate];
+ [[m_cocoaNSTimer userInfo] release];
+ [m_cocoaNSTimer release];
+ }
+}
+
+bool wxTimer::IsRunning() const
+{
+ return m_cocoaNSTimer != NULL && [m_cocoaNSTimer isValid];
+}
+
+#endif // wxUSE_TIMER
+