]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_evtloop.i
reSWIGged with the new SWIG runtime
[wxWidgets.git] / wxPython / src / _evtloop.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _evtloop.i
3 // Purpose: SWIG interface for wxEventLoop
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 18-Sept-2004
8 // RCS-ID: $Id$
9 // Copyright: (c) 2004 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17 // TODO: wxPyEventLoop that virtualizes all the methods...
18
19 //---------------------------------------------------------------------------
20 %newgroup
21
22 %{
23 #if 0 // #ifdef __WXMAC__
24
25 // A dummy class that raises an exception if used...
26 class wxEventLoop
27 {
28 public:
29 wxEventLoop() { wxPyRaiseNotImplemented(); }
30 int Run() { return 0; }
31 void Exit(int rc = 0) {}
32 bool Pending() const { return false; }
33 bool Dispatch() { return false; }
34 bool IsRunning() const { return false; }
35 static wxEventLoop *GetActive() { wxPyRaiseNotImplemented(); return NULL; }
36 static void SetActive(wxEventLoop* loop) { wxPyRaiseNotImplemented(); }
37 };
38
39 #else
40
41 #include <wx/evtloop.h>
42
43 #endif
44 %}
45
46 class wxEventLoop
47 {
48 public:
49 wxEventLoop();
50 virtual ~wxEventLoop();
51
52 // start the event loop, return the exit code when it is finished
53 virtual int Run();
54
55 // exit from the loop with the given exit code
56 virtual void Exit(int rc = 0);
57
58 // return true if any events are available
59 virtual bool Pending() const;
60
61 // dispatch a single event, return false if we should exit from the loop
62 virtual bool Dispatch();
63
64 // is the event loop running now?
65 virtual bool IsRunning() const;
66
67 // return currently active (running) event loop, may be NULL
68 static wxEventLoop *GetActive();
69
70 // set currently active (running) event loop
71 static void SetActive(wxEventLoop* loop);
72 };
73
74
75
76 // This object sets the wxEventLoop given to the ctor as the currently active
77 // one and unsets it in its dtor, this is especially useful in presence of
78 // exceptions but is more tidy even when we don't use them
79 class wxEventLoopActivator
80 {
81 public:
82 wxEventLoopActivator(wxEventLoop *evtLoop);
83 ~wxEventLoopActivator();
84 };
85
86
87
88 //---------------------------------------------------------------------------