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