]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_app.i
Added wxFRAME_DRAWER
[wxWidgets.git] / wxPython / src / _app.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _app.i
3// Purpose: SWIG interface for wxApp
4//
5// Author: Robin Dunn
6//
7// Created: 9-Aug-2003
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17// TODOs:
18//
19// 1. Provide another app object that allows FilterEvent to be overloaded.
20// 2. Wrap wxAppTraits and allow wxApp::CreateTraits to be overloaded.
21//
22//---------------------------------------------------------------------------
23%newgroup;
24
25%{
26%}
27
28enum {
29 wxPYAPP_ASSERT_SUPPRESS = 1,
30 wxPYAPP_ASSERT_EXCEPTION = 2,
31 wxPYAPP_ASSERT_DIALOG = 4,
32 wxPYAPP_ASSERT_LOG = 8
33};
34
35enum
36{
37 wxPRINT_WINDOWS = 1,
38 wxPRINT_POSTSCRIPT = 2
39};
40
41
42
dce2bd22
RD
43DocStr(wxPyApp,
44"The ``wx.PyApp`` class is an *implementation detail*, please use the
d07d2bc9 45`wx.App` class (or some other derived class) instead.", "");
d14a1e28
RD
46
47class wxPyApp : public wxEvtHandler {
48public:
49
2b9048c5 50 %pythonAppend wxPyApp
d14a1e28
RD
51 "self._setCallbackInfo(self, PyApp)
52 self._setOORInfo(self)";
b39c3fa0 53 %typemap(out) wxPyApp*; // turn off this typemap
d14a1e28 54
856bf319 55 DocStr(wxPyApp,
d07d2bc9 56 "Create a new application object, starting the bootstrap process.", "");
d14a1e28
RD
57 %extend {
58 wxPyApp() {
59 wxPythonApp = new wxPyApp();
60 return wxPythonApp;
61 }
62 }
63
64 ~wxPyApp();
65
b39c3fa0
RD
66 // Turn it back on again
67 %typemap(out) wxPyApp* { $result = wxPyMake_wxObject($1, $owner); }
68
69
d14a1e28
RD
70 void _setCallbackInfo(PyObject* self, PyObject* _class);
71
d14a1e28 72
6c3b4aae
RD
73 DocDeclStr(
74 wxString, GetAppName() const,
d07d2bc9 75 "Get the application name.", "");
6c3b4aae
RD
76 DocDeclStr(
77 void, SetAppName(const wxString& name),
dce2bd22 78 "Set the application name. This value may be used automatically by
d07d2bc9 79`wx.Config` and such.", "");
6c3b4aae
RD
80
81 DocDeclStr(
82 wxString, GetClassName() const,
d07d2bc9 83 "Get the application's class name.", "");
6c3b4aae
RD
84 DocDeclStr(
85 void, SetClassName(const wxString& name),
dce2bd22 86 "Set the application's class name. This value may be used for
d07d2bc9 87X-resources if applicable for the platform", "");
6c3b4aae
RD
88
89 DocDeclStr(
90 const wxString&, GetVendorName() const,
d07d2bc9 91 "Get the application's vendor name.", "");
6c3b4aae
RD
92 DocDeclStr(
93 void, SetVendorName(const wxString& name),
dce2bd22 94 "Set the application's vendor name. This value may be used
d07d2bc9 95automatically by `wx.Config` and such.", "");
6c3b4aae
RD
96
97
98 DocDeclStr(
99 wxAppTraits*, GetTraits(),
dce2bd22
RD
100 "Return (and create if necessary) the app traits object to which we
101delegate for everything which either should be configurable by the
102user (then he can change the default behaviour simply by overriding
103CreateTraits() and returning his own traits object) or which is
104GUI/console dependent as then wx.AppTraits allows us to abstract the
105differences behind the common facade.
106
d07d2bc9 107:todo: Add support for overriding CreateAppTraits in wxPython.", "");
6c3b4aae
RD
108
109
110 DocDeclStr(
111 virtual void, ProcessPendingEvents(),
dce2bd22
RD
112 "Process all events in the Pending Events list -- it is necessary to
113call this function to process posted events. This normally happens
d07d2bc9 114during each event loop iteration.", "");
6c3b4aae
RD
115
116
117 DocDeclStr(
a72f4631 118 virtual bool, Yield(bool onlyIfNeeded = false),
dce2bd22
RD
119 "Process all currently pending events right now, instead of waiting
120until return to the event loop. It is an error to call ``Yield``
121recursively unless the value of ``onlyIfNeeded`` is True.
122
123:warning: This function is dangerous as it can lead to unexpected
d07d2bc9
RD
124 reentrancies (i.e. when called from an event handler it may
125 result in calling the same event handler again), use with
126 extreme care or, better, don't use at all!
dce2bd22 127
d07d2bc9
RD
128:see: `wx.Yield`, `wx.YieldIfNeeded`, `wx.SafeYield`
129", "");
d14a1e28 130
6c3b4aae
RD
131
132 DocDeclStr(
133 virtual void, WakeUpIdle(),
dce2bd22 134 "Make sure that idle events are sent again.
d07d2bc9 135:see: `wx.WakeUpIdle`", "");
d14a1e28 136
d14a1e28 137
6c3b4aae
RD
138 DocDeclStr(
139 virtual int, MainLoop(),
dce2bd22 140 "Execute the main GUI loop, the function doesn't normally return until
d07d2bc9 141all top level windows have been closed and destroyed.", "");
d14a1e28 142
6c3b4aae
RD
143
144 DocDeclStr(
145 virtual void, Exit(),
dce2bd22 146 "Exit the main loop thus terminating the application.
d07d2bc9 147:see: `wx.Exit`", "");
d14a1e28 148
6c3b4aae
RD
149
150 DocDeclStr(
151 virtual void, ExitMainLoop(),
dce2bd22 152 "Exit the main GUI loop during the next iteration of the main
d07d2bc9 153loop, (i.e. it does not stop the program immediately!)", "");
d14a1e28 154
6c3b4aae
RD
155
156 DocDeclStr(
157 virtual bool, Pending(),
d07d2bc9 158 "Returns True if there are unprocessed events in the event queue.", "");
d14a1e28 159
6c3b4aae
RD
160
161 DocDeclStr(
162 virtual bool, Dispatch(),
dce2bd22 163 "Process the first event in the event queue (blocks until an event
d07d2bc9 164appears if there are none currently)", "");
d14a1e28 165
d14a1e28 166
6c3b4aae
RD
167 DocDeclStr(
168 virtual bool, ProcessIdle(),
dce2bd22
RD
169 "Called from the MainLoop when the application becomes idle (there are
170no pending events) and sends a `wx.IdleEvent` to all interested
d07d2bc9 171parties. Returns True if more idle events are needed, False if not.", "");
6c3b4aae
RD
172
173
174 DocDeclStr(
175 virtual bool, SendIdleEvents(wxWindow* win, wxIdleEvent& event),
dce2bd22 176 "Send idle event to window and all subwindows. Returns True if more
d07d2bc9 177idle time is requested.", "");
d14a1e28 178
d14a1e28 179
6c3b4aae
RD
180 DocDeclStr(
181 virtual bool, IsActive() const,
d07d2bc9 182 "Return True if our app has focus.", "");
d14a1e28 183
6c3b4aae
RD
184
185 DocDeclStr(
186 void, SetTopWindow(wxWindow *win),
d07d2bc9 187 "Set the *main* top level window", "");
d14a1e28 188
6c3b4aae
RD
189 DocDeclStr(
190 virtual wxWindow*, GetTopWindow() const,
dce2bd22
RD
191 "Return the *main* top level window (if it hadn't been set previously
192with SetTopWindow(), will return just some top level window and, if
d07d2bc9 193there not any, will return None)", "");
d14a1e28 194
d14a1e28 195
6c3b4aae
RD
196 DocDeclStr(
197 void, SetExitOnFrameDelete(bool flag),
dce2bd22
RD
198 "Control the exit behaviour: by default, the program will exit the main
199loop (and so, usually, terminate) when the last top-level program
200window is deleted. Beware that if you disable this behaviour (with
201SetExitOnFrameDelete(False)), you'll have to call ExitMainLoop()
d07d2bc9 202explicitly from somewhere.", "");
6c3b4aae
RD
203
204
205 DocDeclStr(
206 bool, GetExitOnFrameDelete() const,
d07d2bc9 207 "Get the current exit behaviour setting.", "");
d14a1e28
RD
208
209#if 0
856bf319 210 // Get display mode that is in use. This is only used in framebuffer
d14a1e28
RD
211 // wxWin ports (such as wxMGL).
212 virtual wxVideoMode GetDisplayMode() const;
213
214 // Set display mode to use. This is only used in framebuffer wxWin
215 // ports (such as wxMGL). This method should be called from
216 // wxApp::OnInitGui
217 virtual bool SetDisplayMode(const wxVideoMode& info);
218#endif
219
6c3b4aae
RD
220
221 DocDeclStr(
222 void, SetUseBestVisual( bool flag ),
dce2bd22 223 "Set whether the app should try to use the best available visual on
d07d2bc9 224systems where more than one is available, (Sun, SGI, XFree86 4, etc.)", "");
6c3b4aae
RD
225
226 DocDeclStr(
227 bool, GetUseBestVisual() const,
d07d2bc9 228 "Get current UseBestVisual setting.", "");
6c3b4aae 229
d14a1e28
RD
230
231 // set/get printing mode: see wxPRINT_XXX constants.
232 //
233 // default behaviour is the normal one for Unix: always use PostScript
234 // printing.
235 virtual void SetPrintMode(int mode);
236 int GetPrintMode() const;
237
6c3b4aae
RD
238
239 DocDeclStr(
240 void, SetAssertMode(int mode),
d07d2bc9
RD
241 "Set the OnAssert behaviour for debug and hybrid builds.",
242 "The following flags may be or'd together:
dce2bd22
RD
243
244 ========================= =======================================
245 wx.PYAPP_ASSERT_SUPPRESS Don't do anything
246 wx.PYAPP_ASSERT_EXCEPTION Turn it into a Python exception if possible
247 (default)
248 wx.PYAPP_ASSERT_DIALOG Display a message dialog
249 wx.PYAPP_ASSERT_LOG Write the assertion info to the wx.Log
250 ========================= =======================================
251
252");
6c3b4aae
RD
253
254 DocDeclStr(
255 int, GetAssertMode(),
d07d2bc9 256 "Get the current OnAssert behaviour setting.", "");
d14a1e28
RD
257
258
259 static bool GetMacSupportPCMenuShortcuts();
260 static long GetMacAboutMenuItemId();
261 static long GetMacPreferencesMenuItemId();
262 static long GetMacExitMenuItemId();
263 static wxString GetMacHelpMenuTitleName();
264
265 static void SetMacSupportPCMenuShortcuts(bool val);
266 static void SetMacAboutMenuItemId(long val);
267 static void SetMacPreferencesMenuItemId(long val);
268 static void SetMacExitMenuItemId(long val);
269 static void SetMacHelpMenuTitleName(const wxString& val);
270
d14a1e28 271
6c3b4aae
RD
272 DocDeclStr(
273 void, _BootstrapApp(),
d07d2bc9 274 "For internal use only", "");
6c3b4aae
RD
275
276 DocStr(GetComCtl32Version,
dce2bd22 277 "Returns 400, 470, 471, etc. for comctl32.dll 4.00, 4.70, 4.71 or 0 if
d07d2bc9 278it wasn't found at all. Raises an exception on non-Windows platforms.", "");
d14a1e28 279#ifdef __WXMSW__
d14a1e28
RD
280 static int GetComCtl32Version();
281#else
282 %extend {
283 static int GetComCtl32Version()
81cfe5e1 284 { wxPyRaiseNotImplemented(); return 0; }
d14a1e28
RD
285 }
286#endif
287};
288
289
290
291//---------------------------------------------------------------------------
292%newgroup;
293
d14a1e28 294
6c3b4aae
RD
295DocDeclStr(
296 void, wxExit(),
d07d2bc9 297 "Force an exit of the application. Convenience for wx.GetApp().Exit()", "");
6c3b4aae
RD
298
299
300DocDeclStr(
301 bool, wxYield(),
d07d2bc9 302 "Yield to other apps/messages. Convenience for wx.GetApp().Yield()", "");
d14a1e28 303
6c3b4aae
RD
304DocDeclStr(
305 bool, wxYieldIfNeeded(),
d07d2bc9 306 "Yield to other apps/messages. Convenience for wx.GetApp().Yield(True)", "");
d14a1e28 307
d14a1e28 308
6c3b4aae 309DocDeclStr(
a72f4631 310 bool, wxSafeYield(wxWindow* win=NULL, bool onlyIfNeeded=false),
dce2bd22
RD
311 "This function is similar to `wx.Yield`, except that it disables the
312user input to all program windows before calling `wx.Yield` and
313re-enables it again afterwards. If ``win`` is not None, this window
314will remain enabled, allowing the implementation of some limited user
315interaction.
316
d07d2bc9 317:Returns: the result of the call to `wx.Yield`.", "");
6c3b4aae
RD
318
319
320DocDeclStr(
321 void, wxWakeUpIdle(),
dce2bd22 322 "Cause the message queue to become empty again, so idle events will be
d07d2bc9 323sent.", "");
6c3b4aae
RD
324
325
326DocDeclStr(
327 void, wxPostEvent(wxEvtHandler *dest, wxEvent& event),
dce2bd22 328 "Send an event to a window or other wx.EvtHandler to be processed
d07d2bc9 329later.", "");
6c3b4aae
RD
330
331
332DocStr(wxApp_CleanUp,
d07d2bc9
RD
333 "For internal use only, it is used to cleanup after wxWidgets when
334Python shuts down.", "");
d14a1e28
RD
335%inline %{
336 void wxApp_CleanUp() {
337 __wxPyCleanup();
338 }
339%}
340
6c3b4aae 341
c92d9283
RD
342DocDeclStrName(
343 wxPyApp* , wxPyGetApp(),
344 "Return a reference to the current wx.App object.", "",
345 GetApp);
346%{
347 wxPyApp* wxPyGetApp() { return (wxPyApp*)wxTheApp; }
d14a1e28
RD
348%}
349
350
c92d9283 351
d14a1e28
RD
352//---------------------------------------------------------------------------
353// Include some extra wxApp related python code here
354
355%pythoncode "_app_ex.py"
356
357//---------------------------------------------------------------------------
358