]>
Commit | Line | Data |
---|---|---|
bb0054cd RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: misc2.i | |
3 | // Purpose: Definitions of miscelaneous functions and classes that need | |
4 | // to know about wxWindow. (So they can't be in misc.i or an | |
5 | // import loop will happen.) | |
6 | // | |
7 | // Author: Robin Dunn | |
8 | // | |
9 | // Created: 18-June-1999 | |
10 | // RCS-ID: $Id$ | |
11 | // Copyright: (c) 1998 by Total Control Software | |
12 | // Licence: wxWindows license | |
13 | ///////////////////////////////////////////////////////////////////////////// | |
14 | ||
15 | %module misc2 | |
16 | ||
17 | %{ | |
18 | #include "helpers.h" | |
4152e8b9 | 19 | #include "pyistream.h" |
bb0054cd RD |
20 | #include <wx/resource.h> |
21 | #include <wx/tooltip.h> | |
f0261a72 | 22 | #include <wx/caret.h> |
f6bcfd97 | 23 | #include <wx/tipdlg.h> |
c368d904 | 24 | #include <wx/process.h> |
493f1553 RD |
25 | |
26 | #if wxUSE_JOYSTICK || defined(__WXMSW__) | |
185d7c3e | 27 | #include <wx/joystick.h> |
4662be59 | 28 | #endif |
493f1553 RD |
29 | |
30 | #if wxUSE_WAVE || defined(__WXMSW__) | |
31 | #include <wx/wave.h> | |
32 | #endif | |
b37c7e1d RD |
33 | |
34 | #include <wx/mimetype.h> | |
fd512ba2 RD |
35 | #include <wx/snglinst.h> |
36 | #include <wx/effects.h> | |
37 | //#include <wx/spawnbrowser.h> | |
bb0054cd RD |
38 | %} |
39 | ||
40 | //---------------------------------------------------------------------- | |
41 | ||
42 | %include typemaps.i | |
43 | %include my_typemaps.i | |
44 | ||
45 | // Import some definitions of other classes, etc. | |
46 | %import _defs.i | |
47 | %import windows.i | |
f0261a72 | 48 | %import misc.i |
06c0fba4 | 49 | %import gdi.i |
b1462dfa | 50 | %import events.i |
c368d904 | 51 | %import streams.i |
7dbce44a | 52 | %import utils.i |
06c0fba4 | 53 | |
b68dc582 | 54 | |
137b5242 RD |
55 | //---------------------------------------------------------------------- |
56 | ||
57 | %{ | |
58 | // Put some wx default wxChar* values into wxStrings. | |
59 | DECLARE_DEF_STRING(FileSelectorPromptStr); | |
60 | DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr); | |
7cdaed0b | 61 | DECLARE_DEF_STRING(DirSelectorPromptStr); |
137b5242 RD |
62 | static const wxString wxPyEmptyString(wxT("")); |
63 | %} | |
64 | ||
06c0fba4 RD |
65 | //--------------------------------------------------------------------------- |
66 | // Dialog Functions | |
67 | ||
137b5242 RD |
68 | wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr, |
69 | const wxString& default_path = wxPyEmptyString, | |
70 | const wxString& default_filename = wxPyEmptyString, | |
71 | const wxString& default_extension = wxPyEmptyString, | |
72 | const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr, | |
06c0fba4 RD |
73 | int flags = 0, |
74 | wxWindow *parent = NULL, | |
75 | int x = -1, int y = -1); | |
a541c325 RD |
76 | |
77 | // Ask for filename to load | |
137b5242 RD |
78 | wxString wxLoadFileSelector(const wxString& what, |
79 | const wxString& extension, | |
80 | const wxString& default_name = wxPyEmptyString, | |
a541c325 RD |
81 | wxWindow *parent = NULL); |
82 | ||
83 | // Ask for filename to save | |
137b5242 RD |
84 | wxString wxSaveFileSelector(const wxString& what, |
85 | const wxString& extension, | |
86 | const wxString& default_name = wxPyEmptyString, | |
a541c325 | 87 | wxWindow *parent = NULL); |
06c0fba4 | 88 | |
7cdaed0b RD |
89 | |
90 | wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr, | |
91 | const wxString& defaultPath = wxPyEmptyString, | |
daa3eac9 | 92 | long style = wxDD_DEFAULT_STYLE, |
7cdaed0b RD |
93 | const wxPoint& pos = wxDefaultPosition, |
94 | wxWindow *parent = NULL); | |
95 | ||
06c0fba4 | 96 | wxString wxGetTextFromUser(const wxString& message, |
137b5242 RD |
97 | const wxString& caption = wxPyEmptyString, |
98 | const wxString& default_value = wxPyEmptyString, | |
06c0fba4 RD |
99 | wxWindow *parent = NULL, |
100 | int x = -1, int y = -1, | |
101 | bool centre = TRUE); | |
102 | ||
1b62f00d | 103 | wxString wxGetPasswordFromUser(const wxString& message, |
137b5242 RD |
104 | const wxString& caption = wxPyEmptyString, |
105 | const wxString& default_value = wxPyEmptyString, | |
1b62f00d RD |
106 | wxWindow *parent = NULL); |
107 | ||
06c0fba4 RD |
108 | |
109 | // TODO: Need to custom wrap this one... | |
110 | // int wxGetMultipleChoice(char* message, char* caption, | |
eec92d76 | 111 | // int LCOUNT, char** choices, |
06c0fba4 RD |
112 | // int nsel, int *selection, |
113 | // wxWindow *parent = NULL, int x = -1, int y = -1, | |
114 | // bool centre = TRUE, int width=150, int height=200); | |
115 | ||
116 | ||
117 | wxString wxGetSingleChoice(const wxString& message, const wxString& caption, | |
eec92d76 | 118 | int LCOUNT, wxString* choices, |
06c0fba4 RD |
119 | wxWindow *parent = NULL, |
120 | int x = -1, int y = -1, | |
121 | bool centre = TRUE, | |
122 | int width=150, int height=200); | |
123 | ||
124 | int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, | |
eec92d76 | 125 | int LCOUNT, wxString* choices, |
06c0fba4 RD |
126 | wxWindow *parent = NULL, |
127 | int x = -1, int y = -1, | |
128 | bool centre = TRUE, | |
129 | int width=150, int height=200); | |
130 | ||
131 | ||
132 | int wxMessageBox(const wxString& message, | |
137b5242 | 133 | const wxString& caption = wxPyEmptyString, |
06c0fba4 RD |
134 | int style = wxOK | wxCENTRE, |
135 | wxWindow *parent = NULL, | |
136 | int x = -1, int y = -1); | |
137 | ||
138 | long wxGetNumberFromUser(const wxString& message, | |
139 | const wxString& prompt, | |
140 | const wxString& caption, | |
141 | long value, | |
142 | long min = 0, long max = 100, | |
143 | wxWindow *parent = NULL, | |
b68dc582 | 144 | const wxPoint& pos = wxDefaultPosition); |
06c0fba4 RD |
145 | |
146 | //--------------------------------------------------------------------------- | |
147 | // GDI Functions | |
148 | ||
149 | bool wxColourDisplay(); | |
1e7ecb7b | 150 | |
06c0fba4 | 151 | int wxDisplayDepth(); |
1e7ecb7b RD |
152 | int wxGetDisplayDepth(); |
153 | ||
ec5d7799 | 154 | void wxDisplaySize(int* OUTPUT, int* OUTPUT); |
1e7ecb7b | 155 | wxSize wxGetDisplaySize(); |
1b62f00d | 156 | |
ec5d7799 | 157 | void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT); |
1e7ecb7b RD |
158 | wxSize wxGetDisplaySizeMM(); |
159 | ||
ec5d7799 RD |
160 | void wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT); |
161 | wxRect wxGetClientDisplayRect(); | |
162 | ||
06c0fba4 | 163 | void wxSetCursor(wxCursor& cursor); |
bb0054cd RD |
164 | |
165 | //---------------------------------------------------------------------- | |
06c0fba4 | 166 | // Miscellaneous functions |
bb0054cd | 167 | |
06c0fba4 RD |
168 | void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR); |
169 | wxWindow * wxGetActiveWindow(); | |
170 | ||
493f1553 RD |
171 | wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); |
172 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt); | |
4dfaa61e RD |
173 | |
174 | #ifdef __WXMSW__ | |
493f1553 | 175 | bool wxCheckForInterrupt(wxWindow *wnd); |
4dfaa61e RD |
176 | void wxFlushEvents(); |
177 | #endif | |
06c0fba4 | 178 | |
2a74d141 RD |
179 | wxWindow* wxGetTopLevelParent(wxWindow *win); |
180 | ||
fd512ba2 RD |
181 | //bool wxSpawnBrowser(wxWindow *parent, wxString href); |
182 | ||
06c0fba4 RD |
183 | //--------------------------------------------------------------------------- |
184 | // Resource System | |
185 | ||
1e4a197e | 186 | #ifdef wxUSE_WX_RESOURCES |
137b5242 | 187 | bool wxResourceAddIdentifier(char* name, int value); |
06c0fba4 | 188 | void wxResourceClear(void); |
137b5242 RD |
189 | wxBitmap wxResourceCreateBitmap(char* resource); |
190 | wxIcon wxResourceCreateIcon(char* resource); | |
191 | wxMenuBar * wxResourceCreateMenuBar(char* resource); | |
192 | int wxResourceGetIdentifier(char* name); | |
193 | bool wxResourceParseData(char* resource, wxResourceTable *table = NULL); | |
194 | bool wxResourceParseFile(char* filename, wxResourceTable *table = NULL); | |
195 | bool wxResourceParseString(char* resource, wxResourceTable *table = NULL); | |
1e4a197e | 196 | #endif |
bb0054cd | 197 | |
06c0fba4 RD |
198 | //--------------------------------------------------------------------------- |
199 | // System Settings | |
200 | ||
b5a5d647 RD |
201 | // possible values for wxSystemSettings::GetFont() parameter |
202 | // | |
203 | enum wxSystemFont | |
204 | { | |
205 | wxSYS_OEM_FIXED_FONT = 10, | |
06c0fba4 RD |
206 | wxSYS_ANSI_FIXED_FONT, |
207 | wxSYS_ANSI_VAR_FONT, | |
208 | wxSYS_SYSTEM_FONT, | |
209 | wxSYS_DEVICE_DEFAULT_FONT, | |
210 | wxSYS_DEFAULT_PALETTE, | |
211 | wxSYS_SYSTEM_FIXED_FONT, | |
b5a5d647 RD |
212 | wxSYS_DEFAULT_GUI_FONT |
213 | }; | |
06c0fba4 | 214 | |
b5a5d647 RD |
215 | // possible values for wxSystemSettings::GetColour() parameter |
216 | // | |
217 | enum wxSystemColour | |
218 | { | |
06c0fba4 RD |
219 | wxSYS_COLOUR_SCROLLBAR, |
220 | wxSYS_COLOUR_BACKGROUND, | |
c6c593e8 | 221 | wxSYS_COLOUR_DESKTOP = wxSYS_COLOUR_BACKGROUND, |
06c0fba4 RD |
222 | wxSYS_COLOUR_ACTIVECAPTION, |
223 | wxSYS_COLOUR_INACTIVECAPTION, | |
224 | wxSYS_COLOUR_MENU, | |
225 | wxSYS_COLOUR_WINDOW, | |
226 | wxSYS_COLOUR_WINDOWFRAME, | |
227 | wxSYS_COLOUR_MENUTEXT, | |
228 | wxSYS_COLOUR_WINDOWTEXT, | |
229 | wxSYS_COLOUR_CAPTIONTEXT, | |
230 | wxSYS_COLOUR_ACTIVEBORDER, | |
231 | wxSYS_COLOUR_INACTIVEBORDER, | |
232 | wxSYS_COLOUR_APPWORKSPACE, | |
233 | wxSYS_COLOUR_HIGHLIGHT, | |
234 | wxSYS_COLOUR_HIGHLIGHTTEXT, | |
235 | wxSYS_COLOUR_BTNFACE, | |
c6c593e8 | 236 | wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE, |
06c0fba4 | 237 | wxSYS_COLOUR_BTNSHADOW, |
c6c593e8 | 238 | wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW, |
06c0fba4 RD |
239 | wxSYS_COLOUR_GRAYTEXT, |
240 | wxSYS_COLOUR_BTNTEXT, | |
241 | wxSYS_COLOUR_INACTIVECAPTIONTEXT, | |
242 | wxSYS_COLOUR_BTNHIGHLIGHT, | |
c6c593e8 RD |
243 | wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, |
244 | wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, | |
245 | wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT, | |
06c0fba4 RD |
246 | wxSYS_COLOUR_3DDKSHADOW, |
247 | wxSYS_COLOUR_3DLIGHT, | |
248 | wxSYS_COLOUR_INFOTEXT, | |
249 | wxSYS_COLOUR_INFOBK, | |
b5a5d647 | 250 | wxSYS_COLOUR_LISTBOX, |
c6c593e8 RD |
251 | wxSYS_COLOUR_HOTLIGHT, |
252 | wxSYS_COLOUR_GRADIENTACTIVECAPTION, | |
253 | wxSYS_COLOUR_GRADIENTINACTIVECAPTION, | |
254 | wxSYS_COLOUR_MENUHILIGHT, | |
255 | wxSYS_COLOUR_MENUBAR, | |
b5a5d647 | 256 | |
c6c593e8 | 257 | wxSYS_COLOUR_MAX |
b5a5d647 | 258 | }; |
06c0fba4 | 259 | |
b5a5d647 RD |
260 | // possible values for wxSystemSettings::GetMetric() parameter |
261 | // | |
262 | enum wxSystemMetric | |
263 | { | |
264 | wxSYS_MOUSE_BUTTONS = 1, | |
06c0fba4 RD |
265 | wxSYS_BORDER_X, |
266 | wxSYS_BORDER_Y, | |
267 | wxSYS_CURSOR_X, | |
268 | wxSYS_CURSOR_Y, | |
269 | wxSYS_DCLICK_X, | |
270 | wxSYS_DCLICK_Y, | |
271 | wxSYS_DRAG_X, | |
272 | wxSYS_DRAG_Y, | |
273 | wxSYS_EDGE_X, | |
274 | wxSYS_EDGE_Y, | |
275 | wxSYS_HSCROLL_ARROW_X, | |
276 | wxSYS_HSCROLL_ARROW_Y, | |
277 | wxSYS_HTHUMB_X, | |
278 | wxSYS_ICON_X, | |
279 | wxSYS_ICON_Y, | |
280 | wxSYS_ICONSPACING_X, | |
281 | wxSYS_ICONSPACING_Y, | |
282 | wxSYS_WINDOWMIN_X, | |
283 | wxSYS_WINDOWMIN_Y, | |
284 | wxSYS_SCREEN_X, | |
285 | wxSYS_SCREEN_Y, | |
286 | wxSYS_FRAMESIZE_X, | |
287 | wxSYS_FRAMESIZE_Y, | |
288 | wxSYS_SMALLICON_X, | |
289 | wxSYS_SMALLICON_Y, | |
290 | wxSYS_HSCROLL_Y, | |
291 | wxSYS_VSCROLL_X, | |
292 | wxSYS_VSCROLL_ARROW_X, | |
293 | wxSYS_VSCROLL_ARROW_Y, | |
294 | wxSYS_VTHUMB_Y, | |
295 | wxSYS_CAPTION_Y, | |
296 | wxSYS_MENU_Y, | |
297 | wxSYS_NETWORK_PRESENT, | |
298 | wxSYS_PENWINDOWS_PRESENT, | |
299 | wxSYS_SHOW_SOUNDS, | |
b5a5d647 | 300 | wxSYS_SWAP_BUTTONS |
06c0fba4 RD |
301 | }; |
302 | ||
b5a5d647 RD |
303 | // possible values for wxSystemSettings::HasFeature() parameter |
304 | enum wxSystemFeature | |
305 | { | |
306 | wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1, | |
307 | wxSYS_CAN_ICONIZE_FRAME | |
308 | }; | |
06c0fba4 | 309 | |
12bfbb29 | 310 | enum wxSystemScreenType |
daa3eac9 RD |
311 | { |
312 | wxSYS_SCREEN_NONE = 0, // not yet defined | |
12bfbb29 RD |
313 | |
314 | wxSYS_SCREEN_TINY, // < | |
daa3eac9 | 315 | wxSYS_SCREEN_PDA, // >= 320x240 |
12bfbb29 RD |
316 | wxSYS_SCREEN_SMALL, // >= 640x480 |
317 | wxSYS_SCREEN_DESKTOP // >= 800x600 | |
daa3eac9 | 318 | }; |
06c0fba4 | 319 | |
06c0fba4 | 320 | |
b5a5d647 RD |
321 | class wxSystemSettings { |
322 | public: | |
323 | // get a standard system colour | |
324 | static wxColour GetColour(wxSystemColour index); | |
325 | ||
326 | // get a standard system font | |
327 | static wxFont GetFont(wxSystemFont index); | |
328 | ||
329 | // get a system-dependent metric | |
330 | static int GetMetric(wxSystemMetric index); | |
331 | ||
332 | // return true if the port has certain feature | |
333 | static bool HasFeature(wxSystemFeature index); | |
334 | ||
0b85cc38 RD |
335 | // Get system screen design (desktop, pda, ..) used for |
336 | // laying out various dialogs. | |
12bfbb29 | 337 | static wxSystemScreenType GetScreenType(); |
daa3eac9 | 338 | |
0b85cc38 | 339 | // Override default. |
12bfbb29 | 340 | static void SetScreenType( wxSystemScreenType screen ); |
daa3eac9 | 341 | |
b5a5d647 | 342 | }; |
06c0fba4 | 343 | |
06c0fba4 | 344 | |
bb0054cd RD |
345 | |
346 | //--------------------------------------------------------------------------- | |
347 | // wxToolTip | |
348 | ||
9416aa89 | 349 | class wxToolTip : public wxObject { |
bb0054cd RD |
350 | public: |
351 | wxToolTip(const wxString &tip); | |
352 | ||
353 | void SetTip(const wxString& tip); | |
354 | wxString GetTip(); | |
355 | // *** Not in the "public" interface void SetWindow(wxWindow *win); | |
356 | wxWindow *GetWindow(); | |
bb0054cd | 357 | |
edf2f43e RD |
358 | static void Enable(bool flag); |
359 | static void SetDelay(long milliseconds); | |
360 | }; | |
bb0054cd RD |
361 | |
362 | //---------------------------------------------------------------------- | |
f0261a72 RD |
363 | |
364 | class wxCaret { | |
365 | public: | |
366 | wxCaret(wxWindow* window, const wxSize& size); | |
367 | ~wxCaret(); | |
368 | ||
369 | bool IsOk(); | |
370 | bool IsVisible(); | |
371 | %name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT); | |
372 | wxPoint GetPosition(); | |
373 | %name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT); | |
374 | wxSize GetSize(); | |
375 | wxWindow *GetWindow(); | |
376 | %name(MoveXY)void Move(int x, int y); | |
377 | void Move(const wxPoint& pt); | |
a1df7a95 RD |
378 | %name(SetSizeWH) void SetSize(int width, int height); |
379 | void SetSize(const wxSize& size); | |
f0261a72 RD |
380 | void Show(int show = TRUE); |
381 | void Hide(); | |
1fded56b RD |
382 | |
383 | %pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()" | |
f0261a72 RD |
384 | }; |
385 | ||
386 | %inline %{ | |
387 | int wxCaret_GetBlinkTime() { | |
388 | return wxCaret::GetBlinkTime(); | |
389 | } | |
390 | ||
391 | void wxCaret_SetBlinkTime(int milliseconds) { | |
392 | wxCaret::SetBlinkTime(milliseconds); | |
393 | } | |
394 | %} | |
395 | ||
bb0054cd | 396 | //---------------------------------------------------------------------- |
f0261a72 | 397 | |
2abc0a0f RD |
398 | class wxBusyCursor { |
399 | public: | |
400 | wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR); | |
401 | ~wxBusyCursor(); | |
402 | }; | |
403 | ||
b1462dfa | 404 | //---------------------------------------------------------------------- |
2abc0a0f | 405 | |
c368d904 RD |
406 | class wxWindowDisabler { |
407 | public: | |
408 | wxWindowDisabler(wxWindow *winToSkip = NULL); | |
409 | ~wxWindowDisabler(); | |
410 | }; | |
411 | ||
412 | //---------------------------------------------------------------------- | |
413 | ||
1e4a197e | 414 | bool wxSafeYield(wxWindow* win=NULL, bool onlyIfNeeded=FALSE); |
b1462dfa | 415 | void wxPostEvent(wxEvtHandler *dest, wxEvent& event); |
694759cf | 416 | void wxWakeUpIdle(); |
2abc0a0f | 417 | |
6e18ca6c | 418 | |
4662be59 | 419 | #ifdef __WXMSW__ |
6e18ca6c | 420 | void wxWakeUpMainThread(); |
4662be59 RD |
421 | #endif |
422 | ||
6e18ca6c RD |
423 | void wxMutexGuiEnter(); |
424 | void wxMutexGuiLeave(); | |
425 | ||
426 | ||
427 | class wxMutexGuiLocker { | |
428 | public: | |
429 | wxMutexGuiLocker(); | |
430 | ~wxMutexGuiLocker(); | |
431 | }; | |
432 | ||
433 | ||
434 | %inline %{ | |
435 | bool wxThread_IsMain() { | |
00ca6262 | 436 | #ifdef WXP_WITH_THREAD |
6e18ca6c | 437 | return wxThread::IsMain(); |
00ca6262 RD |
438 | #else |
439 | return TRUE; | |
440 | #endif | |
6e18ca6c RD |
441 | } |
442 | %} | |
c368d904 | 443 | |
2abc0a0f | 444 | //---------------------------------------------------------------------- |
f6bcfd97 BP |
445 | |
446 | ||
447 | class wxTipProvider | |
448 | { | |
449 | public: | |
450 | // wxTipProvider(size_t currentTip); **** Abstract base class | |
451 | ~wxTipProvider(); | |
452 | ||
453 | virtual wxString GetTip() = 0; | |
454 | size_t GetCurrentTip(); | |
fd512ba2 | 455 | virtual wxString PreprocessTip(const wxString& tip); |
f6bcfd97 BP |
456 | }; |
457 | ||
458 | ||
459 | // The C++ version of wxPyTipProvider | |
460 | %{ | |
461 | class wxPyTipProvider : public wxTipProvider { | |
462 | public: | |
463 | wxPyTipProvider(size_t currentTip) | |
464 | : wxTipProvider(currentTip) {} | |
465 | ||
466 | DEC_PYCALLBACK_STRING__pure(GetTip); | |
fd512ba2 | 467 | DEC_PYCALLBACK_STRING_STRING(PreprocessTip); |
f6bcfd97 BP |
468 | PYPRIVATE; |
469 | }; | |
470 | ||
471 | IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip); | |
fd512ba2 | 472 | IMP_PYCALLBACK_STRING_STRING(wxPyTipProvider, wxTipProvider, PreprocessTip); |
f6bcfd97 BP |
473 | %} |
474 | ||
475 | ||
476 | // Now let SWIG know about it | |
477 | class wxPyTipProvider : public wxTipProvider { | |
478 | public: | |
479 | wxPyTipProvider(size_t currentTip); | |
cf276873 RD |
480 | |
481 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
482 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyTipProvider)" | |
f6bcfd97 BP |
483 | }; |
484 | ||
485 | ||
486 | ||
487 | bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = TRUE); | |
488 | %new wxTipProvider * wxCreateFileTipProvider(const wxString& filename, size_t currentTip); | |
489 | ||
490 | ||
491 | //---------------------------------------------------------------------- | |
492 | ||
493 | %{ | |
494 | #include <wx/generic/dragimgg.h> | |
f6bcfd97 BP |
495 | %} |
496 | ||
9416aa89 | 497 | %name (wxDragImage) class wxGenericDragImage : public wxObject |
f6bcfd97 BP |
498 | { |
499 | public: | |
500 | ||
501 | wxGenericDragImage(const wxBitmap& image, | |
10e07c70 | 502 | const wxCursor& cursor = wxNullCursor); |
cdf14688 RD |
503 | %name(wxDragIcon)wxGenericDragImage(const wxIcon& image, |
504 | const wxCursor& cursor = wxNullCursor); | |
505 | %name(wxDragString)wxGenericDragImage(const wxString& str, | |
506 | const wxCursor& cursor = wxNullCursor); | |
507 | %name(wxDragTreeItem)wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); | |
508 | %name(wxDragListItem)wxGenericDragImage(const wxListCtrl& listCtrl, long id); | |
509 | ||
f6bcfd97 BP |
510 | ~wxGenericDragImage(); |
511 | ||
10e07c70 | 512 | void SetBackingBitmap(wxBitmap* bitmap); |
f6bcfd97 BP |
513 | bool BeginDrag(const wxPoint& hotspot, wxWindow* window, |
514 | bool fullScreen = FALSE, wxRect* rect = NULL); | |
515 | ||
1e4a197e RD |
516 | %name(BeginDragBounded) bool BeginDrag(const wxPoint& hotspot, wxWindow* window, |
517 | wxWindow* boundingWindow); | |
518 | ||
519 | %pragma(python) addtoclass = "BeginDrag2 = BeginDragBounded" | |
f6bcfd97 BP |
520 | |
521 | bool EndDrag(); | |
522 | bool Move(const wxPoint& pt); | |
523 | bool Show(); | |
524 | bool Hide(); | |
525 | ||
526 | wxRect GetImageRect(const wxPoint& pos) const; | |
527 | bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, | |
528 | bool eraseOld, bool drawNew); | |
529 | }; | |
530 | ||
531 | ||
f6bcfd97 BP |
532 | //---------------------------------------------------------------------- |
533 | ||
9416aa89 | 534 | class wxPyTimer : public wxObject { |
f6bcfd97 BP |
535 | public: |
536 | wxPyTimer(PyObject* notify); | |
537 | ~wxPyTimer(); | |
538 | int GetInterval(); | |
539 | bool IsOneShot(); | |
540 | bool IsRunning(); | |
541 | void SetOwner(wxEvtHandler *owner, int id = -1); | |
1fded56b | 542 | bool Start(int milliseconds=-1, int oneShot=FALSE); |
f6bcfd97 BP |
543 | void Stop(); |
544 | }; | |
545 | ||
b37c7e1d RD |
546 | |
547 | class wxStopWatch | |
548 | { | |
549 | public: | |
550 | // ctor starts the stop watch | |
551 | wxStopWatch(); | |
68320e40 | 552 | ~wxStopWatch(); |
b37c7e1d RD |
553 | void Start(long t = 0); |
554 | void Pause(); | |
555 | void Resume(); | |
556 | ||
557 | // get elapsed time since the last Start() or Pause() in milliseconds | |
558 | long Time() const; | |
559 | }; | |
560 | ||
561 | ||
f6bcfd97 BP |
562 | //---------------------------------------------------------------------- |
563 | //---------------------------------------------------------------------- | |
564 | ||
565 | ||
566 | enum | |
567 | { | |
568 | wxLOG_FatalError, // program can't continue, abort immediately | |
569 | wxLOG_Error, // a serious error, user must be informed about it | |
570 | wxLOG_Warning, // user is normally informed about it but may be ignored | |
571 | wxLOG_Message, // normal message (i.e. normal output of a non GUI app) | |
572 | wxLOG_Info, // informational message (a.k.a. 'Verbose') | |
573 | wxLOG_Status, // informational: might go to the status line of GUI app | |
574 | wxLOG_Debug, // never shown to the user, disabled in release mode | |
575 | wxLOG_Trace, // trace messages are also only enabled in debug mode | |
576 | wxLOG_Progress, // used for progress indicator (not yet) | |
577 | wxLOG_User = 100 // user defined levels start here | |
578 | }; | |
579 | ||
8baa46e9 RD |
580 | #define wxTRACE_MemAlloc "memalloc" // trace memory allocation (new/delete) |
581 | #define wxTRACE_Messages "messages" // trace window messages/X callbacks | |
582 | #define wxTRACE_ResAlloc "resalloc" // trace GDI resource allocation | |
583 | #define wxTRACE_RefCount "refcount" // trace various ref counting operations | |
584 | ||
585 | #ifdef __WXMSW__ | |
586 | #define wxTRACE_OleCalls "ole" // OLE interface calls | |
587 | #endif | |
588 | ||
589 | enum { | |
590 | wxTraceMemAlloc, | |
591 | wxTraceMessages, | |
592 | wxTraceResAlloc, | |
593 | wxTraceRefCount, | |
594 | ||
595 | #ifdef __WXMSW__ | |
596 | wxTraceOleCalls, | |
597 | #endif | |
598 | }; | |
599 | ||
600 | ||
f6bcfd97 BP |
601 | |
602 | class wxLog | |
603 | { | |
604 | public: | |
605 | wxLog(); | |
606 | ||
607 | static bool IsEnabled(); | |
608 | static bool EnableLogging(bool doIt = TRUE); | |
8baa46e9 | 609 | static void OnLog(unsigned long level, const wxString& szString, int t=0); |
f6bcfd97 BP |
610 | |
611 | virtual void Flush(); | |
f6bcfd97 BP |
612 | static void FlushActive(); |
613 | static wxLog *GetActiveTarget(); | |
614 | static wxLog *SetActiveTarget(wxLog *pLogger); | |
615 | ||
616 | static void Suspend(); | |
617 | static void Resume(); | |
618 | ||
d6eacb25 | 619 | static void SetVerbose(bool bVerbose = TRUE); |
f6bcfd97 BP |
620 | |
621 | static void DontCreateOnDemand(); | |
8baa46e9 | 622 | static void SetTraceMask(long ulMask); |
f6bcfd97 BP |
623 | static void AddTraceMask(const wxString& str); |
624 | static void RemoveTraceMask(const wxString& str); | |
76bfdc78 | 625 | static void ClearTraceMasks(); |
fd512ba2 | 626 | static const wxArrayString &GetTraceMasks(); |
76bfdc78 | 627 | |
137b5242 RD |
628 | static void SetTimestamp(const wxString& ts); |
629 | static const wxString& GetTimestamp(); | |
f6bcfd97 | 630 | |
19e30148 | 631 | bool GetVerbose() const; |
f6bcfd97 | 632 | |
be13a6af | 633 | static unsigned long GetTraceMask(); |
c8bc7bb8 | 634 | static bool IsAllowedTraceMask(const wxString& mask); |
f6bcfd97 | 635 | |
1e4a197e RD |
636 | static void SetLogLevel(unsigned long logLevel); |
637 | static unsigned long GetLogLevel(); | |
638 | ||
639 | ||
76bfdc78 RD |
640 | // static void TimeStamp(wxString *str); |
641 | %addmethods { | |
642 | wxString TimeStamp() { | |
643 | wxString msg; | |
644 | wxLog::TimeStamp(&msg); | |
645 | return msg; | |
646 | } | |
647 | } | |
d6eacb25 | 648 | |
f6bcfd97 BP |
649 | }; |
650 | ||
651 | ||
652 | class wxLogStderr : public wxLog | |
653 | { | |
654 | public: | |
655 | wxLogStderr(/* TODO: FILE *fp = (FILE *) NULL*/); | |
656 | }; | |
657 | ||
658 | ||
659 | class wxLogTextCtrl : public wxLog | |
660 | { | |
661 | public: | |
662 | wxLogTextCtrl(wxTextCtrl *pTextCtrl); | |
663 | }; | |
664 | ||
665 | ||
666 | class wxLogGui : public wxLog | |
667 | { | |
668 | public: | |
669 | wxLogGui(); | |
670 | }; | |
671 | ||
672 | class wxLogWindow : public wxLog | |
673 | { | |
674 | public: | |
675 | wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL) | |
c8bc7bb8 | 676 | const wxString& szTitle, // the title of the frame |
f6bcfd97 BP |
677 | bool bShow = TRUE, // show window immediately? |
678 | bool bPassToOld = TRUE); // pass log messages to the old target? | |
679 | ||
680 | void Show(bool bShow = TRUE); | |
681 | wxFrame *GetFrame() const; | |
682 | wxLog *GetOldLog() const; | |
683 | bool IsPassingMessages() const; | |
c8bc7bb8 | 684 | void PassMessages(bool bDoPass); |
f6bcfd97 BP |
685 | }; |
686 | ||
687 | ||
76bfdc78 RD |
688 | class wxLogChain : public wxLog |
689 | { | |
690 | public: | |
691 | wxLogChain(wxLog *logger); | |
692 | void SetLog(wxLog *logger); | |
693 | void PassMessages(bool bDoPass); | |
694 | bool IsPassingMessages(); | |
695 | wxLog *GetOldLog(); | |
696 | }; | |
697 | ||
698 | ||
f6bcfd97 | 699 | unsigned long wxSysErrorCode(); |
c8bc7bb8 | 700 | const wxString wxSysErrorMsg(unsigned long nErrCode = 0); |
be13a6af RD |
701 | void wxLogFatalError(const wxString& msg); |
702 | void wxLogError(const wxString& msg); | |
703 | void wxLogWarning(const wxString& msg); | |
704 | void wxLogMessage(const wxString& msg); | |
705 | void wxLogInfo(const wxString& msg); | |
1e4a197e | 706 | void wxLogDebug(const wxString& msg); |
be13a6af RD |
707 | void wxLogVerbose(const wxString& msg); |
708 | void wxLogStatus(const wxString& msg); | |
709 | %name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const wxString& msg); | |
710 | void wxLogSysError(const wxString& msg); | |
711 | ||
712 | void wxLogTrace(const wxString& msg); | |
713 | %name(wxLogTraceMask)void wxLogTrace(const wxString& mask, const wxString& msg); | |
714 | ||
715 | void wxLogGeneric(unsigned long level, const wxString& msg); | |
f6bcfd97 | 716 | |
b7fc54be RD |
717 | // wxLogFatalError helper: show the (fatal) error to the user in a safe way, |
718 | // i.e. without using wxMessageBox() for example because it could crash | |
0b85cc38 | 719 | void wxSafeShowMessage(const wxString& title, const wxString& text); |
b7fc54be RD |
720 | |
721 | ||
722 | ||
19e30148 RD |
723 | // Suspress logging while an instance of this class exists |
724 | class wxLogNull | |
725 | { | |
726 | public: | |
727 | wxLogNull(); | |
728 | ~wxLogNull(); | |
729 | }; | |
730 | ||
731 | ||
732 | ||
f6bcfd97 | 733 | |
76bfdc78 | 734 | %{ |
19e30148 | 735 | // A wxLog class that can be derived from in wxPython |
76bfdc78 RD |
736 | class wxPyLog : public wxLog { |
737 | public: | |
738 | wxPyLog() : wxLog() {} | |
739 | ||
740 | virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) { | |
741 | bool found; | |
4268f798 | 742 | wxPyBeginBlockThreads(); |
a66212dc RD |
743 | if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) { |
744 | PyObject* s = wx2PyString(szString); | |
745 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t)); | |
746 | Py_DECREF(s); | |
747 | } | |
4268f798 | 748 | wxPyEndBlockThreads(); |
76bfdc78 RD |
749 | if (! found) |
750 | wxLog::DoLog(level, szString, t); | |
751 | } | |
752 | ||
753 | virtual void DoLogString(const wxChar *szString, time_t t) { | |
754 | bool found; | |
4268f798 | 755 | wxPyBeginBlockThreads(); |
a66212dc RD |
756 | if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) { |
757 | PyObject* s = wx2PyString(szString); | |
758 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t)); | |
759 | Py_DECREF(s); | |
760 | } | |
4268f798 | 761 | wxPyEndBlockThreads(); |
76bfdc78 RD |
762 | if (! found) |
763 | wxLog::DoLogString(szString, t); | |
764 | } | |
765 | ||
766 | PYPRIVATE; | |
767 | }; | |
768 | %} | |
769 | ||
770 | // Now tell SWIG about it | |
771 | class wxPyLog : public wxLog { | |
772 | public: | |
773 | wxPyLog(); | |
0122b7e3 RD |
774 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
775 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyLog)" | |
76bfdc78 RD |
776 | %addmethods { void Destroy() { delete self; } } |
777 | ||
778 | }; | |
779 | ||
c368d904 RD |
780 | |
781 | //---------------------------------------------------------------------- | |
782 | ||
1b62f00d | 783 | |
814f509c RD |
784 | enum wxKillError |
785 | { | |
786 | wxKILL_OK, // no error | |
787 | wxKILL_BAD_SIGNAL, // no such signal | |
788 | wxKILL_ACCESS_DENIED, // permission denied | |
789 | wxKILL_NO_PROCESS, // no such process | |
790 | wxKILL_ERROR // another, unspecified error | |
791 | }; | |
792 | ||
1883480f RD |
793 | enum wxSignal |
794 | { | |
795 | wxSIGNONE = 0, // verify if the process exists under Unix | |
796 | wxSIGHUP, | |
797 | wxSIGINT, | |
798 | wxSIGQUIT, | |
799 | wxSIGILL, | |
800 | wxSIGTRAP, | |
801 | wxSIGABRT, | |
802 | wxSIGIOT = wxSIGABRT, // another name | |
803 | wxSIGEMT, | |
804 | wxSIGFPE, | |
805 | wxSIGKILL, | |
806 | wxSIGBUS, | |
807 | wxSIGSEGV, | |
808 | wxSIGSYS, | |
809 | wxSIGPIPE, | |
810 | wxSIGALRM, | |
811 | wxSIGTERM | |
812 | ||
813 | // further signals are different in meaning between different Unix systems | |
814 | }; | |
815 | ||
816 | ||
817 | ||
818 | enum { | |
819 | /* event type */ | |
820 | wxEVT_END_PROCESS | |
821 | }; | |
822 | ||
823 | ||
814f509c | 824 | |
c368d904 RD |
825 | class wxProcessEvent : public wxEvent { |
826 | public: | |
827 | wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0); | |
828 | int GetPid(); | |
829 | int GetExitCode(); | |
830 | int m_pid, m_exitcode; | |
831 | }; | |
832 | ||
833 | ||
834 | ||
835 | ||
836 | %{ // C++ version of wxProcess derived class | |
837 | ||
838 | class wxPyProcess : public wxProcess { | |
839 | public: | |
840 | wxPyProcess(wxEvtHandler *parent = NULL, int id = -1) | |
841 | : wxProcess(parent, id) | |
842 | {} | |
843 | ||
844 | DEC_PYCALLBACK_VOID_INTINT(OnTerminate); | |
845 | ||
846 | PYPRIVATE; | |
847 | }; | |
848 | ||
849 | IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate); | |
19a97bd6 | 850 | |
c368d904 RD |
851 | %} |
852 | ||
853 | ||
854 | %name(wxProcess)class wxPyProcess : public wxEvtHandler { | |
855 | public: | |
814f509c RD |
856 | // kill the process with the given PID |
857 | static wxKillError Kill(int pid, wxSignal sig = wxSIGTERM); | |
858 | ||
859 | // test if the given process exists | |
860 | static bool Exists(int pid); | |
861 | ||
862 | // this function replaces the standard popen() one: it launches a process | |
863 | // asynchronously and allows the caller to get the streams connected to its | |
864 | // std{in|out|err} | |
865 | // | |
866 | // on error NULL is returned, in any case the process object will be | |
867 | // deleted automatically when the process terminates and should *not* be | |
868 | // deleted by the caller | |
e626d7c7 | 869 | static wxPyProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC); |
814f509c RD |
870 | |
871 | ||
872 | ||
c368d904 RD |
873 | wxPyProcess(wxEvtHandler *parent = NULL, int id = -1); |
874 | %addmethods { void Destroy() { delete self; } } | |
875 | ||
0122b7e3 RD |
876 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
877 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxProcess)" | |
c368d904 RD |
878 | |
879 | void base_OnTerminate(int pid, int status); | |
880 | ||
881 | void Redirect(); | |
882 | bool IsRedirected(); | |
883 | void Detach(); | |
884 | ||
885 | wxInputStream *GetInputStream(); | |
886 | wxInputStream *GetErrorStream(); | |
887 | wxOutputStream *GetOutputStream(); | |
888 | ||
889 | void CloseOutput(); | |
3b3ab7f6 RD |
890 | |
891 | // return TRUE if the child process stdout is not closed | |
892 | bool IsInputOpened() const; | |
893 | ||
894 | // return TRUE if any input is available on the child process stdout/err | |
895 | bool IsInputAvailable() const; | |
896 | bool IsErrorAvailable() const; | |
c368d904 RD |
897 | }; |
898 | ||
899 | ||
d6eacb25 RD |
900 | enum |
901 | { | |
902 | // execute the process asynchronously | |
903 | wxEXEC_ASYNC = 0, | |
904 | ||
905 | // execute it synchronously, i.e. wait until it finishes | |
906 | wxEXEC_SYNC = 1, | |
907 | ||
908 | // under Windows, don't hide the child even if it's IO is redirected (this | |
909 | // is done by default) | |
910 | wxEXEC_NOHIDE = 2, | |
911 | ||
912 | // under Unix, if the process is the group leader then killing -pid kills | |
913 | // all children as well as pid | |
914 | wxEXEC_MAKE_GROUP_LEADER = 4 | |
b96c7a38 RD |
915 | }; |
916 | ||
c368d904 RD |
917 | |
918 | long wxExecute(const wxString& command, | |
b96c7a38 | 919 | int flags = wxEXEC_ASYNC, |
c368d904 RD |
920 | wxPyProcess *process = NULL); |
921 | ||
185d7c3e RD |
922 | //---------------------------------------------------------------------- |
923 | ||
3eb221f6 RD |
924 | |
925 | // Which joystick? Same as Windows ids so no conversion necessary. | |
926 | enum | |
927 | { | |
928 | wxJOYSTICK1, | |
929 | wxJOYSTICK2 | |
930 | }; | |
931 | ||
932 | // Which button is down? | |
933 | enum | |
934 | { | |
935 | wxJOY_BUTTON_ANY, | |
936 | wxJOY_BUTTON1, | |
937 | wxJOY_BUTTON2, | |
938 | wxJOY_BUTTON3, | |
939 | wxJOY_BUTTON4, | |
940 | }; | |
941 | ||
942 | ||
493f1553 RD |
943 | %{ |
944 | #if !wxUSE_JOYSTICK && !defined(__WXMSW__) | |
945 | // A C++ stub class for wxJoystick for platforms that don't have it. | |
946 | class wxJoystick : public wxObject { | |
947 | public: | |
948 | wxJoystick(int joystick = wxJOYSTICK1) { | |
4268f798 | 949 | wxPyBeginBlockThreads(); |
493f1553 | 950 | PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform."); |
4268f798 | 951 | wxPyEndBlockThreads(); |
493f1553 RD |
952 | } |
953 | wxPoint GetPosition() { return wxPoint(-1,-1); } | |
954 | int GetZPosition() { return -1; } | |
955 | int GetButtonState() { return -1; } | |
956 | int GetPOVPosition() { return -1; } | |
957 | int GetPOVCTSPosition() { return -1; } | |
958 | int GetRudderPosition() { return -1; } | |
959 | int GetUPosition() { return -1; } | |
960 | int GetVPosition() { return -1; } | |
961 | int GetMovementThreshold() { return -1; } | |
d56cebe7 | 962 | void SetMovementThreshold(int threshold) {} |
493f1553 RD |
963 | |
964 | bool IsOk(void) { return FALSE; } | |
965 | int GetNumberJoysticks() { return -1; } | |
966 | int GetManufacturerId() { return -1; } | |
967 | int GetProductId() { return -1; } | |
968 | wxString GetProductName() { return ""; } | |
969 | int GetXMin() { return -1; } | |
970 | int GetYMin() { return -1; } | |
971 | int GetZMin() { return -1; } | |
972 | int GetXMax() { return -1; } | |
973 | int GetYMax() { return -1; } | |
974 | int GetZMax() { return -1; } | |
975 | int GetNumberButtons() { return -1; } | |
976 | int GetNumberAxes() { return -1; } | |
977 | int GetMaxButtons() { return -1; } | |
978 | int GetMaxAxes() { return -1; } | |
979 | int GetPollingMin() { return -1; } | |
980 | int GetPollingMax() { return -1; } | |
981 | int GetRudderMin() { return -1; } | |
982 | int GetRudderMax() { return -1; } | |
983 | int GetUMin() { return -1; } | |
984 | int GetUMax() { return -1; } | |
985 | int GetVMin() { return -1; } | |
986 | int GetVMax() { return -1; } | |
987 | ||
988 | bool HasRudder() { return FALSE; } | |
989 | bool HasZ() { return FALSE; } | |
990 | bool HasU() { return FALSE; } | |
991 | bool HasV() { return FALSE; } | |
992 | bool HasPOV() { return FALSE; } | |
993 | bool HasPOV4Dir() { return FALSE; } | |
994 | bool HasPOVCTS() { return FALSE; } | |
995 | ||
996 | bool SetCapture(wxWindow* win, int pollingFreq = 0) { return FALSE; } | |
997 | bool ReleaseCapture() { return FALSE; } | |
998 | }; | |
999 | #endif | |
1000 | %} | |
1001 | ||
1002 | ||
9416aa89 | 1003 | class wxJoystick : public wxObject { |
185d7c3e RD |
1004 | public: |
1005 | wxJoystick(int joystick = wxJOYSTICK1); | |
ac346f50 RD |
1006 | ~wxJoystick(); |
1007 | ||
185d7c3e RD |
1008 | wxPoint GetPosition(); |
1009 | int GetZPosition(); | |
1010 | int GetButtonState(); | |
1011 | int GetPOVPosition(); | |
1012 | int GetPOVCTSPosition(); | |
1013 | int GetRudderPosition(); | |
1014 | int GetUPosition(); | |
1015 | int GetVPosition(); | |
1016 | int GetMovementThreshold(); | |
1017 | void SetMovementThreshold(int threshold) ; | |
1018 | ||
1019 | bool IsOk(void); | |
1020 | int GetNumberJoysticks(); | |
1021 | int GetManufacturerId(); | |
1022 | int GetProductId(); | |
1023 | wxString GetProductName(); | |
1024 | int GetXMin(); | |
1025 | int GetYMin(); | |
1026 | int GetZMin(); | |
1027 | int GetXMax(); | |
1028 | int GetYMax(); | |
1029 | int GetZMax(); | |
1030 | int GetNumberButtons(); | |
1031 | int GetNumberAxes(); | |
1032 | int GetMaxButtons(); | |
1033 | int GetMaxAxes(); | |
1034 | int GetPollingMin(); | |
1035 | int GetPollingMax(); | |
1036 | int GetRudderMin(); | |
1037 | int GetRudderMax(); | |
1038 | int GetUMin(); | |
1039 | int GetUMax(); | |
1040 | int GetVMin(); | |
1041 | int GetVMax(); | |
1042 | ||
1043 | bool HasRudder(); | |
1044 | bool HasZ(); | |
1045 | bool HasU(); | |
1046 | bool HasV(); | |
1047 | bool HasPOV(); | |
1048 | bool HasPOV4Dir(); | |
1049 | bool HasPOVCTS(); | |
1050 | ||
1051 | bool SetCapture(wxWindow* win, int pollingFreq = 0); | |
1052 | bool ReleaseCapture(); | |
1fded56b RD |
1053 | |
1054 | %pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()" | |
185d7c3e | 1055 | }; |
493f1553 RD |
1056 | |
1057 | //---------------------------------------------------------------------- | |
1058 | ||
1059 | %{ | |
0adbc166 | 1060 | #if !wxUSE_WAVE |
493f1553 RD |
1061 | // A C++ stub class for wxWave for platforms that don't have it. |
1062 | class wxWave : public wxObject | |
1063 | { | |
1064 | public: | |
1065 | wxWave(const wxString& fileName, bool isResource = FALSE) { | |
4268f798 | 1066 | wxPyBeginBlockThreads(); |
493f1553 | 1067 | PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform."); |
4268f798 | 1068 | wxPyEndBlockThreads(); |
493f1553 RD |
1069 | } |
1070 | wxWave(int size, const wxByte* data) { | |
4268f798 | 1071 | wxPyBeginBlockThreads(); |
493f1553 | 1072 | PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform."); |
4268f798 | 1073 | wxPyEndBlockThreads(); |
493f1553 RD |
1074 | } |
1075 | ||
1076 | ~wxWave() {} | |
1077 | ||
1078 | bool IsOk() const { return FALSE; } | |
1079 | bool Play(bool async = TRUE, bool looped = FALSE) const { return FALSE; } | |
1080 | }; | |
1081 | ||
2cd2fac8 | 1082 | #endif |
493f1553 RD |
1083 | %} |
1084 | ||
1085 | class wxWave : public wxObject | |
1086 | { | |
1087 | public: | |
1fded56b RD |
1088 | wxWave(const wxString& fileName, bool isResource = FALSE); |
1089 | ~wxWave(); | |
1090 | ||
1091 | bool IsOk() const; | |
1092 | bool Play(bool async = TRUE, bool looped = FALSE) const; | |
493f1553 | 1093 | |
1fded56b | 1094 | %pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()" |
493f1553 RD |
1095 | }; |
1096 | ||
1097 | %new wxWave* wxWaveData(const wxString& data); | |
1098 | %{ // Implementations of some alternate "constructors" | |
1099 | wxWave* wxWaveData(const wxString& data) { | |
1100 | return new wxWave(data.Len(), (wxByte*)data.c_str()); | |
1101 | } | |
1102 | %} | |
185d7c3e | 1103 | |
4f3449b4 | 1104 | |
b37c7e1d RD |
1105 | //---------------------------------------------------------------------- |
1106 | ||
1107 | enum wxMailcapStyle | |
1108 | { | |
1109 | wxMAILCAP_STANDARD = 1, | |
1110 | wxMAILCAP_NETSCAPE = 2, | |
1111 | wxMAILCAP_KDE = 4, | |
1112 | wxMAILCAP_GNOME = 8, | |
1113 | ||
1114 | wxMAILCAP_ALL = 15 | |
1115 | }; | |
1116 | ||
1117 | ||
1118 | ||
1119 | class wxFileTypeInfo | |
1120 | { | |
1121 | public: | |
1122 | // ctors | |
1123 | // a normal item | |
1e4a197e RD |
1124 | wxFileTypeInfo(const wxString& mimeType, |
1125 | const wxString& openCmd, | |
1126 | const wxString& printCmd, | |
1127 | const wxString& desc); | |
b37c7e1d RD |
1128 | |
1129 | ||
1130 | // the array elements correspond to the parameters of the ctor above in | |
1131 | // the same order | |
1132 | %name(wxFileTypeInfoSequence)wxFileTypeInfo(const wxArrayString& sArray); | |
1133 | ||
1134 | // invalid item - use this to terminate the array passed to | |
1135 | // wxMimeTypesManager::AddFallbacks | |
1136 | %name(wxNullFileTypeInfo)wxFileTypeInfo(); | |
1137 | ||
1138 | ||
1139 | // test if this object can be used | |
1140 | bool IsValid() const; | |
1141 | ||
1142 | // setters | |
1143 | // set the icon info | |
1144 | void SetIcon(const wxString& iconFile, int iconIndex = 0); | |
1145 | ||
1146 | // set the short desc | |
1147 | void SetShortDesc(const wxString& shortDesc); | |
1148 | ||
1149 | // accessors | |
1150 | // get the MIME type | |
1151 | const wxString& GetMimeType() const; | |
1152 | // get the open command | |
1153 | const wxString& GetOpenCommand() const; | |
1154 | // get the print command | |
1155 | const wxString& GetPrintCommand() const; | |
1156 | // get the short description (only used under Win32 so far) | |
1157 | const wxString& GetShortDesc() const; | |
1158 | // get the long, user visible description | |
1159 | const wxString& GetDescription() const; | |
1160 | ||
1161 | ||
1162 | // get the array of all extensions | |
1163 | //const wxArrayString& GetExtensions() const; | |
1164 | %addmethods { | |
1165 | PyObject* GetExtensions() { | |
1166 | wxArrayString& arr = (wxArrayString&)self->GetExtensions(); | |
1167 | return wxArrayString2PyList_helper(arr); | |
1168 | } | |
1169 | } | |
1170 | ||
1171 | int GetExtensionsCount() const; | |
1172 | ||
1173 | // get the icon info | |
1174 | const wxString& GetIconFile() const; | |
1175 | int GetIconIndex() const; | |
1176 | }; | |
1177 | ||
1178 | ||
1179 | ||
1180 | ||
1181 | class wxFileType | |
1182 | { | |
1183 | public: | |
1184 | ||
1185 | // TODO: Make a wxPyMessageParameters with virtual GetParamValue... | |
1186 | ||
1187 | // An object of this class must be passed to Get{Open|Print}Command. The | |
1188 | // default implementation is trivial and doesn't know anything at all about | |
1189 | // parameters, only filename and MIME type are used (so it's probably ok for | |
1190 | // Windows where %{param} is not used anyhow) | |
1191 | class MessageParameters | |
1192 | { | |
1193 | public: | |
1194 | // ctors | |
137b5242 RD |
1195 | MessageParameters(const wxString& filename=wxPyEmptyString, |
1196 | const wxString& mimetype=wxPyEmptyString); | |
b37c7e1d RD |
1197 | |
1198 | // accessors (called by GetOpenCommand) | |
1199 | // filename | |
1200 | const wxString& GetFileName() const; | |
1201 | // mime type | |
1202 | const wxString& GetMimeType() const;; | |
1203 | ||
1204 | // override this function in derived class | |
1205 | virtual wxString GetParamValue(const wxString& name) const; | |
1206 | ||
1207 | // virtual dtor as in any base class | |
1208 | virtual ~MessageParameters(); | |
1209 | }; | |
1210 | ||
1211 | ||
1212 | // ctor from static data | |
1213 | wxFileType(const wxFileTypeInfo& ftInfo); | |
1214 | ||
1215 | // return the MIME type for this file type | |
1216 | %addmethods { | |
1217 | PyObject* GetMimeType() { | |
1218 | wxString str; | |
c8bc7bb8 RD |
1219 | if (self->GetMimeType(&str)) { |
1220 | #if wxUSE_UNICODE | |
1e4a197e | 1221 | return PyUnicode_FromWideChar(str.c_str(), str.Len()); |
c8bc7bb8 RD |
1222 | #else |
1223 | return PyString_FromStringAndSize(str.c_str(), str.Len()); | |
1224 | #endif | |
1225 | } | |
b37c7e1d RD |
1226 | else |
1227 | RETURN_NONE(); | |
1228 | } | |
1229 | PyObject* GetMimeTypes() { | |
1230 | wxArrayString arr; | |
1231 | if (self->GetMimeTypes(arr)) | |
1232 | return wxArrayString2PyList_helper(arr); | |
1233 | else | |
1234 | RETURN_NONE(); | |
1235 | } | |
1236 | } | |
1237 | ||
1238 | ||
1239 | // Get all extensions associated with this file type | |
1240 | %addmethods { | |
1241 | PyObject* GetExtensions() { | |
1242 | wxArrayString arr; | |
1243 | if (self->GetExtensions(arr)) | |
1244 | return wxArrayString2PyList_helper(arr); | |
1245 | else | |
1246 | RETURN_NONE(); | |
1247 | } | |
1248 | } | |
1249 | ||
1250 | ||
1251 | %addmethods { | |
1252 | // Get the icon corresponding to this file type | |
1253 | %new wxIcon* GetIcon() { | |
1254 | wxIcon icon; | |
1255 | if (self->GetIcon(&icon)) | |
1256 | return new wxIcon(icon); | |
1257 | else | |
1258 | return NULL; | |
1259 | } | |
1260 | ||
1261 | // Get the icon corresponding to this file type, the name of the file | |
1262 | // where this icon resides, and its index in this file if applicable. | |
1263 | PyObject* GetIconInfo() { | |
1264 | wxIcon icon; | |
1265 | wxString iconFile; | |
1266 | int iconIndex; | |
1267 | if (self->GetIcon(&icon, &iconFile, &iconIndex)) { | |
4268f798 | 1268 | wxPyBeginBlockThreads(); |
b37c7e1d RD |
1269 | PyObject* tuple = PyTuple_New(3); |
1270 | PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(icon), | |
1e4a197e | 1271 | wxT("wxIcon"), TRUE)); |
c8bc7bb8 | 1272 | #if wxUSE_UNICODE |
1e4a197e | 1273 | PyTuple_SetItem(tuple, 1, PyUnicode_FromWideChar(iconFile.c_str(), iconFile.Len())); |
c8bc7bb8 RD |
1274 | #else |
1275 | PyTuple_SetItem(tuple, 1, PyString_FromStringAndSize(iconFile.c_str(), iconFile.Len())); | |
1276 | #endif | |
b37c7e1d | 1277 | PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex)); |
4268f798 | 1278 | wxPyEndBlockThreads(); |
b37c7e1d RD |
1279 | return tuple; |
1280 | } | |
1281 | else | |
1282 | RETURN_NONE(); | |
1283 | } | |
1284 | } | |
1285 | ||
1286 | %addmethods { | |
1287 | // get a brief file type description ("*.txt" => "text document") | |
1288 | PyObject* GetDescription() { | |
1289 | wxString str; | |
c8bc7bb8 RD |
1290 | if (self->GetDescription(&str)) { |
1291 | #if wxUSE_UNICODE | |
1e4a197e | 1292 | return PyUnicode_FromWideChar(str.c_str(), str.Len()); |
c8bc7bb8 RD |
1293 | #else |
1294 | return PyString_FromStringAndSize(str.c_str(), str.Len()); | |
1295 | #endif | |
1296 | } else | |
b37c7e1d RD |
1297 | RETURN_NONE(); |
1298 | } | |
1299 | } | |
1300 | ||
1301 | ||
1302 | // get the command to open/execute the file of given type | |
1303 | %addmethods { | |
1304 | PyObject* GetOpenCommand(const wxString& filename, | |
137b5242 | 1305 | const wxString& mimetype=wxPyEmptyString) { |
b37c7e1d | 1306 | wxString str; |
c8bc7bb8 RD |
1307 | if (self->GetOpenCommand(&str, wxFileType::MessageParameters(filename, mimetype))) { |
1308 | #if wxUSE_UNICODE | |
1e4a197e | 1309 | return PyUnicode_FromWideChar(str.c_str(), str.Len()); |
c8bc7bb8 RD |
1310 | #else |
1311 | return PyString_FromStringAndSize(str.c_str(), str.Len()); | |
1312 | #endif | |
1313 | } else | |
b37c7e1d RD |
1314 | RETURN_NONE(); |
1315 | } | |
1316 | } | |
1317 | ||
1318 | ||
1319 | // get the command to print the file of given type | |
1320 | %addmethods { | |
1321 | PyObject* GetPrintCommand(const wxString& filename, | |
137b5242 | 1322 | const wxString& mimetype=wxPyEmptyString) { |
b37c7e1d | 1323 | wxString str; |
c8bc7bb8 RD |
1324 | if (self->GetPrintCommand(&str, wxFileType::MessageParameters(filename, mimetype))) { |
1325 | #if wxUSE_UNICODE | |
1e4a197e | 1326 | return PyUnicode_FromWideChar(str.c_str(), str.Len()); |
c8bc7bb8 RD |
1327 | #else |
1328 | return PyString_FromStringAndSize(str.c_str(), str.Len()); | |
1329 | #endif | |
1330 | } else | |
b37c7e1d RD |
1331 | RETURN_NONE(); |
1332 | } | |
1333 | } | |
1334 | ||
1335 | ||
1336 | // Get all commands defined for this file type | |
1337 | %addmethods { | |
1338 | PyObject* GetAllCommands(const wxString& filename, | |
137b5242 | 1339 | const wxString& mimetype=wxPyEmptyString) { |
b37c7e1d RD |
1340 | wxArrayString verbs; |
1341 | wxArrayString commands; | |
1342 | if (self->GetAllCommands(&verbs, &commands, | |
1343 | wxFileType::MessageParameters(filename, mimetype))) { | |
4268f798 | 1344 | wxPyBeginBlockThreads(); |
b37c7e1d RD |
1345 | PyObject* tuple = PyTuple_New(2); |
1346 | PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs)); | |
1347 | PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands)); | |
4268f798 | 1348 | wxPyEndBlockThreads(); |
b37c7e1d RD |
1349 | return tuple; |
1350 | } | |
1351 | else | |
1352 | RETURN_NONE(); | |
1353 | } | |
1354 | } | |
1355 | ||
1356 | ||
1357 | // set an arbitrary command, ask confirmation if it already exists and | |
1358 | // overwriteprompt is TRUE | |
1359 | bool SetCommand(const wxString& cmd, const wxString& verb, | |
1360 | bool overwriteprompt = TRUE); | |
1361 | ||
137b5242 | 1362 | bool SetDefaultIcon(const wxString& cmd = wxPyEmptyString, int index = 0); |
b37c7e1d RD |
1363 | |
1364 | ||
1365 | // remove the association for this filetype from the system MIME database: | |
1366 | // notice that it will only work if the association is defined in the user | |
1367 | // file/registry part, we will never modify the system-wide settings | |
1368 | bool Unassociate(); | |
1369 | ||
1370 | // operations | |
1371 | // expand a string in the format of GetOpenCommand (which may contain | |
1372 | // '%s' and '%t' format specificators for the file name and mime type | |
1373 | // and %{param} constructions). | |
1374 | static wxString ExpandCommand(const wxString& command, | |
1375 | const MessageParameters& params); | |
1376 | ||
1377 | // dtor (not virtual, shouldn't be derived from) | |
1378 | ~wxFileType(); | |
1379 | ||
1380 | }; | |
1381 | ||
1382 | ||
1383 | ||
1384 | ||
1385 | class wxMimeTypesManager | |
1386 | { | |
1387 | public: | |
1388 | // static helper functions | |
1389 | // ----------------------- | |
1390 | ||
1391 | // check if the given MIME type is the same as the other one: the | |
1392 | // second argument may contain wildcards ('*'), but not the first. If | |
1393 | // the types are equal or if the mimeType matches wildcard the function | |
1394 | // returns TRUE, otherwise it returns FALSE | |
1395 | static bool IsOfType(const wxString& mimeType, const wxString& wildcard); | |
1396 | ||
1397 | // ctor | |
1398 | wxMimeTypesManager(); | |
1399 | ||
1400 | // loads data from standard files according to the mailcap styles | |
1401 | // specified: this is a bitwise OR of wxMailcapStyle values | |
1402 | // | |
1403 | // use the extraDir parameter if you want to look for files in another | |
1404 | // directory | |
9cbf6f6e | 1405 | void Initialize(int mailcapStyle = wxMAILCAP_ALL, |
137b5242 | 1406 | const wxString& extraDir = wxPyEmptyString); |
b37c7e1d RD |
1407 | |
1408 | // and this function clears all the data from the manager | |
1409 | void ClearData(); | |
1410 | ||
1411 | // Database lookup: all functions return a pointer to wxFileType object | |
1412 | // whose methods may be used to query it for the information you're | |
1413 | // interested in. If the return value is !NULL, caller is responsible for | |
1414 | // deleting it. | |
1415 | // get file type from file extension | |
1416 | %new wxFileType *GetFileTypeFromExtension(const wxString& ext); | |
1417 | ||
1418 | // get file type from MIME type (in format <category>/<format>) | |
1419 | %new wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); | |
1420 | ||
1421 | // other operations: return TRUE if there were no errors or FALSE if there | |
1422 | // were some unreckognized entries (the good entries are always read anyhow) | |
1423 | // | |
1424 | ||
1425 | // read in additional file (the standard ones are read automatically) | |
1426 | // in mailcap format (see mimetype.cpp for description) | |
1427 | // | |
1428 | // 'fallback' parameter may be set to TRUE to avoid overriding the | |
1429 | // settings from other, previously parsed, files by this one: normally, | |
1430 | // the files read most recently would override the older files, but with | |
1431 | // fallback == TRUE this won't happen | |
1432 | bool ReadMailcap(const wxString& filename, bool fallback = FALSE); | |
1433 | ||
1434 | // read in additional file in mime.types format | |
1435 | bool ReadMimeTypes(const wxString& filename); | |
1436 | ||
1437 | // enumerate all known MIME types | |
1438 | %addmethods { | |
1439 | PyObject* EnumAllFileTypes() { | |
1440 | wxArrayString arr; | |
1441 | self->EnumAllFileTypes(arr); | |
1442 | return wxArrayString2PyList_helper(arr); | |
1443 | } | |
1444 | } | |
1445 | ||
1446 | // these functions can be used to provide default values for some of the | |
1447 | // MIME types inside the program itself (you may also use | |
1448 | // ReadMailcap(filenameWithDefaultTypes, TRUE /* use as fallback */) to | |
1449 | // achieve the same goal, but this requires having this info in a file). | |
1450 | // | |
1451 | void AddFallback(const wxFileTypeInfo& ft); | |
1452 | ||
1453 | ||
1454 | // create or remove associations | |
1455 | ||
1456 | // create a new association using the fields of wxFileTypeInfo (at least | |
1457 | // the MIME type and the extension should be set) | |
1458 | // if the other fields are empty, the existing values should be left alone | |
1459 | %new wxFileType *Associate(const wxFileTypeInfo& ftInfo); | |
1460 | ||
1461 | // undo Associate() | |
1462 | bool Unassociate(wxFileType *ft) ; | |
1463 | ||
1464 | // dtor (not virtual, shouldn't be derived from) | |
1465 | ~wxMimeTypesManager(); | |
1466 | }; | |
1467 | ||
1468 | ||
1469 | %readonly | |
1470 | %{ | |
1471 | #if 0 | |
1472 | %} | |
1473 | extern wxMimeTypesManager* wxTheMimeTypesManager; | |
1474 | %{ | |
1475 | #endif | |
1476 | %} | |
1477 | %readwrite | |
1478 | ||
72797a7d RD |
1479 | //---------------------------------------------------------------------- |
1480 | ||
1481 | %{ | |
1482 | #include <wx/artprov.h> | |
1483 | ||
1484 | DECLARE_DEF_STRING(ART_OTHER); | |
1485 | ||
1486 | %} | |
1487 | ||
eb67b703 RD |
1488 | %pragma(python) code = " |
1489 | # Art clients | |
1490 | wxART_TOOLBAR = 'wxART_TOOLBAR_C' | |
1491 | wxART_MENU = 'wxART_MENU_C' | |
1492 | wxART_FRAME_ICON = 'wxART_FRAME_ICON_C' | |
1493 | wxART_CMN_DIALOG = 'wxART_CMN_DIALOG_C' | |
1494 | wxART_HELP_BROWSER = 'wxART_HELP_BROWSER_C' | |
1495 | wxART_MESSAGE_BOX = 'wxART_MESSAGE_BOX_C' | |
1496 | wxART_OTHER = 'wxART_OTHER_C' | |
1497 | ||
1498 | # Art IDs | |
1499 | wxART_ADD_BOOKMARK = 'wxART_ADD_BOOKMARK' | |
1500 | wxART_DEL_BOOKMARK = 'wxART_DEL_BOOKMARK' | |
1501 | wxART_HELP_SIDE_PANEL = 'wxART_HELP_SIDE_PANEL' | |
1502 | wxART_HELP_SETTINGS = 'wxART_HELP_SETTINGS' | |
1503 | wxART_HELP_BOOK = 'wxART_HELP_BOOK' | |
1504 | wxART_HELP_FOLDER = 'wxART_HELP_FOLDER' | |
1505 | wxART_HELP_PAGE = 'wxART_HELP_PAGE' | |
1506 | wxART_GO_BACK = 'wxART_GO_BACK' | |
1507 | wxART_GO_FORWARD = 'wxART_GO_FORWARD' | |
1508 | wxART_GO_UP = 'wxART_GO_UP' | |
1509 | wxART_GO_DOWN = 'wxART_GO_DOWN' | |
1510 | wxART_GO_TO_PARENT = 'wxART_GO_TO_PARENT' | |
1511 | wxART_GO_HOME = 'wxART_GO_HOME' | |
1512 | wxART_FILE_OPEN = 'wxART_FILE_OPEN' | |
1513 | wxART_PRINT = 'wxART_PRINT' | |
1514 | wxART_HELP = 'wxART_HELP' | |
1515 | wxART_TIP = 'wxART_TIP' | |
1516 | wxART_REPORT_VIEW = 'wxART_REPORT_VIEW' | |
1517 | wxART_LIST_VIEW = 'wxART_LIST_VIEW' | |
1518 | wxART_NEW_DIR = 'wxART_NEW_DIR' | |
1519 | wxART_FOLDER = 'wxART_FOLDER' | |
1520 | wxART_GO_DIR_UP = 'wxART_GO_DIR_UP' | |
1521 | wxART_EXECUTABLE_FILE = 'wxART_EXECUTABLE_FILE' | |
1522 | wxART_NORMAL_FILE = 'wxART_NORMAL_FILE' | |
1523 | wxART_TICK_MARK = 'wxART_TICK_MARK' | |
1524 | wxART_CROSS_MARK = 'wxART_CROSS_MARK' | |
1525 | wxART_ERROR = 'wxART_ERROR' | |
1526 | wxART_QUESTION = 'wxART_QUESTION' | |
1527 | wxART_WARNING = 'wxART_WARNING' | |
1528 | wxART_INFORMATION = 'wxART_INFORMATION' | |
9cbf6f6e | 1529 | wxART_MISSING_IMAGE = 'wxART_MISSING_IMAGE' |
eb67b703 | 1530 | " |
72797a7d RD |
1531 | |
1532 | %{ // Python aware wxArtProvider | |
1533 | class wxPyArtProvider : public wxArtProvider { | |
1534 | public: | |
1535 | ||
1536 | virtual wxBitmap CreateBitmap(const wxArtID& id, | |
1537 | const wxArtClient& client, | |
1538 | const wxSize& size) { | |
1539 | wxBitmap rval = wxNullBitmap; | |
1540 | wxPyBeginBlockThreads(); | |
1541 | if ((wxPyCBH_findCallback(m_myInst, "CreateBitmap"))) { | |
1e4a197e | 1542 | PyObject* so = wxPyConstructObject((void*)&size, wxT("wxSize"), 0); |
72797a7d RD |
1543 | PyObject* ro; |
1544 | wxBitmap* ptr; | |
a66212dc | 1545 | PyObject* s1, *s2; |
72797a7d RD |
1546 | s1 = wx2PyString(id); |
1547 | s2 = wx2PyString(client); | |
a66212dc | 1548 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOO)", s1, s2, so)); |
72797a7d | 1549 | Py_DECREF(so); |
a66212dc RD |
1550 | Py_DECREF(s1); |
1551 | Py_DECREF(s2); | |
72797a7d RD |
1552 | if (ro) { |
1553 | if (!SWIG_GetPtrObj(ro, (void**)&ptr, "_wxBitmap_p")) | |
1554 | rval = *ptr; | |
1555 | Py_DECREF(ro); | |
1556 | } | |
1557 | } | |
1558 | wxPyEndBlockThreads(); | |
1559 | return rval; | |
1560 | } | |
1561 | ||
1562 | PYPRIVATE; | |
1563 | }; | |
1564 | %} | |
1565 | ||
1566 | // The one for SWIG to see | |
1567 | %name(wxArtProvider) class wxPyArtProvider : public wxObject | |
1568 | { | |
1569 | public: | |
1570 | wxPyArtProvider(); | |
1571 | ||
1572 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
1573 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxArtProvider)" | |
1574 | ||
1575 | // Add new provider to the top of providers stack. | |
1576 | static void PushProvider(wxPyArtProvider *provider); | |
1577 | ||
1578 | // Remove latest added provider and delete it. | |
1579 | static bool PopProvider(); | |
1580 | ||
1581 | // Remove provider. The provider must have been added previously! | |
1582 | // The provider is _not_ deleted. | |
1583 | static bool RemoveProvider(wxPyArtProvider *provider); | |
1584 | ||
1585 | // Query the providers for bitmap with given ID and return it. Return | |
1586 | // wxNullBitmap if no provider provides it. | |
1587 | static wxBitmap GetBitmap(const wxString& id, | |
1588 | const wxString& client = wxPyART_OTHER, | |
1589 | const wxSize& size = wxDefaultSize); | |
1590 | ||
1591 | // Query the providers for icon with given ID and return it. Return | |
1592 | // wxNullIcon if no provider provides it. | |
1593 | static wxIcon GetIcon(const wxString& id, | |
1594 | const wxString& client = wxPyART_OTHER, | |
1595 | const wxSize& size = wxDefaultSize); | |
1596 | ||
72797a7d RD |
1597 | }; |
1598 | ||
1599 | ||
7dbce44a RD |
1600 | //---------------------------------------------------------------------- |
1601 | ||
1602 | %{ | |
1603 | #include <wx/docview.h> | |
1604 | %} | |
1605 | ||
1606 | class wxFileHistory : public wxObject | |
1607 | { | |
1608 | public: | |
1609 | wxFileHistory(int maxFiles = 9); | |
1610 | ~wxFileHistory(); | |
1611 | ||
1612 | // Operations | |
1613 | void AddFileToHistory(const wxString& file); | |
1614 | void RemoveFileFromHistory(int i); | |
1615 | int GetMaxFiles() const; | |
1616 | void UseMenu(wxMenu *menu); | |
1617 | ||
1618 | // Remove menu from the list (MDI child may be closing) | |
1619 | void RemoveMenu(wxMenu *menu); | |
1620 | ||
1621 | void Load(wxConfigBase& config); | |
1622 | void Save(wxConfigBase& config); | |
1623 | ||
1624 | void AddFilesToMenu(); | |
68bc8549 | 1625 | %name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu); |
7dbce44a RD |
1626 | |
1627 | // Accessors | |
1628 | wxString GetHistoryFile(int i) const; | |
1629 | ||
1630 | // A synonym for GetNoHistoryFiles | |
1631 | int GetCount() const; | |
1632 | int GetNoHistoryFiles() const; | |
1633 | ||
1634 | }; | |
1635 | ||
4f3449b4 | 1636 | //---------------------------------------------------------------------- |
fd512ba2 RD |
1637 | |
1638 | class wxEffects: public wxObject | |
1639 | { | |
1640 | public: | |
1641 | // Assume system colours | |
1642 | wxEffects(); | |
1643 | ||
1644 | wxColour GetHighlightColour() const; | |
1645 | wxColour GetLightShadow() const; | |
1646 | wxColour GetFaceColour() const; | |
1647 | wxColour GetMediumShadow() const; | |
1648 | wxColour GetDarkShadow() const; | |
1649 | ||
1650 | void SetHighlightColour(const wxColour& c); | |
1651 | void SetLightShadow(const wxColour& c); | |
1652 | void SetFaceColour(const wxColour& c); | |
1653 | void SetMediumShadow(const wxColour& c); | |
1654 | void SetDarkShadow(const wxColour& c); | |
1655 | ||
1656 | void Set(const wxColour& highlightColour, const wxColour& lightShadow, | |
1657 | const wxColour& faceColour, const wxColour& mediumShadow, | |
1658 | const wxColour& darkShadow); | |
1659 | ||
1660 | // Draw a sunken edge | |
1661 | void DrawSunkenEdge(wxDC& dc, const wxRect& rect, int borderSize = 1); | |
1662 | ||
1663 | // Tile a bitmap | |
1664 | bool TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap); | |
1665 | ||
1666 | }; | |
1667 | ||
f0261a72 | 1668 | //---------------------------------------------------------------------- |
9416aa89 | 1669 | |
fd512ba2 RD |
1670 | class wxSingleInstanceChecker |
1671 | { | |
1672 | public: | |
1673 | // like Create() but no error checking (dangerous!) | |
1674 | wxSingleInstanceChecker(const wxString& name, | |
1675 | const wxString& path = wxPyEmptyString); | |
1676 | ||
1677 | // default ctor, use Create() after it | |
1678 | %name(wxPreSingleInstanceChecker) wxSingleInstanceChecker(); | |
1679 | ||
1680 | ~wxSingleInstanceChecker(); | |
1681 | ||
1682 | ||
1683 | // name must be given and be as unique as possible, it is used as the mutex | |
1684 | // name under Win32 and the lock file name under Unix - | |
1685 | // wxTheApp->GetAppName() may be a good value for this parameter | |
1686 | // | |
1687 | // path is optional and is ignored under Win32 and used as the directory to | |
1688 | // create the lock file in under Unix (default is wxGetHomeDir()) | |
1689 | // | |
1690 | // returns FALSE if initialization failed, it doesn't mean that another | |
1691 | // instance is running - use IsAnotherRunning() to check it | |
1692 | bool Create(const wxString& name, const wxString& path = wxPyEmptyString); | |
1693 | ||
1694 | // is another copy of this program already running? | |
1695 | bool IsAnotherRunning() const; | |
1696 | }; | |
1697 | ||
1698 | //---------------------------------------------------------------------- | |
1699 | ||
1700 | ||
9416aa89 | 1701 | %init %{ |
9416aa89 RD |
1702 | wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage"); |
1703 | wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess"); | |
72797a7d | 1704 | wxPyPtrTypeMap_Add("wxArtProvider", "wxPyArtProvider"); |
8baa46e9 | 1705 | |
9416aa89 RD |
1706 | %} |
1707 | ||
f0261a72 RD |
1708 | //---------------------------------------------------------------------- |
1709 |