]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/src/_functions.i
AUI under wxMGL build fixes.
[wxWidgets.git] / wxPython / src / _functions.i
... / ...
CommitLineData
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
16%{
17#include <wx/stockitem.h>
18%}
19
20//---------------------------------------------------------------------------
21
22MAKE_CONST_WXSTRING(FileSelectorPromptStr);
23MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr);
24MAKE_CONST_WXSTRING(DirSelectorPromptStr);
25
26//---------------------------------------------------------------------------
27%newgroup;
28
29
30long wxNewId();
31void wxRegisterId(long id);
32long wxGetCurrentId();
33
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):
43wxString wxGetStockLabel(wxWindowID id,
44 bool withCodes = true,
45 wxString accelerator = wxPyEmptyString);
46
47
48MustHaveApp(wxBell);
49void wxBell();
50
51MustHaveApp(wxEndBusyCursor);
52void wxEndBusyCursor();
53
54long wxGetElapsedTime(bool resetTimer = true);
55%pythoncode { GetElapsedTime = wx._deprecated(GetElapsedTime) }
56
57bool wxIsBusy();
58wxString wxNow();
59bool wxShell(const wxString& command = wxPyEmptyString);
60void wxStartTimer();
61
62DocDeclA(
63 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
64 "GetOsVersion() -> (platform, major, minor)");
65
66wxString wxGetOsDescription();
67
68// TODO:
69// // Parses the wildCard, returning the number of filters.
70// // Returns 0 if none or if there's a problem,
71// // The arrays will contain an equal number of items found before the error.
72// // wildCard is in the form:
73// // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
74// int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
75
76#if defined(__WXMSW__) || defined(__WXMAC__)
77wxMemorySize wxGetFreeMemory();
78#else
79%inline %{
80 wxMemorySize wxGetFreeMemory()
81 { wxPyRaiseNotImplemented(); return 0; }
82%}
83#endif
84
85enum wxShutdownFlags
86{
87 wxSHUTDOWN_POWEROFF, // power off the computer
88 wxSHUTDOWN_REBOOT // shutdown and reboot
89};
90
91// Shutdown or reboot the PC
92MustHaveApp(wxShutdown);
93bool wxShutdown(wxShutdownFlags wFlags);
94
95
96void wxSleep(int secs);
97void wxMilliSleep(unsigned long milliseconds);
98void wxMicroSleep(unsigned long microseconds);
99%pythoncode { Usleep = MilliSleep }
100
101void wxEnableTopLevelWindows(bool enable);
102
103wxString wxStripMenuCodes(const wxString& in);
104
105
106wxString wxGetEmailAddress();
107wxString wxGetHostName();
108wxString wxGetFullHostName();
109wxString wxGetUserId();
110wxString wxGetUserName();
111wxString wxGetHomeDir();
112wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
113
114unsigned long wxGetProcessId();
115
116void wxTrap();
117
118
119// Dialog Functions
120
121MustHaveApp(wxFileSelector);
122wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
123 const wxString& default_path = wxPyEmptyString,
124 const wxString& default_filename = wxPyEmptyString,
125 const wxString& default_extension = wxPyEmptyString,
126 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
127 int flags = 0,
128 wxWindow *parent = NULL,
129 int x = -1, int y = -1);
130
131// TODO: wxFileSelectorEx
132
133
134// Ask for filename to load
135MustHaveApp(wxLoadFileSelector);
136wxString wxLoadFileSelector(const wxString& what,
137 const wxString& extension,
138 const wxString& default_name = wxPyEmptyString,
139 wxWindow *parent = NULL);
140
141// Ask for filename to save
142MustHaveApp(wxSaveFileSelector);
143wxString wxSaveFileSelector(const wxString& what,
144 const wxString& extension,
145 const wxString& default_name = wxPyEmptyString,
146 wxWindow *parent = NULL);
147
148
149MustHaveApp(wxDirSelector);
150wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
151 const wxString& defaultPath = wxPyEmptyString,
152 long style = wxDD_DEFAULT_STYLE,
153 const wxPoint& pos = wxDefaultPosition,
154 wxWindow *parent = NULL);
155
156MustHaveApp(wxGetTextFromUser);
157wxString wxGetTextFromUser(const wxString& message,
158 const wxString& caption = wxPyEmptyString,
159 const wxString& default_value = wxPyEmptyString,
160 wxWindow *parent = NULL,
161 int x = -1, int y = -1,
162 bool centre = true);
163
164MustHaveApp(wxGetPasswordFromUser);
165wxString wxGetPasswordFromUser(const wxString& message,
166 const wxString& caption = wxPyEmptyString,
167 const wxString& default_value = wxPyEmptyString,
168 wxWindow *parent = NULL);
169
170
171// TODO: Need to custom wrap this one...
172// int wxGetMultipleChoice(char* message, char* caption,
173// int LCOUNT, char** choices,
174// int nsel, int *selection,
175// wxWindow *parent = NULL, int x = -1, int y = -1,
176// bool centre = true, int width=150, int height=200);
177
178
179MustHaveApp(wxGetSingleChoice);
180wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
181 int choices, wxString* choices_array,
182 wxWindow *parent = NULL,
183 int x = -1, int y = -1,
184 bool centre = true,
185 int width=150, int height=200);
186
187MustHaveApp(wxGetSingleChoiceIndex);
188int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
189 int choices, wxString* choices_array,
190 wxWindow *parent = NULL,
191 int x = -1, int y = -1,
192 bool centre = true,
193 int width=150, int height=200);
194
195
196MustHaveApp(wxMessageBox);
197int wxMessageBox(const wxString& message,
198 const wxString& caption = wxPyEmptyString,
199 int style = wxOK | wxCENTRE,
200 wxWindow *parent = NULL,
201 int x = -1, int y = -1);
202
203// WXWIN_COMPATIBILITY_2_4
204#if 0
205MustHaveApp(wxGetNumberFromUser);
206long wxGetNumberFromUser(const wxString& message,
207 const wxString& prompt,
208 const wxString& caption,
209 long value,
210 long min = 0, long max = 100,
211 wxWindow *parent = NULL,
212 const wxPoint& pos = wxDefaultPosition);
213%pythoncode { GetNumberFromUser = wx._deprecated(GetNumberFromUser) }
214#endif
215
216// GDI Functions
217
218MustHaveApp(wxColourDisplay);
219bool wxColourDisplay();
220
221MustHaveApp(wxDisplayDepth);
222int wxDisplayDepth();
223
224MustHaveApp(wxGetDisplayDepth);
225int wxGetDisplayDepth();
226
227MustHaveApp(wxDisplaySize);
228DocDeclA(
229 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
230 "DisplaySize() -> (width, height)");
231
232MustHaveApp(wxGetDisplaySize);
233wxSize wxGetDisplaySize();
234
235MustHaveApp(wxDisplaySizeMM);
236DocDeclA(
237 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
238 "DisplaySizeMM() -> (width, height)");
239
240MustHaveApp(wxGetDisplaySizeMM);
241wxSize wxGetDisplaySizeMM();
242
243MustHaveApp(wxClientDisplayRect);
244DocDeclA(
245 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
246 "ClientDisplayRect() -> (x, y, width, height)");
247
248MustHaveApp(wxGetClientDisplayRect);
249wxRect wxGetClientDisplayRect();
250
251
252MustHaveApp(wxSetCursor);
253void wxSetCursor(wxCursor& cursor);
254
255
256MustHaveApp(wxGetXDisplay);
257DocStr(wxGetXDisplay,
258"Returns a swigified pointer to the X11 display. Returns None on
259other platforms.", "");
260%inline %{
261 void* wxGetXDisplay()
262 {
263#ifdef __WXGTK__
264 return wxGetDisplay();
265#else
266 return NULL;
267#endif
268 }
269%}
270
271
272// Miscellaneous functions
273
274MustHaveApp(wxBeginBusyCursor);
275void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
276
277
278MustHaveApp(wxGetMousePosition);
279DocDeclStr(
280 wxPoint, wxGetMousePosition(),
281 "Get the current mouse position on the screen.", "");
282
283MustHaveApp(FindWindowAtPointer);
284DocStr(FindWindowAtPointer,
285 "Returns the window currently under the mouse pointer, if it belongs to
286 this application. Otherwise it returns None.", "");
287%inline %{
288 wxWindow* FindWindowAtPointer() {
289 wxPoint unused;
290 return wxFindWindowAtPointer(unused);
291 }
292%}
293
294
295MustHaveApp(wxGetActiveWindow);
296DocDeclStr(
297 wxWindow *, wxGetActiveWindow(),
298 "Get the currently active window of this application, or None", "");
299
300
301MustHaveApp(wxGenericFindWindowAtPoint);
302wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
303
304MustHaveApp(wxFindWindowAtPoint);
305wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
306
307MustHaveApp(wxGetTopLevelParent);
308wxWindow* wxGetTopLevelParent(wxWindow *win);
309
310
311DocDeclStr(
312 bool , wxLaunchDefaultBrowser(const wxString& url),
313 "Launches the user's default browser and tells it to open the location
314at ``url``. Returns ``True`` if the application was successfully
315launched.", "");
316
317
318
319MustHaveApp(wxGetKeyState);
320DocDeclStr(
321 bool , wxGetKeyState(wxKeyCode key),
322 "Get the state of a key (true if pressed or toggled on, false if not.)
323This is generally most useful getting the state of the modifier or
324toggle keys. On some platforms those may be the only keys that this
325function is able to detect.
326", "");
327
328
329
330//---------------------------------------------------------------------------
331
332DocStr(wxMouseState,
333"`wx.MouseState` is used to hold information about mouse button and
334modifier key states and is what is returned from `wx.GetMouseState`.",
335"");
336
337class wxMouseState
338{
339public:
340 wxMouseState();
341 ~wxMouseState();
342
343 wxCoord GetX();
344 wxCoord GetY();
345
346 bool LeftDown();
347 bool MiddleDown();
348 bool RightDown();
349
350 bool ControlDown();
351 bool ShiftDown();
352 bool AltDown();
353 bool MetaDown();
354 bool CmdDown();
355
356 void SetX(wxCoord x);
357 void SetY(wxCoord y);
358
359 void SetLeftDown(bool down);
360 void SetMiddleDown(bool down);
361 void SetRightDown(bool down);
362
363 void SetControlDown(bool down);
364 void SetShiftDown(bool down);
365 void SetAltDown(bool down);
366 void SetMetaDown(bool down);
367
368 %pythoncode {
369 x = property(GetX, SetX)
370 y = property(GetY, SetY)
371 leftDown = property(LeftDown, SetLeftDown)
372 middleDown = property(MiddleDown, SetMiddleDown)
373 rightDown = property(RightDown, SetRightDown)
374 controlDown = property(ControlDown, SetControlDown)
375 shiftDown = property(ShiftDown, SetShiftDown)
376 altDown = property(AltDown, SetAltDown)
377 metaDown = property(MetaDown, SetMetaDown)
378 cmdDown = property(CmdDown)
379 }
380};
381
382
383DocDeclStr(
384 wxMouseState , wxGetMouseState(),
385 "Returns the current state of the mouse. Returns an instance of a
386`wx.MouseState` object that contains the current position of the mouse
387pointer in screen coordinants, as well as boolean values indicating
388the up/down status of the mouse buttons and the modifier keys.", "");
389
390
391//---------------------------------------------------------------------------
392
393MustHaveApp(wxWakeUpMainThread);
394
395#if defined(__WXMSW__) || defined(__WXMAC__)
396void wxWakeUpMainThread();
397#else
398%inline %{
399 void wxWakeUpMainThread() {}
400%}
401#endif
402
403
404MustHaveApp(wxMutexGuiEnter);
405void wxMutexGuiEnter();
406
407MustHaveApp(wxMutexGuiLeave);
408void wxMutexGuiLeave();
409
410
411MustHaveApp(wxMutexGuiLocker);
412class wxMutexGuiLocker {
413public:
414 wxMutexGuiLocker();
415 ~wxMutexGuiLocker();
416};
417
418
419MustHaveApp(wxThread);
420%inline %{
421 bool wxThread_IsMain() {
422#ifdef WXP_WITH_THREAD
423 return wxThread::IsMain();
424#else
425 return true;
426#endif
427 }
428%}
429
430//---------------------------------------------------------------------------
431//---------------------------------------------------------------------------