]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_functions.i
little tweaks to match recent CVS changes
[wxWidgets.git] / wxPython / src / _functions.i
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
18 MAKE_CONST_WXSTRING(FileSelectorPromptStr);
19 MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr);
20 MAKE_CONST_WXSTRING(DirSelectorPromptStr);
21
22 //---------------------------------------------------------------------------
23 %newgroup;
24
25
26 long wxNewId();
27 void wxRegisterId(long id);
28 long wxGetCurrentId();
29
30 MustHaveApp(wxBell);
31 void wxBell();
32
33 MustHaveApp(wxEndBusyCursor);
34 void wxEndBusyCursor();
35
36 long wxGetElapsedTime(bool resetTimer = True);
37
38 MustHaveApp(wxGetMousePosition);
39 DocDeclA(
40 void, wxGetMousePosition(int* OUTPUT, int* OUTPUT),
41 "GetMousePosition() -> (x,y)");
42
43 bool wxIsBusy();
44 wxString wxNow();
45 bool wxShell(const wxString& command = wxPyEmptyString);
46 void wxStartTimer();
47
48 DocDeclA(
49 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
50 "GetOsVersion() -> (platform, major, minor)");
51
52 wxString wxGetOsDescription();
53
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"
60 // int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
61
62 #if defined(__WXMSW__) || defined(__WXMAC__)
63 long wxGetFreeMemory();
64 #else
65 %inline %{
66 long wxGetFreeMemory()
67 { wxPyRaiseNotImplemented(); return 0; }
68 %}
69 #endif
70
71 enum wxShutdownFlags
72 {
73 wxSHUTDOWN_POWEROFF, // power off the computer
74 wxSHUTDOWN_REBOOT // shutdown and reboot
75 };
76
77 // Shutdown or reboot the PC
78 MustHaveApp(wxShutdown);
79 bool wxShutdown(wxShutdownFlags wFlags);
80
81
82 void wxSleep(int secs);
83 void wxMilliSleep(unsigned long milliseconds);
84 void wxMicroSleep(unsigned long microseconds);
85 %pythoncode { Usleep = MilliSleep }
86
87 void wxEnableTopLevelWindows(bool enable);
88
89 wxString wxStripMenuCodes(const wxString& in);
90
91
92 wxString wxGetEmailAddress();
93 wxString wxGetHostName();
94 wxString wxGetFullHostName();
95 wxString wxGetUserId();
96 wxString wxGetUserName();
97 wxString wxGetHomeDir();
98 wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
99
100 unsigned long wxGetProcessId();
101
102 void wxTrap();
103
104
105 // Dialog Functions
106
107 MustHaveApp(wxFileSelector);
108 wxString 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
121 MustHaveApp(wxLoadFileSelector);
122 wxString 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
128 MustHaveApp(wxSaveFileSelector);
129 wxString wxSaveFileSelector(const wxString& what,
130 const wxString& extension,
131 const wxString& default_name = wxPyEmptyString,
132 wxWindow *parent = NULL);
133
134
135 MustHaveApp(wxDirSelector);
136 wxString 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
142 MustHaveApp(wxGetTextFromUser);
143 wxString 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,
148 bool centre = True);
149
150 MustHaveApp(wxGetPasswordFromUser);
151 wxString 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,
162 // bool centre = True, int width=150, int height=200);
163
164
165 MustHaveApp(wxGetSingleChoice);
166 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
167 int choices, wxString* choices_array,
168 wxWindow *parent = NULL,
169 int x = -1, int y = -1,
170 bool centre = True,
171 int width=150, int height=200);
172
173 MustHaveApp(wxGetSingleChoiceIndex);
174 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
175 int choices, wxString* choices_array,
176 wxWindow *parent = NULL,
177 int x = -1, int y = -1,
178 bool centre = True,
179 int width=150, int height=200);
180
181
182 MustHaveApp(wxMessageBox);
183 int 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
189 MustHaveApp(wxGetNumberFromUser);
190 long 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
200 MustHaveApp(wxColourDisplay);
201 bool wxColourDisplay();
202
203 MustHaveApp(wxDisplayDepth);
204 int wxDisplayDepth();
205
206 MustHaveApp(wxGetDisplayDepth);
207 int wxGetDisplayDepth();
208
209 MustHaveApp(wxDisplaySize);
210 DocDeclA(
211 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
212 "DisplaySize() -> (width, height)");
213
214 MustHaveApp(wxGetDisplaySize);
215 wxSize wxGetDisplaySize();
216
217 MustHaveApp(wxDisplaySizeMM);
218 DocDeclA(
219 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
220 "DisplaySizeMM() -> (width, height)");
221
222 MustHaveApp(wxGetDisplaySizeMM);
223 wxSize wxGetDisplaySizeMM();
224
225 MustHaveApp(wxClientDisplayRect);
226 DocDeclA(
227 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
228 "ClientDisplayRect() -> (x, y, width, height)");
229
230 MustHaveApp(wxGetClientDisplayRect);
231 wxRect wxGetClientDisplayRect();
232
233
234 MustHaveApp(wxSetCursor);
235 void wxSetCursor(wxCursor& cursor);
236
237
238
239 // Miscellaneous functions
240
241 MustHaveApp(wxBeginBusyCursor);
242 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
243
244 MustHaveApp(wxGetActiveWindow);
245 wxWindow * wxGetActiveWindow();
246
247 MustHaveApp(wxGenericFindWindowAtPoint);
248 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
249
250 MustHaveApp(wxFindWindowAtPoint);
251 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
252
253 MustHaveApp(wxGetTopLevelParent);
254 wxWindow* wxGetTopLevelParent(wxWindow *win);
255
256 //bool wxSpawnBrowser(wxWindow *parent, wxString href);
257
258
259
260
261 MustHaveApp(wxGetKeyState);
262 DocDeclStr(
263 bool , wxGetKeyState(wxKeyCode key),
264 "Get the state of a key (true if pressed or toggled on, false if not.)
265 This is generally most useful getting the state of the modifier or
266 toggle keys. On some platforms those may be the only keys that work.
267 ", "");
268
269
270
271 //---------------------------------------------------------------------------
272
273 MustHaveApp(wxWakeUpMainThread);
274
275 #if defined(__WXMSW__) || defined(__WXMAC__)
276 void wxWakeUpMainThread();
277 #else
278 %inline %{
279 void wxWakeUpMainThread() {}
280 %}
281 #endif
282
283
284 MustHaveApp(wxMutexGuiEnter);
285 void wxMutexGuiEnter();
286
287 MustHaveApp(wxMutexGuiLeave);
288 void wxMutexGuiLeave();
289
290
291 MustHaveApp(wxMutexGuiLocker);
292 class wxMutexGuiLocker {
293 public:
294 wxMutexGuiLocker();
295 ~wxMutexGuiLocker();
296 };
297
298
299 MustHaveApp(wxThread);
300 %inline %{
301 bool wxThread_IsMain() {
302 #ifdef WXP_WITH_THREAD
303 return wxThread::IsMain();
304 #else
305 return True;
306 #endif
307 }
308 %}
309
310 //---------------------------------------------------------------------------
311 //---------------------------------------------------------------------------