]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_functions.i
Allow for Cmd-click on wxMac
[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);
83void wxUsleep(unsigned long milliseconds);
84void wxEnableTopLevelWindows(bool enable);
85
86wxString wxStripMenuCodes(const wxString& in);
87
88
89wxString wxGetEmailAddress();
90wxString wxGetHostName();
91wxString wxGetFullHostName();
92wxString wxGetUserId();
93wxString wxGetUserName();
94wxString wxGetHomeDir();
95wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
96
97unsigned long wxGetProcessId();
98
99void wxTrap();
100
101
102// Dialog Functions
103
ab1f7d2a 104MustHaveApp(wxFileSelector);
d14a1e28
RD
105wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
106 const wxString& default_path = wxPyEmptyString,
107 const wxString& default_filename = wxPyEmptyString,
108 const wxString& default_extension = wxPyEmptyString,
109 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
110 int flags = 0,
111 wxWindow *parent = NULL,
112 int x = -1, int y = -1);
113
114// TODO: wxFileSelectorEx
115
116
117// Ask for filename to load
ab1f7d2a 118MustHaveApp(wxLoadFileSelector);
d14a1e28
RD
119wxString wxLoadFileSelector(const wxString& what,
120 const wxString& extension,
121 const wxString& default_name = wxPyEmptyString,
122 wxWindow *parent = NULL);
123
124// Ask for filename to save
ab1f7d2a 125MustHaveApp(wxSaveFileSelector);
d14a1e28
RD
126wxString wxSaveFileSelector(const wxString& what,
127 const wxString& extension,
128 const wxString& default_name = wxPyEmptyString,
129 wxWindow *parent = NULL);
130
131
ab1f7d2a 132MustHaveApp(wxDirSelector);
d14a1e28
RD
133wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
134 const wxString& defaultPath = wxPyEmptyString,
135 long style = wxDD_DEFAULT_STYLE,
136 const wxPoint& pos = wxDefaultPosition,
137 wxWindow *parent = NULL);
138
ab1f7d2a 139MustHaveApp(wxGetTextFromUser);
d14a1e28
RD
140wxString wxGetTextFromUser(const wxString& message,
141 const wxString& caption = wxPyEmptyString,
142 const wxString& default_value = wxPyEmptyString,
143 wxWindow *parent = NULL,
144 int x = -1, int y = -1,
dd9f7fea 145 bool centre = True);
d14a1e28 146
ab1f7d2a 147MustHaveApp(wxGetPasswordFromUser);
d14a1e28
RD
148wxString wxGetPasswordFromUser(const wxString& message,
149 const wxString& caption = wxPyEmptyString,
150 const wxString& default_value = wxPyEmptyString,
151 wxWindow *parent = NULL);
152
153
154// TODO: Need to custom wrap this one...
155// int wxGetMultipleChoice(char* message, char* caption,
156// int LCOUNT, char** choices,
157// int nsel, int *selection,
158// wxWindow *parent = NULL, int x = -1, int y = -1,
dd9f7fea 159// bool centre = True, int width=150, int height=200);
d14a1e28
RD
160
161
ab1f7d2a 162MustHaveApp(wxGetSingleChoice);
d14a1e28
RD
163wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
164 int choices, wxString* choices_array,
165 wxWindow *parent = NULL,
166 int x = -1, int y = -1,
dd9f7fea 167 bool centre = True,
d14a1e28
RD
168 int width=150, int height=200);
169
ab1f7d2a 170MustHaveApp(wxGetSingleChoiceIndex);
d14a1e28
RD
171int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
172 int choices, wxString* choices_array,
173 wxWindow *parent = NULL,
174 int x = -1, int y = -1,
dd9f7fea 175 bool centre = True,
d14a1e28
RD
176 int width=150, int height=200);
177
178
ab1f7d2a 179MustHaveApp(wxMessageBox);
d14a1e28
RD
180int wxMessageBox(const wxString& message,
181 const wxString& caption = wxPyEmptyString,
182 int style = wxOK | wxCENTRE,
183 wxWindow *parent = NULL,
184 int x = -1, int y = -1);
185
ab1f7d2a 186MustHaveApp(wxGetNumberFromUser);
d14a1e28
RD
187long wxGetNumberFromUser(const wxString& message,
188 const wxString& prompt,
189 const wxString& caption,
190 long value,
191 long min = 0, long max = 100,
192 wxWindow *parent = NULL,
193 const wxPoint& pos = wxDefaultPosition);
194
195// GDI Functions
196
ab1f7d2a 197MustHaveApp(wxColourDisplay);
d14a1e28
RD
198bool wxColourDisplay();
199
ab1f7d2a 200MustHaveApp(wxDisplayDepth);
d14a1e28 201int wxDisplayDepth();
ab1f7d2a
RD
202
203MustHaveApp(wxGetDisplayDepth);
d14a1e28
RD
204int wxGetDisplayDepth();
205
ab1f7d2a 206MustHaveApp(wxDisplaySize);
322913ce
RD
207DocDeclA(
208 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
209 "DisplaySize() -> (width, height)");
ab1f7d2a
RD
210
211MustHaveApp(wxGetDisplaySize);
d14a1e28
RD
212wxSize wxGetDisplaySize();
213
ab1f7d2a 214MustHaveApp(wxDisplaySizeMM);
322913ce
RD
215DocDeclA(
216 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
217 "DisplaySizeMM() -> (width, height)");
ab1f7d2a
RD
218
219MustHaveApp(wxGetDisplaySizeMM);
d14a1e28
RD
220wxSize wxGetDisplaySizeMM();
221
ab1f7d2a 222MustHaveApp(wxClientDisplayRect);
322913ce
RD
223DocDeclA(
224 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
225 "ClientDisplayRect() -> (x, y, width, height)");
ab1f7d2a
RD
226
227MustHaveApp(wxGetClientDisplayRect);
d14a1e28
RD
228wxRect wxGetClientDisplayRect();
229
ab1f7d2a
RD
230
231MustHaveApp(wxSetCursor);
d14a1e28
RD
232void wxSetCursor(wxCursor& cursor);
233
234
235
236// Miscellaneous functions
237
ab1f7d2a 238MustHaveApp(wxBeginBusyCursor);
d14a1e28 239void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
ab1f7d2a
RD
240
241MustHaveApp(wxGetActiveWindow);
d14a1e28
RD
242wxWindow * wxGetActiveWindow();
243
ab1f7d2a 244MustHaveApp(wxGenericFindWindowAtPoint);
d14a1e28 245wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
ab1f7d2a
RD
246
247MustHaveApp(wxFindWindowAtPoint);
d14a1e28
RD
248wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
249
ab1f7d2a 250MustHaveApp(wxGetTopLevelParent);
d14a1e28
RD
251wxWindow* wxGetTopLevelParent(wxWindow *win);
252
253//bool wxSpawnBrowser(wxWindow *parent, wxString href);
254
255
256
89c876de 257
ab1f7d2a 258MustHaveApp(wxGetKeyState);
ad411ab2
RD
259DocDeclStr(
260 bool , wxGetKeyState(wxKeyCode key),
261 "Get the state of a key (true if pressed or toggled on, false if not.)
262This is generally most useful getting the state of the modifier or
263toggle keys. On some platforms those may be the only keys that work.
264", "");
265
57b1892f
RD
266
267
d14a1e28
RD
268//---------------------------------------------------------------------------
269
ab1f7d2a
RD
270MustHaveApp(wxWakeUpMainThread);
271
d14a1e28
RD
272#if defined(__WXMSW__) || defined(__WXMAC__)
273void wxWakeUpMainThread();
274#else
275%inline %{
276 void wxWakeUpMainThread() {}
277%}
278#endif
279
ab1f7d2a
RD
280
281MustHaveApp(wxMutexGuiEnter);
d14a1e28 282void wxMutexGuiEnter();
ab1f7d2a
RD
283
284MustHaveApp(wxMutexGuiLeave);
d14a1e28
RD
285void wxMutexGuiLeave();
286
287
ab1f7d2a 288MustHaveApp(wxMutexGuiLocker);
d14a1e28
RD
289class wxMutexGuiLocker {
290public:
291 wxMutexGuiLocker();
292 ~wxMutexGuiLocker();
293};
294
295
ab1f7d2a 296MustHaveApp(wxThread);
d14a1e28
RD
297%inline %{
298 bool wxThread_IsMain() {
299#ifdef WXP_WITH_THREAD
300 return wxThread::IsMain();
301#else
dd9f7fea 302 return True;
d14a1e28
RD
303#endif
304 }
305%}
306
307//---------------------------------------------------------------------------
308//---------------------------------------------------------------------------