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