]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_functions.i
fixed TABs handling
[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
16//---------------------------------------------------------------------------
17
b2dc1044
RD
18MAKE_CONST_WXSTRING(FileSelectorPromptStr);
19MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr);
20MAKE_CONST_WXSTRING(DirSelectorPromptStr);
d14a1e28
RD
21
22//---------------------------------------------------------------------------
23%newgroup;
24
25
26long wxNewId();
27void wxRegisterId(long id);
28long wxGetCurrentId();
29
ab1f7d2a 30MustHaveApp(wxBell);
d14a1e28 31void wxBell();
ab1f7d2a
RD
32
33MustHaveApp(wxEndBusyCursor);
d14a1e28
RD
34void wxEndBusyCursor();
35
dd9f7fea 36long wxGetElapsedTime(bool resetTimer = True);
322913ce 37
ab1f7d2a 38MustHaveApp(wxGetMousePosition);
322913ce
RD
39DocDeclA(
40 void, wxGetMousePosition(int* OUTPUT, int* OUTPUT),
41 "GetMousePosition() -> (x,y)");
42
d14a1e28
RD
43bool wxIsBusy();
44wxString wxNow();
45bool wxShell(const wxString& command = wxPyEmptyString);
46void wxStartTimer();
322913ce
RD
47
48DocDeclA(
49 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
50 "GetOsVersion() -> (platform, major, minor)");
51
d14a1e28
RD
52wxString wxGetOsDescription();
53
03d51a2d
RD
54// TODO:
55// // Parses the wildCard, returning the number of filters.
56// // Returns 0 if none or if there's a problem,
57// // The arrays will contain an equal number of items found before the error.
58// // wildCard is in the form:
59// // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
daf32463 60// int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
03d51a2d 61
d14a1e28
RD
62#if defined(__WXMSW__) || defined(__WXMAC__)
63long wxGetFreeMemory();
64#else
65%inline %{
66 long wxGetFreeMemory()
81cfe5e1 67 { wxPyRaiseNotImplemented(); return 0; }
d14a1e28
RD
68%}
69#endif
70
71enum wxShutdownFlags
72{
73 wxSHUTDOWN_POWEROFF, // power off the computer
74 wxSHUTDOWN_REBOOT // shutdown and reboot
75};
76
77// Shutdown or reboot the PC
ab1f7d2a 78MustHaveApp(wxShutdown);
d14a1e28
RD
79bool wxShutdown(wxShutdownFlags wFlags);
80
81
82void wxSleep(int secs);
705b61cc
RD
83void wxMilliSleep(unsigned long milliseconds);
84void wxMicroSleep(unsigned long microseconds);
85%pythoncode { Usleep = MilliSleep }
86
d14a1e28
RD
87void wxEnableTopLevelWindows(bool enable);
88
89wxString wxStripMenuCodes(const wxString& in);
90
91
92wxString wxGetEmailAddress();
93wxString wxGetHostName();
94wxString wxGetFullHostName();
95wxString wxGetUserId();
96wxString wxGetUserName();
97wxString wxGetHomeDir();
98wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
99
100unsigned long wxGetProcessId();
101
102void wxTrap();
103
104
105// Dialog Functions
106
ab1f7d2a 107MustHaveApp(wxFileSelector);
d14a1e28
RD
108wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
109 const wxString& default_path = wxPyEmptyString,
110 const wxString& default_filename = wxPyEmptyString,
111 const wxString& default_extension = wxPyEmptyString,
112 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
113 int flags = 0,
114 wxWindow *parent = NULL,
115 int x = -1, int y = -1);
116
117// TODO: wxFileSelectorEx
118
119
120// Ask for filename to load
ab1f7d2a 121MustHaveApp(wxLoadFileSelector);
d14a1e28
RD
122wxString wxLoadFileSelector(const wxString& what,
123 const wxString& extension,
124 const wxString& default_name = wxPyEmptyString,
125 wxWindow *parent = NULL);
126
127// Ask for filename to save
ab1f7d2a 128MustHaveApp(wxSaveFileSelector);
d14a1e28
RD
129wxString wxSaveFileSelector(const wxString& what,
130 const wxString& extension,
131 const wxString& default_name = wxPyEmptyString,
132 wxWindow *parent = NULL);
133
134
ab1f7d2a 135MustHaveApp(wxDirSelector);
d14a1e28
RD
136wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
137 const wxString& defaultPath = wxPyEmptyString,
138 long style = wxDD_DEFAULT_STYLE,
139 const wxPoint& pos = wxDefaultPosition,
140 wxWindow *parent = NULL);
141
ab1f7d2a 142MustHaveApp(wxGetTextFromUser);
d14a1e28
RD
143wxString wxGetTextFromUser(const wxString& message,
144 const wxString& caption = wxPyEmptyString,
145 const wxString& default_value = wxPyEmptyString,
146 wxWindow *parent = NULL,
147 int x = -1, int y = -1,
dd9f7fea 148 bool centre = True);
d14a1e28 149
ab1f7d2a 150MustHaveApp(wxGetPasswordFromUser);
d14a1e28
RD
151wxString wxGetPasswordFromUser(const wxString& message,
152 const wxString& caption = wxPyEmptyString,
153 const wxString& default_value = wxPyEmptyString,
154 wxWindow *parent = NULL);
155
156
157// TODO: Need to custom wrap this one...
158// int wxGetMultipleChoice(char* message, char* caption,
159// int LCOUNT, char** choices,
160// int nsel, int *selection,
161// wxWindow *parent = NULL, int x = -1, int y = -1,
dd9f7fea 162// bool centre = True, int width=150, int height=200);
d14a1e28
RD
163
164
ab1f7d2a 165MustHaveApp(wxGetSingleChoice);
d14a1e28
RD
166wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
167 int choices, wxString* choices_array,
168 wxWindow *parent = NULL,
169 int x = -1, int y = -1,
dd9f7fea 170 bool centre = True,
d14a1e28
RD
171 int width=150, int height=200);
172
ab1f7d2a 173MustHaveApp(wxGetSingleChoiceIndex);
d14a1e28
RD
174int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
175 int choices, wxString* choices_array,
176 wxWindow *parent = NULL,
177 int x = -1, int y = -1,
dd9f7fea 178 bool centre = True,
d14a1e28
RD
179 int width=150, int height=200);
180
181
ab1f7d2a 182MustHaveApp(wxMessageBox);
d14a1e28
RD
183int wxMessageBox(const wxString& message,
184 const wxString& caption = wxPyEmptyString,
185 int style = wxOK | wxCENTRE,
186 wxWindow *parent = NULL,
187 int x = -1, int y = -1);
188
ab1f7d2a 189MustHaveApp(wxGetNumberFromUser);
d14a1e28
RD
190long wxGetNumberFromUser(const wxString& message,
191 const wxString& prompt,
192 const wxString& caption,
193 long value,
194 long min = 0, long max = 100,
195 wxWindow *parent = NULL,
196 const wxPoint& pos = wxDefaultPosition);
197
198// GDI Functions
199
ab1f7d2a 200MustHaveApp(wxColourDisplay);
d14a1e28
RD
201bool wxColourDisplay();
202
ab1f7d2a 203MustHaveApp(wxDisplayDepth);
d14a1e28 204int wxDisplayDepth();
ab1f7d2a
RD
205
206MustHaveApp(wxGetDisplayDepth);
d14a1e28
RD
207int wxGetDisplayDepth();
208
ab1f7d2a 209MustHaveApp(wxDisplaySize);
322913ce
RD
210DocDeclA(
211 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
212 "DisplaySize() -> (width, height)");
ab1f7d2a
RD
213
214MustHaveApp(wxGetDisplaySize);
d14a1e28
RD
215wxSize wxGetDisplaySize();
216
ab1f7d2a 217MustHaveApp(wxDisplaySizeMM);
322913ce
RD
218DocDeclA(
219 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
220 "DisplaySizeMM() -> (width, height)");
ab1f7d2a
RD
221
222MustHaveApp(wxGetDisplaySizeMM);
d14a1e28
RD
223wxSize wxGetDisplaySizeMM();
224
ab1f7d2a 225MustHaveApp(wxClientDisplayRect);
322913ce
RD
226DocDeclA(
227 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
228 "ClientDisplayRect() -> (x, y, width, height)");
ab1f7d2a
RD
229
230MustHaveApp(wxGetClientDisplayRect);
d14a1e28
RD
231wxRect wxGetClientDisplayRect();
232
ab1f7d2a
RD
233
234MustHaveApp(wxSetCursor);
d14a1e28
RD
235void wxSetCursor(wxCursor& cursor);
236
237
238
239// Miscellaneous functions
240
ab1f7d2a 241MustHaveApp(wxBeginBusyCursor);
d14a1e28 242void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
ab1f7d2a
RD
243
244MustHaveApp(wxGetActiveWindow);
d14a1e28
RD
245wxWindow * wxGetActiveWindow();
246
ab1f7d2a 247MustHaveApp(wxGenericFindWindowAtPoint);
d14a1e28 248wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
ab1f7d2a
RD
249
250MustHaveApp(wxFindWindowAtPoint);
d14a1e28
RD
251wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
252
ab1f7d2a 253MustHaveApp(wxGetTopLevelParent);
d14a1e28
RD
254wxWindow* wxGetTopLevelParent(wxWindow *win);
255
256//bool wxSpawnBrowser(wxWindow *parent, wxString href);
257
258
259
89c876de 260
ab1f7d2a 261MustHaveApp(wxGetKeyState);
ad411ab2
RD
262DocDeclStr(
263 bool , wxGetKeyState(wxKeyCode key),
264 "Get the state of a key (true if pressed or toggled on, false if not.)
265This is generally most useful getting the state of the modifier or
266toggle keys. On some platforms those may be the only keys that work.
267", "");
268
57b1892f
RD
269
270
d14a1e28
RD
271//---------------------------------------------------------------------------
272
ab1f7d2a
RD
273MustHaveApp(wxWakeUpMainThread);
274
d14a1e28
RD
275#if defined(__WXMSW__) || defined(__WXMAC__)
276void wxWakeUpMainThread();
277#else
278%inline %{
279 void wxWakeUpMainThread() {}
280%}
281#endif
282
ab1f7d2a
RD
283
284MustHaveApp(wxMutexGuiEnter);
d14a1e28 285void wxMutexGuiEnter();
ab1f7d2a
RD
286
287MustHaveApp(wxMutexGuiLeave);
d14a1e28
RD
288void wxMutexGuiLeave();
289
290
ab1f7d2a 291MustHaveApp(wxMutexGuiLocker);
d14a1e28
RD
292class wxMutexGuiLocker {
293public:
294 wxMutexGuiLocker();
295 ~wxMutexGuiLocker();
296};
297
298
ab1f7d2a 299MustHaveApp(wxThread);
d14a1e28
RD
300%inline %{
301 bool wxThread_IsMain() {
302#ifdef WXP_WITH_THREAD
303 return wxThread::IsMain();
304#else
dd9f7fea 305 return True;
d14a1e28
RD
306#endif
307 }
308%}
309
310//---------------------------------------------------------------------------
311//---------------------------------------------------------------------------