]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_functions.i
Some error recovery and other tweaks
[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 void wxBell();
31 void wxEndBusyCursor();
32
33 long wxGetElapsedTime(bool resetTimer = True);
34
35 DocDeclA(
36 void, wxGetMousePosition(int* OUTPUT, int* OUTPUT),
37 "GetMousePosition() -> (x,y)");
38
39 bool wxIsBusy();
40 wxString wxNow();
41 bool wxShell(const wxString& command = wxPyEmptyString);
42 void wxStartTimer();
43
44 DocDeclA(
45 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
46 "GetOsVersion() -> (platform, major, minor)");
47
48 wxString wxGetOsDescription();
49
50 #if defined(__WXMSW__) || defined(__WXMAC__)
51 long wxGetFreeMemory();
52 #else
53 %inline %{
54 long wxGetFreeMemory()
55 { wxPyRaiseNotImplemented(); return 0; }
56 %}
57 #endif
58
59 enum wxShutdownFlags
60 {
61 wxSHUTDOWN_POWEROFF, // power off the computer
62 wxSHUTDOWN_REBOOT // shutdown and reboot
63 };
64
65 // Shutdown or reboot the PC
66 bool wxShutdown(wxShutdownFlags wFlags);
67
68
69 void wxSleep(int secs);
70 void wxUsleep(unsigned long milliseconds);
71 void wxEnableTopLevelWindows(bool enable);
72
73 wxString wxStripMenuCodes(const wxString& in);
74
75
76 wxString wxGetEmailAddress();
77 wxString wxGetHostName();
78 wxString wxGetFullHostName();
79 wxString wxGetUserId();
80 wxString wxGetUserName();
81 wxString wxGetHomeDir();
82 wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
83
84 unsigned long wxGetProcessId();
85
86 void wxTrap();
87
88
89 // Dialog Functions
90
91 wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
92 const wxString& default_path = wxPyEmptyString,
93 const wxString& default_filename = wxPyEmptyString,
94 const wxString& default_extension = wxPyEmptyString,
95 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
96 int flags = 0,
97 wxWindow *parent = NULL,
98 int x = -1, int y = -1);
99
100 // TODO: wxFileSelectorEx
101
102
103 // Ask for filename to load
104 wxString wxLoadFileSelector(const wxString& what,
105 const wxString& extension,
106 const wxString& default_name = wxPyEmptyString,
107 wxWindow *parent = NULL);
108
109 // Ask for filename to save
110 wxString wxSaveFileSelector(const wxString& what,
111 const wxString& extension,
112 const wxString& default_name = wxPyEmptyString,
113 wxWindow *parent = NULL);
114
115
116 wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
117 const wxString& defaultPath = wxPyEmptyString,
118 long style = wxDD_DEFAULT_STYLE,
119 const wxPoint& pos = wxDefaultPosition,
120 wxWindow *parent = NULL);
121
122 wxString wxGetTextFromUser(const wxString& message,
123 const wxString& caption = wxPyEmptyString,
124 const wxString& default_value = wxPyEmptyString,
125 wxWindow *parent = NULL,
126 int x = -1, int y = -1,
127 bool centre = True);
128
129 wxString wxGetPasswordFromUser(const wxString& message,
130 const wxString& caption = wxPyEmptyString,
131 const wxString& default_value = wxPyEmptyString,
132 wxWindow *parent = NULL);
133
134
135 // TODO: Need to custom wrap this one...
136 // int wxGetMultipleChoice(char* message, char* caption,
137 // int LCOUNT, char** choices,
138 // int nsel, int *selection,
139 // wxWindow *parent = NULL, int x = -1, int y = -1,
140 // bool centre = True, int width=150, int height=200);
141
142
143 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
144 int choices, wxString* choices_array,
145 wxWindow *parent = NULL,
146 int x = -1, int y = -1,
147 bool centre = True,
148 int width=150, int height=200);
149
150 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
151 int choices, wxString* choices_array,
152 wxWindow *parent = NULL,
153 int x = -1, int y = -1,
154 bool centre = True,
155 int width=150, int height=200);
156
157
158 int wxMessageBox(const wxString& message,
159 const wxString& caption = wxPyEmptyString,
160 int style = wxOK | wxCENTRE,
161 wxWindow *parent = NULL,
162 int x = -1, int y = -1);
163
164 long wxGetNumberFromUser(const wxString& message,
165 const wxString& prompt,
166 const wxString& caption,
167 long value,
168 long min = 0, long max = 100,
169 wxWindow *parent = NULL,
170 const wxPoint& pos = wxDefaultPosition);
171
172 // GDI Functions
173
174 bool wxColourDisplay();
175
176 int wxDisplayDepth();
177 int wxGetDisplayDepth();
178
179 DocDeclA(
180 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
181 "DisplaySize() -> (width, height)");
182 wxSize wxGetDisplaySize();
183
184 DocDeclA(
185 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
186 "DisplaySizeMM() -> (width, height)");
187 wxSize wxGetDisplaySizeMM();
188
189 DocDeclA(
190 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
191 "ClientDisplayRect() -> (x, y, width, height)");
192 wxRect wxGetClientDisplayRect();
193
194 void wxSetCursor(wxCursor& cursor);
195
196
197
198 // Miscellaneous functions
199
200 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
201 wxWindow * wxGetActiveWindow();
202
203 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
204 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
205
206 wxWindow* wxGetTopLevelParent(wxWindow *win);
207
208 //bool wxSpawnBrowser(wxWindow *parent, wxString href);
209
210
211
212
213 DocDeclStr(
214 bool , wxGetKeyState(wxKeyCode key),
215 "Get the state of a key (true if pressed or toggled on, false if not.)
216 This is generally most useful getting the state of the modifier or
217 toggle keys. On some platforms those may be the only keys that work.
218 ", "");
219
220
221
222 //---------------------------------------------------------------------------
223
224 #if defined(__WXMSW__) || defined(__WXMAC__)
225 void wxWakeUpMainThread();
226 #else
227 %inline %{
228 void wxWakeUpMainThread() {}
229 %}
230 #endif
231
232 void wxMutexGuiEnter();
233 void wxMutexGuiLeave();
234
235
236 class wxMutexGuiLocker {
237 public:
238 wxMutexGuiLocker();
239 ~wxMutexGuiLocker();
240 };
241
242
243 %inline %{
244 bool wxThread_IsMain() {
245 #ifdef WXP_WITH_THREAD
246 return wxThread::IsMain();
247 #else
248 return True;
249 #endif
250 }
251 %}
252
253 //---------------------------------------------------------------------------
254 //---------------------------------------------------------------------------