]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_functions.i
Allow for Cmd-click on wxMac
[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 wxUsleep(unsigned long milliseconds);
84 void wxEnableTopLevelWindows(bool enable);
85
86 wxString wxStripMenuCodes(const wxString& in);
87
88
89 wxString wxGetEmailAddress();
90 wxString wxGetHostName();
91 wxString wxGetFullHostName();
92 wxString wxGetUserId();
93 wxString wxGetUserName();
94 wxString wxGetHomeDir();
95 wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
96
97 unsigned long wxGetProcessId();
98
99 void wxTrap();
100
101
102 // Dialog Functions
103
104 MustHaveApp(wxFileSelector);
105 wxString 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
118 MustHaveApp(wxLoadFileSelector);
119 wxString 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
125 MustHaveApp(wxSaveFileSelector);
126 wxString wxSaveFileSelector(const wxString& what,
127 const wxString& extension,
128 const wxString& default_name = wxPyEmptyString,
129 wxWindow *parent = NULL);
130
131
132 MustHaveApp(wxDirSelector);
133 wxString 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
139 MustHaveApp(wxGetTextFromUser);
140 wxString 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,
145 bool centre = True);
146
147 MustHaveApp(wxGetPasswordFromUser);
148 wxString 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,
159 // bool centre = True, int width=150, int height=200);
160
161
162 MustHaveApp(wxGetSingleChoice);
163 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
164 int choices, wxString* choices_array,
165 wxWindow *parent = NULL,
166 int x = -1, int y = -1,
167 bool centre = True,
168 int width=150, int height=200);
169
170 MustHaveApp(wxGetSingleChoiceIndex);
171 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
172 int choices, wxString* choices_array,
173 wxWindow *parent = NULL,
174 int x = -1, int y = -1,
175 bool centre = True,
176 int width=150, int height=200);
177
178
179 MustHaveApp(wxMessageBox);
180 int 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
186 MustHaveApp(wxGetNumberFromUser);
187 long 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
197 MustHaveApp(wxColourDisplay);
198 bool wxColourDisplay();
199
200 MustHaveApp(wxDisplayDepth);
201 int wxDisplayDepth();
202
203 MustHaveApp(wxGetDisplayDepth);
204 int wxGetDisplayDepth();
205
206 MustHaveApp(wxDisplaySize);
207 DocDeclA(
208 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
209 "DisplaySize() -> (width, height)");
210
211 MustHaveApp(wxGetDisplaySize);
212 wxSize wxGetDisplaySize();
213
214 MustHaveApp(wxDisplaySizeMM);
215 DocDeclA(
216 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
217 "DisplaySizeMM() -> (width, height)");
218
219 MustHaveApp(wxGetDisplaySizeMM);
220 wxSize wxGetDisplaySizeMM();
221
222 MustHaveApp(wxClientDisplayRect);
223 DocDeclA(
224 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
225 "ClientDisplayRect() -> (x, y, width, height)");
226
227 MustHaveApp(wxGetClientDisplayRect);
228 wxRect wxGetClientDisplayRect();
229
230
231 MustHaveApp(wxSetCursor);
232 void wxSetCursor(wxCursor& cursor);
233
234
235
236 // Miscellaneous functions
237
238 MustHaveApp(wxBeginBusyCursor);
239 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
240
241 MustHaveApp(wxGetActiveWindow);
242 wxWindow * wxGetActiveWindow();
243
244 MustHaveApp(wxGenericFindWindowAtPoint);
245 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
246
247 MustHaveApp(wxFindWindowAtPoint);
248 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
249
250 MustHaveApp(wxGetTopLevelParent);
251 wxWindow* wxGetTopLevelParent(wxWindow *win);
252
253 //bool wxSpawnBrowser(wxWindow *parent, wxString href);
254
255
256
257
258 MustHaveApp(wxGetKeyState);
259 DocDeclStr(
260 bool , wxGetKeyState(wxKeyCode key),
261 "Get the state of a key (true if pressed or toggled on, false if not.)
262 This is generally most useful getting the state of the modifier or
263 toggle keys. On some platforms those may be the only keys that work.
264 ", "");
265
266
267
268 //---------------------------------------------------------------------------
269
270 MustHaveApp(wxWakeUpMainThread);
271
272 #if defined(__WXMSW__) || defined(__WXMAC__)
273 void wxWakeUpMainThread();
274 #else
275 %inline %{
276 void wxWakeUpMainThread() {}
277 %}
278 #endif
279
280
281 MustHaveApp(wxMutexGuiEnter);
282 void wxMutexGuiEnter();
283
284 MustHaveApp(wxMutexGuiLeave);
285 void wxMutexGuiLeave();
286
287
288 MustHaveApp(wxMutexGuiLocker);
289 class wxMutexGuiLocker {
290 public:
291 wxMutexGuiLocker();
292 ~wxMutexGuiLocker();
293 };
294
295
296 MustHaveApp(wxThread);
297 %inline %{
298 bool wxThread_IsMain() {
299 #ifdef WXP_WITH_THREAD
300 return wxThread::IsMain();
301 #else
302 return True;
303 #endif
304 }
305 %}
306
307 //---------------------------------------------------------------------------
308 //---------------------------------------------------------------------------