]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_evtloop.i
Don't insert a newline when we get text
[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 wxEventLoopBase
27 {
28 public:
29 wxEventLoopBase() { wxPyRaiseNotImplemented(); }
30 bool IsOk() const { return false; }
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; }
36 void WakeUp() {}
37 static wxEventLoop *GetActive() { wxPyRaiseNotImplemented(); return NULL; }
38 static void SetActive(wxEventLoop* loop) { wxPyRaiseNotImplemented(); }
39 };
40
41 #else
42
43 #include <wx/evtloop.h>
44
45 #endif
46 %}
47
48 class wxEventLoopBase
49 {
50 public:
51 wxEventLoopBase();
52 virtual ~wxEventLoop();
53
54 // use this to check whether the event loop was successfully created before
55 // using it
56 virtual bool IsOk() const;
57
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
73 virtual void WakeUp();
74
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
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
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
124 //---------------------------------------------------------------------------