forked from svn2github/wxPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_evtloop.i
More file actions
149 lines (110 loc) · 4.27 KB
/
Copy path_evtloop.i
File metadata and controls
149 lines (110 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/////////////////////////////////////////////////////////////////////////////
// Name: _evtloop.i
// Purpose: SWIG interface for wxEventLoop
//
// Author: Robin Dunn
//
// Created: 18-Sept-2004
// RCS-ID: $Id$
// Copyright: (c) 2004 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
// TODO:
// * wxPyEventLoop that virtualizes all the methods
// * Add wxEventLoopSource when MSW gets an implementation
//---------------------------------------------------------------------------
%newgroup
%{
#include <wx/evtloop.h>
%}
class wxEventLoopBase
{
public:
// wxEventLoopBase(); *** It's an ABC, can't instantiate
virtual ~wxEventLoopBase();
// use this to check whether the event loop was successfully created before
// using it
virtual bool IsOk() const;
// returns true if this is the main loop
bool IsMain() const;
// start the event loop, return the exit code when it is finished
virtual int Run();
// is the event loop running now?
virtual bool IsRunning() const;
// exit from the loop with the given exit code
virtual void Exit(int rc = 0);
// return true if any events are available
virtual bool Pending() const;
// dispatch a single event, return false if we should exit from the loop
virtual bool Dispatch();
// same as Dispatch() but doesn't wait for longer than the specified (in
// ms) timeout, return true if an event was processed, false if we should
// exit the loop or -1 if timeout expired
virtual int DispatchTimeout(unsigned long timeout) ;
// implement this to wake up the loop: usually done by posting a dummy event
// to it (can be called from non main thread)
virtual void WakeUp();
// idle handling
// -------------
// make sure that idle events are sent again
virtual void WakeUpIdle();
// this virtual function is called when the application
// becomes idle and normally just sends wxIdleEvent to all interested
// parties
//
// it should return true if more idle events are needed, false if not
virtual bool ProcessIdle();
// process all currently pending events right now
//
// it is an error to call Yield() recursively unless the value of
// onlyIfNeeded is true
//
// WARNING: this function is dangerous as it can lead to unexpected
// reentrancies (i.e. when called from an event handler it
// may result in calling the same event handler again), use
// with _extreme_ care or, better, don't use at all!
bool Yield(bool onlyIfNeeded = false);
virtual bool YieldFor(long eventsToProcess);
// returns true if the main thread is inside a Yield() call
virtual bool IsYielding() const;
// returns true if events of the given event category should be immediately
// processed inside a wxApp::Yield() call or rather should be queued for
// later processing by the main event loop
virtual bool IsEventAllowedInsideYield(wxEventCategory cat) const;
// return currently active (running) event loop, may be NULL
static wxEventLoopBase* GetActive();
// set currently active (running) event loop
static void SetActive(wxEventLoopBase* loop);
};
// class wxEventLoopManual : public wxEventLoopBase
// {
// public:
// wxEventLoopManual();
// };
class wxGUIEventLoop : public wxEventLoopBase
{
public:
wxGUIEventLoop();
};
%pythoncode {
class EventLoop(GUIEventLoop):
"""Class using the old name for compatibility."""
pass
}
class wxModalEventLoop : public wxGUIEventLoop
{
public:
wxModalEventLoop(wxWindow *winModal);
};
// This object sets the wxEventLoop given to the ctor as the currently active
// one and unsets it in its dtor, this is especially useful in presence of
// exceptions but is more tidy even when we don't use them
class wxEventLoopActivator
{
public:
wxEventLoopActivator(wxEventLoopBase *evtLoop);
~wxEventLoopActivator();
};
//---------------------------------------------------------------------------