]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_functions.i
HandlePrintClient shouldn't go above a top-level window
[wxWidgets.git] / wxPython / src / _functions.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _functions.i
3// Purpose: SWIG interface defs for various functions and such
4//
5// Author: Robin Dunn
6//
7// Created: 3-July-1997
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
1e140719
RD
16%{
17#include <wx/stockitem.h>
18%}
19
d14a1e28
RD
20//---------------------------------------------------------------------------
21
b2dc1044
RD
22MAKE_CONST_WXSTRING(FileSelectorPromptStr);
23MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr);
24MAKE_CONST_WXSTRING(DirSelectorPromptStr);
d14a1e28
RD
25
26//---------------------------------------------------------------------------
27%newgroup;
28
29
30long wxNewId();
31void wxRegisterId(long id);
32long wxGetCurrentId();
33
1e140719
RD
34// Returns true if the ID is in the list of recognized stock actions
35bool wxIsStockID(wxWindowID id);
36
37// Returns true of the label is empty or label of a stock button with
38// given ID
39bool wxIsStockLabel(wxWindowID id, const wxString& label);
40
41// Returns label that should be used for given stock UI element (e.g. "&OK"
42// for wxID_OK):
8815349a
RD
43wxString wxGetStockLabel(wxWindowID id,
44 bool withCodes = true,
45 wxString accelerator = wxPyEmptyString);
1e140719
RD
46
47
ab1f7d2a 48MustHaveApp(wxBell);
d14a1e28 49void wxBell();
ab1f7d2a
RD
50
51MustHaveApp(wxEndBusyCursor);
d14a1e28
RD
52void wxEndBusyCursor();
53
a72f4631 54long wxGetElapsedTime(bool resetTimer = true);
322913ce 55
ab1f7d2a 56MustHaveApp(wxGetMousePosition);
322913ce
RD
57DocDeclA(
58 void, wxGetMousePosition(int* OUTPUT, int* OUTPUT),
59 "GetMousePosition() -> (x,y)");
60
d14a1e28
RD
61bool wxIsBusy();
62wxString wxNow();
63bool wxShell(const wxString& command = wxPyEmptyString);
64void wxStartTimer();
322913ce
RD
65
66DocDeclA(
67 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
68 "GetOsVersion() -> (platform, major, minor)");
69
d14a1e28
RD
70wxString wxGetOsDescription();
71
03d51a2d
RD
72// TODO:
73// // Parses the wildCard, returning the number of filters.
74// // Returns 0 if none or if there's a problem,
75// // The arrays will contain an equal number of items found before the error.
76// // wildCard is in the form:
77// // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
daf32463 78// int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
03d51a2d 79
d14a1e28
RD
80#if defined(__WXMSW__) || defined(__WXMAC__)
81long wxGetFreeMemory();
82#else
83%inline %{
84 long wxGetFreeMemory()
81cfe5e1 85 { wxPyRaiseNotImplemented(); return 0; }
d14a1e28
RD
86%}
87#endif
88
89enum wxShutdownFlags
90{
91 wxSHUTDOWN_POWEROFF, // power off the computer
92 wxSHUTDOWN_REBOOT // shutdown and reboot
93};
94
95// Shutdown or reboot the PC
ab1f7d2a 96MustHaveApp(wxShutdown);
d14a1e28
RD
97bool wxShutdown(wxShutdownFlags wFlags);
98
99
100void wxSleep(int secs);
705b61cc
RD
101void wxMilliSleep(unsigned long milliseconds);
102void wxMicroSleep(unsigned long microseconds);
103%pythoncode { Usleep = MilliSleep }
104
d14a1e28
RD
105void wxEnableTopLevelWindows(bool enable);
106
107wxString wxStripMenuCodes(const wxString& in);
108
109
110wxString wxGetEmailAddress();
111wxString wxGetHostName();
112wxString wxGetFullHostName();
113wxString wxGetUserId();
114wxString wxGetUserName();
115wxString wxGetHomeDir();
116wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
117
118unsigned long wxGetProcessId();
119
120void wxTrap();
121
122
123// Dialog Functions
124
ab1f7d2a 125MustHaveApp(wxFileSelector);
d14a1e28
RD
126wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
127 const wxString& default_path = wxPyEmptyString,
128 const wxString& default_filename = wxPyEmptyString,
129 const wxString& default_extension = wxPyEmptyString,
130 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
131 int flags = 0,
132 wxWindow *parent = NULL,
133 int x = -1, int y = -1);
134
135// TODO: wxFileSelectorEx
136
137
138// Ask for filename to load
ab1f7d2a 139MustHaveApp(wxLoadFileSelector);
d14a1e28
RD
140wxString wxLoadFileSelector(const wxString& what,
141 const wxString& extension,
142 const wxString& default_name = wxPyEmptyString,
143 wxWindow *parent = NULL);
144
145// Ask for filename to save
ab1f7d2a 146MustHaveApp(wxSaveFileSelector);
d14a1e28
RD
147wxString wxSaveFileSelector(const wxString& what,
148 const wxString& extension,
149 const wxString& default_name = wxPyEmptyString,
150 wxWindow *parent = NULL);
151
152
ab1f7d2a 153MustHaveApp(wxDirSelector);
d14a1e28
RD
154wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
155 const wxString& defaultPath = wxPyEmptyString,
156 long style = wxDD_DEFAULT_STYLE,
157 const wxPoint& pos = wxDefaultPosition,
158 wxWindow *parent = NULL);
159
ab1f7d2a 160MustHaveApp(wxGetTextFromUser);
d14a1e28
RD
161wxString wxGetTextFromUser(const wxString& message,
162 const wxString& caption = wxPyEmptyString,
163 const wxString& default_value = wxPyEmptyString,
164 wxWindow *parent = NULL,
165 int x = -1, int y = -1,
a72f4631 166 bool centre = true);
d14a1e28 167
ab1f7d2a 168MustHaveApp(wxGetPasswordFromUser);
d14a1e28
RD
169wxString wxGetPasswordFromUser(const wxString& message,
170 const wxString& caption = wxPyEmptyString,
171 const wxString& default_value = wxPyEmptyString,
172 wxWindow *parent = NULL);
173
174
175// TODO: Need to custom wrap this one...
176// int wxGetMultipleChoice(char* message, char* caption,
177// int LCOUNT, char** choices,
178// int nsel, int *selection,
179// wxWindow *parent = NULL, int x = -1, int y = -1,
a72f4631 180// bool centre = true, int width=150, int height=200);
d14a1e28
RD
181
182
ab1f7d2a 183MustHaveApp(wxGetSingleChoice);
d14a1e28
RD
184wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
185 int choices, wxString* choices_array,
186 wxWindow *parent = NULL,
187 int x = -1, int y = -1,
a72f4631 188 bool centre = true,
d14a1e28
RD
189 int width=150, int height=200);
190
ab1f7d2a 191MustHaveApp(wxGetSingleChoiceIndex);
d14a1e28
RD
192int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
193 int choices, wxString* choices_array,
194 wxWindow *parent = NULL,
195 int x = -1, int y = -1,
a72f4631 196 bool centre = true,
d14a1e28
RD
197 int width=150, int height=200);
198
199
ab1f7d2a 200MustHaveApp(wxMessageBox);
d14a1e28
RD
201int wxMessageBox(const wxString& message,
202 const wxString& caption = wxPyEmptyString,
203 int style = wxOK | wxCENTRE,
204 wxWindow *parent = NULL,
205 int x = -1, int y = -1);
206
aeee37c3 207// WXWIN_COMPATIBILITY_2_4
ab1f7d2a 208MustHaveApp(wxGetNumberFromUser);
d14a1e28
RD
209long wxGetNumberFromUser(const wxString& message,
210 const wxString& prompt,
211 const wxString& caption,
212 long value,
213 long min = 0, long max = 100,
214 wxWindow *parent = NULL,
215 const wxPoint& pos = wxDefaultPosition);
216
217// GDI Functions
218
ab1f7d2a 219MustHaveApp(wxColourDisplay);
d14a1e28
RD
220bool wxColourDisplay();
221
ab1f7d2a 222MustHaveApp(wxDisplayDepth);
d14a1e28 223int wxDisplayDepth();
ab1f7d2a
RD
224
225MustHaveApp(wxGetDisplayDepth);
d14a1e28
RD
226int wxGetDisplayDepth();
227
ab1f7d2a 228MustHaveApp(wxDisplaySize);
322913ce
RD
229DocDeclA(
230 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
231 "DisplaySize() -> (width, height)");
ab1f7d2a
RD
232
233MustHaveApp(wxGetDisplaySize);
d14a1e28
RD
234wxSize wxGetDisplaySize();
235
ab1f7d2a 236MustHaveApp(wxDisplaySizeMM);
322913ce
RD
237DocDeclA(
238 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
239 "DisplaySizeMM() -> (width, height)");
ab1f7d2a
RD
240
241MustHaveApp(wxGetDisplaySizeMM);
d14a1e28
RD
242wxSize wxGetDisplaySizeMM();
243
ab1f7d2a 244MustHaveApp(wxClientDisplayRect);
322913ce
RD
245DocDeclA(
246 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
247 "ClientDisplayRect() -> (x, y, width, height)");
ab1f7d2a
RD
248
249MustHaveApp(wxGetClientDisplayRect);
d14a1e28
RD
250wxRect wxGetClientDisplayRect();
251
ab1f7d2a
RD
252
253MustHaveApp(wxSetCursor);
d14a1e28
RD
254void wxSetCursor(wxCursor& cursor);
255
256
257
258// Miscellaneous functions
259
ab1f7d2a 260MustHaveApp(wxBeginBusyCursor);
d14a1e28 261void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
ab1f7d2a
RD
262
263MustHaveApp(wxGetActiveWindow);
d14a1e28
RD
264wxWindow * wxGetActiveWindow();
265
ab1f7d2a 266MustHaveApp(wxGenericFindWindowAtPoint);
d14a1e28 267wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
ab1f7d2a
RD
268
269MustHaveApp(wxFindWindowAtPoint);
d14a1e28
RD
270wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
271
ab1f7d2a 272MustHaveApp(wxGetTopLevelParent);
d14a1e28
RD
273wxWindow* wxGetTopLevelParent(wxWindow *win);
274
d14a1e28 275
aa2fc802
RD
276DocDeclStr(
277 bool , wxLaunchDefaultBrowser(const wxString& url),
278 "Launches the user's default browser and tells it to open the location
279at ``url``. Returns ``True`` if the application was successfully
280launched.", "");
d14a1e28
RD
281
282
89c876de 283
ab1f7d2a 284MustHaveApp(wxGetKeyState);
ad411ab2
RD
285DocDeclStr(
286 bool , wxGetKeyState(wxKeyCode key),
287 "Get the state of a key (true if pressed or toggled on, false if not.)
288This is generally most useful getting the state of the modifier or
289toggle keys. On some platforms those may be the only keys that work.
290", "");
291
57b1892f
RD
292
293
d14a1e28
RD
294//---------------------------------------------------------------------------
295
ab1f7d2a
RD
296MustHaveApp(wxWakeUpMainThread);
297
d14a1e28
RD
298#if defined(__WXMSW__) || defined(__WXMAC__)
299void wxWakeUpMainThread();
300#else
301%inline %{
302 void wxWakeUpMainThread() {}
303%}
304#endif
305
ab1f7d2a
RD
306
307MustHaveApp(wxMutexGuiEnter);
d14a1e28 308void wxMutexGuiEnter();
ab1f7d2a
RD
309
310MustHaveApp(wxMutexGuiLeave);
d14a1e28
RD
311void wxMutexGuiLeave();
312
313
ab1f7d2a 314MustHaveApp(wxMutexGuiLocker);
d14a1e28
RD
315class wxMutexGuiLocker {
316public:
317 wxMutexGuiLocker();
318 ~wxMutexGuiLocker();
319};
320
321
ab1f7d2a 322MustHaveApp(wxThread);
d14a1e28
RD
323%inline %{
324 bool wxThread_IsMain() {
325#ifdef WXP_WITH_THREAD
326 return wxThread::IsMain();
327#else
a72f4631 328 return true;
d14a1e28
RD
329#endif
330 }
331%}
332
aeee37c3
RD
333//---------------------------------------------------------------------------
334
335// enum wxPowerType
336// {
337// wxPOWER_SOCKET,
338// wxPOWER_BATTERY,
339// wxPOWER_UNKNOWN
340// };
341
342// DocDeclStr(
343// wxPowerType , wxGetPowerType(),
344// "Returns the type of power source as one of wx.POWER_SOCKET,
345// wx.POWER_BATTERY or wx.POWER_UNKNOWN. wx.POWER_UNKNOWN is also the
346// default on platforms where this feature is not implemented.", "");
347
348
349// enum wxBatteryState
350// {
351// wxBATTERY_NORMAL_STATE, // system is fully usable
352// wxBATTERY_LOW_STATE, // start to worry
353// wxBATTERY_CRITICAL_STATE, // save quickly
354// wxBATTERY_SHUTDOWN_STATE, // too late
355// wxBATTERY_UNKNOWN_STATE
356// };
357
358// DocDeclStr(
359// wxBatteryState , wxGetBatteryState(),
360// "Returns battery state as one of wx.BATTERY_NORMAL_STATE,
361// wx.BATTERY_LOW_STATE}, wx.BATTERY_CRITICAL_STATE,
362// wx.BATTERY_SHUTDOWN_STATE or wx.BATTERY_UNKNOWN_STATE.
363// wx.BATTERY_UNKNOWN_STATE is also the default on platforms where this
364// feature is not implemented.", "");
365
366
367
d14a1e28
RD
368//---------------------------------------------------------------------------
369//---------------------------------------------------------------------------