]>
Commit | Line | Data |
---|---|---|
96d49f0e RD |
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 | %{ | |
dfdaab04 | 23 | #if 0 // #ifdef __WXMAC__ |
edda5768 RD |
24 | |
25 | // A dummy class that raises an exception if used... | |
0b0849b5 | 26 | class wxEventLoopBase |
edda5768 RD |
27 | { |
28 | public: | |
0b0849b5 RD |
29 | wxEventLoopBase() { wxPyRaiseNotImplemented(); } |
30 | bool IsOk() const { return false; } | |
edda5768 RD |
31 | int Run() { return 0; } |
32 | void Exit(int rc = 0) {} | |
33 | bool Pending() const { return false; } | |
34 | bool Dispatch() { return false; } | |
35 | bool IsRunning() const { return false; } | |
0b0849b5 | 36 | void WakeUp() {} |
edda5768 RD |
37 | static wxEventLoop *GetActive() { wxPyRaiseNotImplemented(); return NULL; } |
38 | static void SetActive(wxEventLoop* loop) { wxPyRaiseNotImplemented(); } | |
39 | }; | |
40 | ||
41 | #else | |
42 | ||
96d49f0e | 43 | #include <wx/evtloop.h> |
edda5768 RD |
44 | |
45 | #endif | |
96d49f0e RD |
46 | %} |
47 | ||
0b0849b5 | 48 | class wxEventLoopBase |
96d49f0e RD |
49 | { |
50 | public: | |
0b0849b5 | 51 | wxEventLoopBase(); |
96d49f0e RD |
52 | virtual ~wxEventLoop(); |
53 | ||
0b0849b5 RD |
54 | // use this to check whether the event loop was successfully created before |
55 | // using it | |
56 | virtual bool IsOk() const; | |
57 | ||
96d49f0e RD |
58 | // start the event loop, return the exit code when it is finished |
59 | virtual int Run(); | |
60 | ||
61 | // exit from the loop with the given exit code | |
62 | virtual void Exit(int rc = 0); | |
63 | ||
64 | // return true if any events are available | |
65 | virtual bool Pending() const; | |
66 | ||
67 | // dispatch a single event, return false if we should exit from the loop | |
68 | virtual bool Dispatch(); | |
69 | ||
70 | // is the event loop running now? | |
71 | virtual bool IsRunning() const; | |
72 | ||
0b0849b5 RD |
73 | virtual void WakeUp(); |
74 | ||
96d49f0e RD |
75 | // return currently active (running) event loop, may be NULL |
76 | static wxEventLoop *GetActive(); | |
77 | ||
78 | // set currently active (running) event loop | |
79 | static void SetActive(wxEventLoop* loop); | |
80 | }; | |
81 | ||
82 | ||
0b0849b5 RD |
83 | class wxEventLoopManual : public wxEventLoopBase |
84 | { | |
85 | public: | |
86 | wxEventLoopManual(); | |
87 | }; | |
88 | ||
89 | ||
90 | class wxGUIEventLoop : public wxEventLoopBase | |
91 | { | |
92 | public: | |
93 | wxGUIEventLoop(); | |
94 | }; | |
95 | ||
96 | ||
97 | %pythoncode { | |
98 | class EventLoop(GUIEventLoop): | |
99 | """Class using the old name for compatibility.""" | |
100 | pass | |
101 | } | |
102 | ||
103 | ||
104 | class wxModalEventLoop : public wxGUIEventLoop | |
105 | { | |
106 | public: | |
107 | wxModalEventLoop(wxWindow *winModal) | |
108 | }; | |
109 | ||
110 | ||
dfdaab04 RD |
111 | |
112 | // This object sets the wxEventLoop given to the ctor as the currently active | |
113 | // one and unsets it in its dtor, this is especially useful in presence of | |
114 | // exceptions but is more tidy even when we don't use them | |
115 | class wxEventLoopActivator | |
116 | { | |
117 | public: | |
118 | wxEventLoopActivator(wxEventLoop *evtLoop); | |
119 | ~wxEventLoopActivator(); | |
120 | }; | |
121 | ||
122 | ||
123 | ||
96d49f0e | 124 | //--------------------------------------------------------------------------- |