1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _core.sip
8//
9//---------------------------------------------------------------------------
10
11//---------------------------------------------------------------------------
12
13const int wxTIMER_CONTINUOUS;
14const int wxTIMER_ONE_SHOT;
15wxEventType wxEVT_TIMER   /PyName=wxEVT_TIMER/;
16
17class wxTimer : wxEvtHandler
18{
19    %Docstring
20        Timer()
21        Timer(owner, id=-1)
22
23        The wxTimer class allows you to execute code at specified intervals.
24    %End
25    %TypeHeaderCode
26        #include <wx/timer.h>
27    %End
28
29public:
30    wxTimer();
31    %PreMethodCode
32        if (!wxPyCheckForApp()) return NULL;
33    %End
34
35    wxTimer(
36        wxEvtHandler * owner,
37        int id = -1
38    );
39    %PreMethodCode
40        if (!wxPyCheckForApp()) return NULL;
41    %End
42
43    virtual
44    ~wxTimer();
45
46    int GetId() const;
47    %Docstring
48        GetId() -> int
49
50        Returns the ID of the events generated by this timer.
51    %End
52
53    int GetInterval() const;
54    %Docstring
55        GetInterval() -> int
56
57        Returns the current interval for the timer (in milliseconds).
58    %End
59
60    wxEvtHandler * GetOwner() const;
61    %Docstring
62        GetOwner() -> EvtHandler
63
64        Returns the current owner of the timer.
65    %End
66
67    bool IsOneShot() const;
68    %Docstring
69        IsOneShot() -> bool
70
71        Returns true if the timer is one shot, i.e. if it will stop after
72        firing the first notification automatically.
73    %End
74
75    bool IsRunning() const;
76    %Docstring
77        IsRunning() -> bool
78
79        Returns true if the timer is running, false if it is stopped.
80    %End
81
82    virtual
83    void Notify();
84    %Docstring
85        Notify()
86
87        This member should be overridden by the user if the default
88        constructor was used and SetOwner() wasn't called.
89    %End
90
91    void SetOwner(
92        wxEvtHandler * owner,
93        int id = -1
94    );
95    %Docstring
96        SetOwner(owner, id=-1)
97
98        Associates the timer with the given owner object.
99    %End
100
101    virtual
102    bool Start(
103        int milliseconds = -1,
104        bool oneShot = wxTIMER_CONTINUOUS
105    );
106    %Docstring
107        Start(milliseconds=-1, oneShot=TIMER_CONTINUOUS) -> bool
108
109        (Re)starts the timer.
110    %End
111
112    bool StartOnce(
113        int milliseconds = -1
114    );
115    %Docstring
116        StartOnce(milliseconds=-1) -> bool
117
118        Starts the timer for a once-only notification.
119    %End
120
121    virtual
122    void Stop();
123    %Docstring
124        Stop()
125
126        Stops the timer.
127    %End
128
129    public:
130
131
132    %Property(name=Id, get=GetId)
133    %Property(name=Interval, get=GetInterval)
134    %Property(name=Owner, get=GetOwner, set=SetOwner)
135};  // end of class wxTimer
136
137
138class wxTimerRunner
139{
140    %Docstring
141        TimerRunner(timer)
142        TimerRunner(timer, milli, oneShot=False)
143
144        Starts the timer in its ctor, stops in the dtor.
145    %End
146    %TypeHeaderCode
147        #include <wx/timer.h>
148    %End
149
150public:
151    wxTimerRunner(
152        wxTimer & timer
153    );
154    %PreMethodCode
155        if (!wxPyCheckForApp()) return NULL;
156    %End
157
158    wxTimerRunner(
159        wxTimer & timer,
160        int milli,
161        bool oneShot = false
162    );
163    %PreMethodCode
164        if (!wxPyCheckForApp()) return NULL;
165    %End
166
167    ~wxTimerRunner();
168
169    void Start(
170        int milli,
171        bool oneShot = false
172    );
173    %Docstring
174        Start(milli, oneShot=False)
175    %End
176
177    private:
178        wxTimerRunner(const wxTimerRunner&);
179
180
181};  // end of class wxTimerRunner
182
183
184class wxTimerEvent : wxEvent
185{
186    %Docstring
187        TimerEvent()
188        TimerEvent(timer)
189
190        wxTimerEvent object is passed to the event handler of timer events
191        (see wxTimer::SetOwner).
192    %End
193    %TypeHeaderCode
194        #include <wx/timer.h>
195    %End
196
197public:
198    wxTimerEvent();
199
200    wxTimerEvent(
201        wxTimer & timer
202    );
203
204    int GetInterval() const;
205    %Docstring
206        GetInterval() -> int
207
208        Returns the interval of the timer which generated this event.
209    %End
210
211    wxTimer & GetTimer() const;
212    %Docstring
213        GetTimer() -> Timer
214
215        Returns the timer object which generated this event.
216    %End
217
218    public:
219
220
221    %Property(name=Interval, get=GetInterval)
222    %Property(name=Timer, get=GetTimer)
223};  // end of class wxTimerEvent
224
225
226%Extract(id=pycode_core)
227EVT_TIMER = wx.PyEventBinder( wxEVT_TIMER )
228
229%End
230
231%Extract(id=pycode_core)
232class PyTimer(Timer):
233    '''This timer class is passed the callable object to be called when the timer expires.'''
234    def __init__(self, notify):
235        Timer.__init__(self)
236        self.notify = notify
237
238    def Notify(self):
239        if self.notify:
240            self.notify()
241
242%End
243
244
245//---------------------------------------------------------------------------
246
247