]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/misc2.i
Corrected typo in wxStringHashTable::Delete
[wxWidgets.git] / wxPython / src / misc2.i
CommitLineData
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>
bb0054cd
RD
35%}
36
37//----------------------------------------------------------------------
38
39%include typemaps.i
40%include my_typemaps.i
41
42// Import some definitions of other classes, etc.
43%import _defs.i
44%import windows.i
f0261a72 45%import misc.i
06c0fba4 46%import gdi.i
b1462dfa 47%import events.i
c368d904 48%import streams.i
7dbce44a 49%import utils.i
06c0fba4 50
b68dc582 51
137b5242
RD
52//----------------------------------------------------------------------
53
54%{
55 // Put some wx default wxChar* values into wxStrings.
56 DECLARE_DEF_STRING(FileSelectorPromptStr);
57 DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr);
7cdaed0b 58 DECLARE_DEF_STRING(DirSelectorPromptStr);
137b5242
RD
59 static const wxString wxPyEmptyString(wxT(""));
60%}
61
06c0fba4
RD
62//---------------------------------------------------------------------------
63// Dialog Functions
64
137b5242
RD
65wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
66 const wxString& default_path = wxPyEmptyString,
67 const wxString& default_filename = wxPyEmptyString,
68 const wxString& default_extension = wxPyEmptyString,
69 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
06c0fba4
RD
70 int flags = 0,
71 wxWindow *parent = NULL,
72 int x = -1, int y = -1);
a541c325
RD
73
74// Ask for filename to load
137b5242
RD
75wxString wxLoadFileSelector(const wxString& what,
76 const wxString& extension,
77 const wxString& default_name = wxPyEmptyString,
a541c325
RD
78 wxWindow *parent = NULL);
79
80// Ask for filename to save
137b5242
RD
81wxString wxSaveFileSelector(const wxString& what,
82 const wxString& extension,
83 const wxString& default_name = wxPyEmptyString,
a541c325 84 wxWindow *parent = NULL);
06c0fba4 85
7cdaed0b
RD
86
87wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
88 const wxString& defaultPath = wxPyEmptyString,
daa3eac9 89 long style = wxDD_DEFAULT_STYLE,
7cdaed0b
RD
90 const wxPoint& pos = wxDefaultPosition,
91 wxWindow *parent = NULL);
92
06c0fba4 93wxString wxGetTextFromUser(const wxString& message,
137b5242
RD
94 const wxString& caption = wxPyEmptyString,
95 const wxString& default_value = wxPyEmptyString,
06c0fba4
RD
96 wxWindow *parent = NULL,
97 int x = -1, int y = -1,
98 bool centre = TRUE);
99
1b62f00d 100wxString wxGetPasswordFromUser(const wxString& message,
137b5242
RD
101 const wxString& caption = wxPyEmptyString,
102 const wxString& default_value = wxPyEmptyString,
1b62f00d
RD
103 wxWindow *parent = NULL);
104
06c0fba4
RD
105
106// TODO: Need to custom wrap this one...
107// int wxGetMultipleChoice(char* message, char* caption,
eec92d76 108// int LCOUNT, char** choices,
06c0fba4
RD
109// int nsel, int *selection,
110// wxWindow *parent = NULL, int x = -1, int y = -1,
111// bool centre = TRUE, int width=150, int height=200);
112
113
114wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
eec92d76 115 int LCOUNT, wxString* choices,
06c0fba4
RD
116 wxWindow *parent = NULL,
117 int x = -1, int y = -1,
118 bool centre = TRUE,
119 int width=150, int height=200);
120
121int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
eec92d76 122 int LCOUNT, wxString* choices,
06c0fba4
RD
123 wxWindow *parent = NULL,
124 int x = -1, int y = -1,
125 bool centre = TRUE,
126 int width=150, int height=200);
127
128
129int wxMessageBox(const wxString& message,
137b5242 130 const wxString& caption = wxPyEmptyString,
06c0fba4
RD
131 int style = wxOK | wxCENTRE,
132 wxWindow *parent = NULL,
133 int x = -1, int y = -1);
134
135long wxGetNumberFromUser(const wxString& message,
136 const wxString& prompt,
137 const wxString& caption,
138 long value,
139 long min = 0, long max = 100,
140 wxWindow *parent = NULL,
b68dc582 141 const wxPoint& pos = wxDefaultPosition);
06c0fba4
RD
142
143//---------------------------------------------------------------------------
144// GDI Functions
145
146bool wxColourDisplay();
1e7ecb7b 147
06c0fba4 148int wxDisplayDepth();
1e7ecb7b
RD
149int wxGetDisplayDepth();
150
ec5d7799 151void wxDisplaySize(int* OUTPUT, int* OUTPUT);
1e7ecb7b 152wxSize wxGetDisplaySize();
1b62f00d 153
ec5d7799 154void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT);
1e7ecb7b
RD
155wxSize wxGetDisplaySizeMM();
156
ec5d7799
RD
157void wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT);
158wxRect wxGetClientDisplayRect();
159
06c0fba4 160void wxSetCursor(wxCursor& cursor);
bb0054cd
RD
161
162//----------------------------------------------------------------------
06c0fba4 163// Miscellaneous functions
bb0054cd 164
06c0fba4
RD
165void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
166wxWindow * wxGetActiveWindow();
167
493f1553
RD
168wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
169wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
4dfaa61e
RD
170
171#ifdef __WXMSW__
493f1553 172bool wxCheckForInterrupt(wxWindow *wnd);
4dfaa61e
RD
173void wxFlushEvents();
174#endif
06c0fba4 175
2a74d141
RD
176wxWindow* wxGetTopLevelParent(wxWindow *win);
177
06c0fba4
RD
178//---------------------------------------------------------------------------
179// Resource System
180
137b5242 181bool wxResourceAddIdentifier(char* name, int value);
06c0fba4 182void wxResourceClear(void);
137b5242
RD
183wxBitmap wxResourceCreateBitmap(char* resource);
184wxIcon wxResourceCreateIcon(char* resource);
185wxMenuBar * wxResourceCreateMenuBar(char* resource);
186int wxResourceGetIdentifier(char* name);
187bool wxResourceParseData(char* resource, wxResourceTable *table = NULL);
188bool wxResourceParseFile(char* filename, wxResourceTable *table = NULL);
189bool wxResourceParseString(char* resource, wxResourceTable *table = NULL);
bb0054cd 190
06c0fba4
RD
191//---------------------------------------------------------------------------
192// System Settings
193
b5a5d647
RD
194// possible values for wxSystemSettings::GetFont() parameter
195//
196enum wxSystemFont
197{
198 wxSYS_OEM_FIXED_FONT = 10,
06c0fba4
RD
199 wxSYS_ANSI_FIXED_FONT,
200 wxSYS_ANSI_VAR_FONT,
201 wxSYS_SYSTEM_FONT,
202 wxSYS_DEVICE_DEFAULT_FONT,
203 wxSYS_DEFAULT_PALETTE,
204 wxSYS_SYSTEM_FIXED_FONT,
b5a5d647
RD
205 wxSYS_DEFAULT_GUI_FONT
206};
06c0fba4 207
b5a5d647
RD
208// possible values for wxSystemSettings::GetColour() parameter
209//
210enum wxSystemColour
211{
06c0fba4
RD
212 wxSYS_COLOUR_SCROLLBAR,
213 wxSYS_COLOUR_BACKGROUND,
c6c593e8 214 wxSYS_COLOUR_DESKTOP = wxSYS_COLOUR_BACKGROUND,
06c0fba4
RD
215 wxSYS_COLOUR_ACTIVECAPTION,
216 wxSYS_COLOUR_INACTIVECAPTION,
217 wxSYS_COLOUR_MENU,
218 wxSYS_COLOUR_WINDOW,
219 wxSYS_COLOUR_WINDOWFRAME,
220 wxSYS_COLOUR_MENUTEXT,
221 wxSYS_COLOUR_WINDOWTEXT,
222 wxSYS_COLOUR_CAPTIONTEXT,
223 wxSYS_COLOUR_ACTIVEBORDER,
224 wxSYS_COLOUR_INACTIVEBORDER,
225 wxSYS_COLOUR_APPWORKSPACE,
226 wxSYS_COLOUR_HIGHLIGHT,
227 wxSYS_COLOUR_HIGHLIGHTTEXT,
228 wxSYS_COLOUR_BTNFACE,
c6c593e8 229 wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE,
06c0fba4 230 wxSYS_COLOUR_BTNSHADOW,
c6c593e8 231 wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW,
06c0fba4
RD
232 wxSYS_COLOUR_GRAYTEXT,
233 wxSYS_COLOUR_BTNTEXT,
234 wxSYS_COLOUR_INACTIVECAPTIONTEXT,
235 wxSYS_COLOUR_BTNHIGHLIGHT,
c6c593e8
RD
236 wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
237 wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
238 wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
06c0fba4
RD
239 wxSYS_COLOUR_3DDKSHADOW,
240 wxSYS_COLOUR_3DLIGHT,
241 wxSYS_COLOUR_INFOTEXT,
242 wxSYS_COLOUR_INFOBK,
b5a5d647 243 wxSYS_COLOUR_LISTBOX,
c6c593e8
RD
244 wxSYS_COLOUR_HOTLIGHT,
245 wxSYS_COLOUR_GRADIENTACTIVECAPTION,
246 wxSYS_COLOUR_GRADIENTINACTIVECAPTION,
247 wxSYS_COLOUR_MENUHILIGHT,
248 wxSYS_COLOUR_MENUBAR,
b5a5d647 249
c6c593e8 250 wxSYS_COLOUR_MAX
b5a5d647 251};
06c0fba4 252
b5a5d647
RD
253// possible values for wxSystemSettings::GetMetric() parameter
254//
255enum wxSystemMetric
256{
257 wxSYS_MOUSE_BUTTONS = 1,
06c0fba4
RD
258 wxSYS_BORDER_X,
259 wxSYS_BORDER_Y,
260 wxSYS_CURSOR_X,
261 wxSYS_CURSOR_Y,
262 wxSYS_DCLICK_X,
263 wxSYS_DCLICK_Y,
264 wxSYS_DRAG_X,
265 wxSYS_DRAG_Y,
266 wxSYS_EDGE_X,
267 wxSYS_EDGE_Y,
268 wxSYS_HSCROLL_ARROW_X,
269 wxSYS_HSCROLL_ARROW_Y,
270 wxSYS_HTHUMB_X,
271 wxSYS_ICON_X,
272 wxSYS_ICON_Y,
273 wxSYS_ICONSPACING_X,
274 wxSYS_ICONSPACING_Y,
275 wxSYS_WINDOWMIN_X,
276 wxSYS_WINDOWMIN_Y,
277 wxSYS_SCREEN_X,
278 wxSYS_SCREEN_Y,
279 wxSYS_FRAMESIZE_X,
280 wxSYS_FRAMESIZE_Y,
281 wxSYS_SMALLICON_X,
282 wxSYS_SMALLICON_Y,
283 wxSYS_HSCROLL_Y,
284 wxSYS_VSCROLL_X,
285 wxSYS_VSCROLL_ARROW_X,
286 wxSYS_VSCROLL_ARROW_Y,
287 wxSYS_VTHUMB_Y,
288 wxSYS_CAPTION_Y,
289 wxSYS_MENU_Y,
290 wxSYS_NETWORK_PRESENT,
291 wxSYS_PENWINDOWS_PRESENT,
292 wxSYS_SHOW_SOUNDS,
b5a5d647 293 wxSYS_SWAP_BUTTONS
06c0fba4
RD
294};
295
b5a5d647
RD
296// possible values for wxSystemSettings::HasFeature() parameter
297enum wxSystemFeature
298{
299 wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1,
300 wxSYS_CAN_ICONIZE_FRAME
301};
06c0fba4 302
12bfbb29 303enum wxSystemScreenType
daa3eac9
RD
304{
305 wxSYS_SCREEN_NONE = 0, // not yet defined
12bfbb29
RD
306
307 wxSYS_SCREEN_TINY, // <
daa3eac9 308 wxSYS_SCREEN_PDA, // >= 320x240
12bfbb29
RD
309 wxSYS_SCREEN_SMALL, // >= 640x480
310 wxSYS_SCREEN_DESKTOP // >= 800x600
daa3eac9 311};
06c0fba4 312
06c0fba4 313
b5a5d647
RD
314class wxSystemSettings {
315public:
316 // get a standard system colour
317 static wxColour GetColour(wxSystemColour index);
318
319 // get a standard system font
320 static wxFont GetFont(wxSystemFont index);
321
322 // get a system-dependent metric
323 static int GetMetric(wxSystemMetric index);
324
325 // return true if the port has certain feature
326 static bool HasFeature(wxSystemFeature index);
327
0b85cc38
RD
328 // Get system screen design (desktop, pda, ..) used for
329 // laying out various dialogs.
12bfbb29 330 static wxSystemScreenType GetScreenType();
daa3eac9 331
0b85cc38 332 // Override default.
12bfbb29 333 static void SetScreenType( wxSystemScreenType screen );
daa3eac9 334
b5a5d647 335};
06c0fba4 336
06c0fba4 337
bb0054cd
RD
338
339//---------------------------------------------------------------------------
340// wxToolTip
341
9416aa89 342class wxToolTip : public wxObject {
bb0054cd
RD
343public:
344 wxToolTip(const wxString &tip);
345
346 void SetTip(const wxString& tip);
347 wxString GetTip();
348 // *** Not in the "public" interface void SetWindow(wxWindow *win);
349 wxWindow *GetWindow();
bb0054cd 350
edf2f43e
RD
351 static void Enable(bool flag);
352 static void SetDelay(long milliseconds);
353};
bb0054cd
RD
354
355//----------------------------------------------------------------------
f0261a72
RD
356
357class wxCaret {
358public:
359 wxCaret(wxWindow* window, const wxSize& size);
360 ~wxCaret();
361
362 bool IsOk();
363 bool IsVisible();
364 %name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT);
365 wxPoint GetPosition();
366 %name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT);
367 wxSize GetSize();
368 wxWindow *GetWindow();
369 %name(MoveXY)void Move(int x, int y);
370 void Move(const wxPoint& pt);
a1df7a95
RD
371 %name(SetSizeWH) void SetSize(int width, int height);
372 void SetSize(const wxSize& size);
f0261a72
RD
373 void Show(int show = TRUE);
374 void Hide();
f0261a72
RD
375};
376
377%inline %{
378 int wxCaret_GetBlinkTime() {
379 return wxCaret::GetBlinkTime();
380 }
381
382 void wxCaret_SetBlinkTime(int milliseconds) {
383 wxCaret::SetBlinkTime(milliseconds);
384 }
385%}
386
bb0054cd 387//----------------------------------------------------------------------
f0261a72 388
2abc0a0f
RD
389class wxBusyCursor {
390public:
391 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
392 ~wxBusyCursor();
393};
394
b1462dfa 395//----------------------------------------------------------------------
2abc0a0f 396
c368d904
RD
397class wxWindowDisabler {
398public:
399 wxWindowDisabler(wxWindow *winToSkip = NULL);
400 ~wxWindowDisabler();
401};
402
403//----------------------------------------------------------------------
404
6e18ca6c 405bool wxSafeYield(wxWindow* win=NULL);
b1462dfa 406void wxPostEvent(wxEvtHandler *dest, wxEvent& event);
694759cf 407void wxWakeUpIdle();
2abc0a0f 408
6e18ca6c 409
4662be59 410#ifdef __WXMSW__
6e18ca6c 411void wxWakeUpMainThread();
4662be59
RD
412#endif
413
6e18ca6c
RD
414void wxMutexGuiEnter();
415void wxMutexGuiLeave();
416
417
418class wxMutexGuiLocker {
419public:
420 wxMutexGuiLocker();
421 ~wxMutexGuiLocker();
422};
423
424
425%inline %{
426 bool wxThread_IsMain() {
00ca6262 427#ifdef WXP_WITH_THREAD
6e18ca6c 428 return wxThread::IsMain();
00ca6262
RD
429#else
430 return TRUE;
431#endif
6e18ca6c
RD
432 }
433%}
c368d904 434
2abc0a0f 435//----------------------------------------------------------------------
f6bcfd97
BP
436
437
438class wxTipProvider
439{
440public:
441 // wxTipProvider(size_t currentTip); **** Abstract base class
442 ~wxTipProvider();
443
444 virtual wxString GetTip() = 0;
445 size_t GetCurrentTip();
446
447};
448
449
450// The C++ version of wxPyTipProvider
451%{
452class wxPyTipProvider : public wxTipProvider {
453public:
454 wxPyTipProvider(size_t currentTip)
455 : wxTipProvider(currentTip) {}
456
457 DEC_PYCALLBACK_STRING__pure(GetTip);
458
459 PYPRIVATE;
460};
461
462IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip);
463
464%}
465
466
467// Now let SWIG know about it
468class wxPyTipProvider : public wxTipProvider {
469public:
470 wxPyTipProvider(size_t currentTip);
471};
472
473
474
475bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = TRUE);
476%new wxTipProvider * wxCreateFileTipProvider(const wxString& filename, size_t currentTip);
477
478
479//----------------------------------------------------------------------
480
481%{
482#include <wx/generic/dragimgg.h>
f6bcfd97
BP
483%}
484
9416aa89 485%name (wxDragImage) class wxGenericDragImage : public wxObject
f6bcfd97
BP
486{
487public:
488
489 wxGenericDragImage(const wxBitmap& image,
10e07c70 490 const wxCursor& cursor = wxNullCursor);
cdf14688
RD
491 %name(wxDragIcon)wxGenericDragImage(const wxIcon& image,
492 const wxCursor& cursor = wxNullCursor);
493 %name(wxDragString)wxGenericDragImage(const wxString& str,
494 const wxCursor& cursor = wxNullCursor);
495 %name(wxDragTreeItem)wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
496 %name(wxDragListItem)wxGenericDragImage(const wxListCtrl& listCtrl, long id);
497
f6bcfd97
BP
498 ~wxGenericDragImage();
499
10e07c70 500 void SetBackingBitmap(wxBitmap* bitmap);
f6bcfd97
BP
501 bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
502 bool fullScreen = FALSE, wxRect* rect = NULL);
503
504 %name(BeginDrag2) bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
505 wxWindow* fullScreenRect);
506
507 bool EndDrag();
508 bool Move(const wxPoint& pt);
509 bool Show();
510 bool Hide();
511
512 wxRect GetImageRect(const wxPoint& pos) const;
513 bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos,
514 bool eraseOld, bool drawNew);
515};
516
517
f6bcfd97
BP
518//----------------------------------------------------------------------
519
9416aa89 520class wxPyTimer : public wxObject {
f6bcfd97
BP
521public:
522 wxPyTimer(PyObject* notify);
523 ~wxPyTimer();
524 int GetInterval();
525 bool IsOneShot();
526 bool IsRunning();
527 void SetOwner(wxEvtHandler *owner, int id = -1);
528 void Start(int milliseconds=-1, int oneShot=FALSE);
529 void Stop();
530};
531
b37c7e1d
RD
532
533class wxStopWatch
534{
535public:
536 // ctor starts the stop watch
537 wxStopWatch();
68320e40 538 ~wxStopWatch();
b37c7e1d
RD
539 void Start(long t = 0);
540 void Pause();
541 void Resume();
542
543 // get elapsed time since the last Start() or Pause() in milliseconds
544 long Time() const;
545};
546
547
f6bcfd97
BP
548//----------------------------------------------------------------------
549//----------------------------------------------------------------------
550
551
552enum
553{
554 wxLOG_FatalError, // program can't continue, abort immediately
555 wxLOG_Error, // a serious error, user must be informed about it
556 wxLOG_Warning, // user is normally informed about it but may be ignored
557 wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
558 wxLOG_Info, // informational message (a.k.a. 'Verbose')
559 wxLOG_Status, // informational: might go to the status line of GUI app
560 wxLOG_Debug, // never shown to the user, disabled in release mode
561 wxLOG_Trace, // trace messages are also only enabled in debug mode
562 wxLOG_Progress, // used for progress indicator (not yet)
563 wxLOG_User = 100 // user defined levels start here
564};
565
566
567class wxLog
568{
569public:
570 wxLog();
571
572 static bool IsEnabled();
573 static bool EnableLogging(bool doIt = TRUE);
c8bc7bb8 574 static void OnLog(wxLogLevel level, const wxString& szString, int t=0);
f6bcfd97
BP
575
576 virtual void Flush();
577 bool HasPendingMessages() const;
578
579 static void FlushActive();
580 static wxLog *GetActiveTarget();
581 static wxLog *SetActiveTarget(wxLog *pLogger);
582
583 static void Suspend();
584 static void Resume();
585
d6eacb25 586 static void SetVerbose(bool bVerbose = TRUE);
f6bcfd97
BP
587
588 static void DontCreateOnDemand();
589 static void SetTraceMask(wxTraceMask ulMask);
590 static void AddTraceMask(const wxString& str);
591 static void RemoveTraceMask(const wxString& str);
76bfdc78
RD
592 static void ClearTraceMasks();
593
137b5242
RD
594 static void SetTimestamp(const wxString& ts);
595 static const wxString& GetTimestamp();
f6bcfd97 596
19e30148 597 bool GetVerbose() const;
f6bcfd97
BP
598
599 static wxTraceMask GetTraceMask();
c8bc7bb8 600 static bool IsAllowedTraceMask(const wxString& mask);
f6bcfd97 601
76bfdc78
RD
602 // static void TimeStamp(wxString *str);
603 %addmethods {
604 wxString TimeStamp() {
605 wxString msg;
606 wxLog::TimeStamp(&msg);
607 return msg;
608 }
609 }
d6eacb25 610
f6bcfd97
BP
611};
612
613
614class wxLogStderr : public wxLog
615{
616public:
617 wxLogStderr(/* TODO: FILE *fp = (FILE *) NULL*/);
618};
619
620
621class wxLogTextCtrl : public wxLog
622{
623public:
624 wxLogTextCtrl(wxTextCtrl *pTextCtrl);
625};
626
627
628class wxLogGui : public wxLog
629{
630public:
631 wxLogGui();
632};
633
634class wxLogWindow : public wxLog
635{
636public:
637 wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL)
c8bc7bb8 638 const wxString& szTitle, // the title of the frame
f6bcfd97
BP
639 bool bShow = TRUE, // show window immediately?
640 bool bPassToOld = TRUE); // pass log messages to the old target?
641
642 void Show(bool bShow = TRUE);
643 wxFrame *GetFrame() const;
644 wxLog *GetOldLog() const;
645 bool IsPassingMessages() const;
c8bc7bb8 646 void PassMessages(bool bDoPass);
f6bcfd97
BP
647};
648
649
76bfdc78
RD
650class wxLogChain : public wxLog
651{
652public:
653 wxLogChain(wxLog *logger);
654 void SetLog(wxLog *logger);
655 void PassMessages(bool bDoPass);
656 bool IsPassingMessages();
657 wxLog *GetOldLog();
658};
659
660
f6bcfd97 661unsigned long wxSysErrorCode();
c8bc7bb8
RD
662const wxString wxSysErrorMsg(unsigned long nErrCode = 0);
663void wxLogFatalError(const wxString& szFormat);
664void wxLogError(const wxString& szFormat);
665void wxLogWarning(const wxString& szFormat);
666void wxLogMessage(const wxString& szFormat);
667void wxLogInfo(const wxString& szFormat);
668void wxLogVerbose(const wxString& szFormat);
669void wxLogStatus(const wxString& szFormat);
670%name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const wxString& szFormat);
671void wxLogSysError(const wxString& szFormat);
f6bcfd97 672
b7fc54be
RD
673// wxLogFatalError helper: show the (fatal) error to the user in a safe way,
674// i.e. without using wxMessageBox() for example because it could crash
0b85cc38 675void wxSafeShowMessage(const wxString& title, const wxString& text);
b7fc54be
RD
676
677
678
19e30148
RD
679// Suspress logging while an instance of this class exists
680class wxLogNull
681{
682public:
683 wxLogNull();
684 ~wxLogNull();
685};
686
687
688
f6bcfd97 689
76bfdc78 690%{
19e30148 691// A wxLog class that can be derived from in wxPython
76bfdc78
RD
692class wxPyLog : public wxLog {
693public:
694 wxPyLog() : wxLog() {}
695
696 virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
697 bool found;
4268f798 698 wxPyBeginBlockThreads();
76bfdc78 699 if ((found = wxPyCBH_findCallback(m_myInst, "DoLog")))
a541c325
RD
700 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level,
701 wx2PyString(szString), t));
4268f798 702 wxPyEndBlockThreads();
76bfdc78
RD
703 if (! found)
704 wxLog::DoLog(level, szString, t);
705 }
706
707 virtual void DoLogString(const wxChar *szString, time_t t) {
708 bool found;
4268f798 709 wxPyBeginBlockThreads();
76bfdc78 710 if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString")))
a541c325
RD
711 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)",
712 wx2PyString(szString), t));
4268f798 713 wxPyEndBlockThreads();
76bfdc78
RD
714 if (! found)
715 wxLog::DoLogString(szString, t);
716 }
717
718 PYPRIVATE;
719};
720%}
721
722// Now tell SWIG about it
723class wxPyLog : public wxLog {
724public:
725 wxPyLog();
0122b7e3
RD
726 void _setCallbackInfo(PyObject* self, PyObject* _class);
727 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyLog)"
76bfdc78
RD
728 %addmethods { void Destroy() { delete self; } }
729
730};
731
c368d904
RD
732
733//----------------------------------------------------------------------
734
1b62f00d
RD
735
736enum {
737 /* event type */
738 wxEVT_END_PROCESS
739};
740
741
c368d904
RD
742class wxProcessEvent : public wxEvent {
743public:
744 wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0);
745 int GetPid();
746 int GetExitCode();
747 int m_pid, m_exitcode;
748};
749
750
751
752
753%{ // C++ version of wxProcess derived class
754
755class wxPyProcess : public wxProcess {
756public:
757 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
758 : wxProcess(parent, id)
759 {}
760
761 DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
762
763 PYPRIVATE;
764};
765
766IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate);
19a97bd6 767
c368d904
RD
768%}
769
770
771%name(wxProcess)class wxPyProcess : public wxEvtHandler {
772public:
773 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1);
774 %addmethods { void Destroy() { delete self; } }
775
0122b7e3
RD
776 void _setCallbackInfo(PyObject* self, PyObject* _class);
777 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxProcess)"
c368d904
RD
778
779 void base_OnTerminate(int pid, int status);
780
781 void Redirect();
782 bool IsRedirected();
783 void Detach();
784
785 wxInputStream *GetInputStream();
786 wxInputStream *GetErrorStream();
787 wxOutputStream *GetOutputStream();
788
789 void CloseOutput();
790};
791
792
d6eacb25
RD
793enum
794{
795 // execute the process asynchronously
796 wxEXEC_ASYNC = 0,
797
798 // execute it synchronously, i.e. wait until it finishes
799 wxEXEC_SYNC = 1,
800
801 // under Windows, don't hide the child even if it's IO is redirected (this
802 // is done by default)
803 wxEXEC_NOHIDE = 2,
804
805 // under Unix, if the process is the group leader then killing -pid kills
806 // all children as well as pid
807 wxEXEC_MAKE_GROUP_LEADER = 4
b96c7a38
RD
808};
809
c368d904
RD
810
811long wxExecute(const wxString& command,
b96c7a38 812 int flags = wxEXEC_ASYNC,
c368d904
RD
813 wxPyProcess *process = NULL);
814
185d7c3e
RD
815//----------------------------------------------------------------------
816
493f1553
RD
817%{
818#if !wxUSE_JOYSTICK && !defined(__WXMSW__)
819// A C++ stub class for wxJoystick for platforms that don't have it.
820class wxJoystick : public wxObject {
821public:
822 wxJoystick(int joystick = wxJOYSTICK1) {
4268f798 823 wxPyBeginBlockThreads();
493f1553 824 PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
4268f798 825 wxPyEndBlockThreads();
493f1553
RD
826 }
827 wxPoint GetPosition() { return wxPoint(-1,-1); }
828 int GetZPosition() { return -1; }
829 int GetButtonState() { return -1; }
830 int GetPOVPosition() { return -1; }
831 int GetPOVCTSPosition() { return -1; }
832 int GetRudderPosition() { return -1; }
833 int GetUPosition() { return -1; }
834 int GetVPosition() { return -1; }
835 int GetMovementThreshold() { return -1; }
d56cebe7 836 void SetMovementThreshold(int threshold) {}
493f1553
RD
837
838 bool IsOk(void) { return FALSE; }
839 int GetNumberJoysticks() { return -1; }
840 int GetManufacturerId() { return -1; }
841 int GetProductId() { return -1; }
842 wxString GetProductName() { return ""; }
843 int GetXMin() { return -1; }
844 int GetYMin() { return -1; }
845 int GetZMin() { return -1; }
846 int GetXMax() { return -1; }
847 int GetYMax() { return -1; }
848 int GetZMax() { return -1; }
849 int GetNumberButtons() { return -1; }
850 int GetNumberAxes() { return -1; }
851 int GetMaxButtons() { return -1; }
852 int GetMaxAxes() { return -1; }
853 int GetPollingMin() { return -1; }
854 int GetPollingMax() { return -1; }
855 int GetRudderMin() { return -1; }
856 int GetRudderMax() { return -1; }
857 int GetUMin() { return -1; }
858 int GetUMax() { return -1; }
859 int GetVMin() { return -1; }
860 int GetVMax() { return -1; }
861
862 bool HasRudder() { return FALSE; }
863 bool HasZ() { return FALSE; }
864 bool HasU() { return FALSE; }
865 bool HasV() { return FALSE; }
866 bool HasPOV() { return FALSE; }
867 bool HasPOV4Dir() { return FALSE; }
868 bool HasPOVCTS() { return FALSE; }
869
870 bool SetCapture(wxWindow* win, int pollingFreq = 0) { return FALSE; }
871 bool ReleaseCapture() { return FALSE; }
872};
873#endif
874%}
875
876
9416aa89 877class wxJoystick : public wxObject {
185d7c3e
RD
878public:
879 wxJoystick(int joystick = wxJOYSTICK1);
ac346f50
RD
880 ~wxJoystick();
881
185d7c3e
RD
882 wxPoint GetPosition();
883 int GetZPosition();
884 int GetButtonState();
885 int GetPOVPosition();
886 int GetPOVCTSPosition();
887 int GetRudderPosition();
888 int GetUPosition();
889 int GetVPosition();
890 int GetMovementThreshold();
891 void SetMovementThreshold(int threshold) ;
892
893 bool IsOk(void);
894 int GetNumberJoysticks();
895 int GetManufacturerId();
896 int GetProductId();
897 wxString GetProductName();
898 int GetXMin();
899 int GetYMin();
900 int GetZMin();
901 int GetXMax();
902 int GetYMax();
903 int GetZMax();
904 int GetNumberButtons();
905 int GetNumberAxes();
906 int GetMaxButtons();
907 int GetMaxAxes();
908 int GetPollingMin();
909 int GetPollingMax();
910 int GetRudderMin();
911 int GetRudderMax();
912 int GetUMin();
913 int GetUMax();
914 int GetVMin();
915 int GetVMax();
916
917 bool HasRudder();
918 bool HasZ();
919 bool HasU();
920 bool HasV();
921 bool HasPOV();
922 bool HasPOV4Dir();
923 bool HasPOVCTS();
924
925 bool SetCapture(wxWindow* win, int pollingFreq = 0);
926 bool ReleaseCapture();
927};
493f1553
RD
928
929//----------------------------------------------------------------------
930
931%{
0adbc166 932#if !wxUSE_WAVE
493f1553
RD
933// A C++ stub class for wxWave for platforms that don't have it.
934class wxWave : public wxObject
935{
936public:
937 wxWave(const wxString& fileName, bool isResource = FALSE) {
4268f798 938 wxPyBeginBlockThreads();
493f1553 939 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
4268f798 940 wxPyEndBlockThreads();
493f1553
RD
941 }
942 wxWave(int size, const wxByte* data) {
4268f798 943 wxPyBeginBlockThreads();
493f1553 944 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
4268f798 945 wxPyEndBlockThreads();
493f1553
RD
946 }
947
948 ~wxWave() {}
949
950 bool IsOk() const { return FALSE; }
951 bool Play(bool async = TRUE, bool looped = FALSE) const { return FALSE; }
952};
953
2cd2fac8 954#endif
493f1553
RD
955%}
956
957class wxWave : public wxObject
958{
959public:
960 wxWave(const wxString& fileName, bool isResource = FALSE);
961 ~wxWave();
962
963 bool IsOk() const;
964 bool Play(bool async = TRUE, bool looped = FALSE) const;
965};
966
967%new wxWave* wxWaveData(const wxString& data);
968%{ // Implementations of some alternate "constructors"
969 wxWave* wxWaveData(const wxString& data) {
970 return new wxWave(data.Len(), (wxByte*)data.c_str());
971 }
972%}
185d7c3e 973
4f3449b4 974
b37c7e1d
RD
975//----------------------------------------------------------------------
976
977enum wxMailcapStyle
978{
979 wxMAILCAP_STANDARD = 1,
980 wxMAILCAP_NETSCAPE = 2,
981 wxMAILCAP_KDE = 4,
982 wxMAILCAP_GNOME = 8,
983
984 wxMAILCAP_ALL = 15
985};
986
987
988
989class wxFileTypeInfo
990{
991public:
992 // ctors
993 // a normal item
137b5242
RD
994 wxFileTypeInfo(const char* mimeType,
995 const char* openCmd,
996 const char* printCmd,
997 const char* desc);
b37c7e1d
RD
998
999
1000 // the array elements correspond to the parameters of the ctor above in
1001 // the same order
1002 %name(wxFileTypeInfoSequence)wxFileTypeInfo(const wxArrayString& sArray);
1003
1004 // invalid item - use this to terminate the array passed to
1005 // wxMimeTypesManager::AddFallbacks
1006 %name(wxNullFileTypeInfo)wxFileTypeInfo();
1007
1008
1009 // test if this object can be used
1010 bool IsValid() const;
1011
1012 // setters
1013 // set the icon info
1014 void SetIcon(const wxString& iconFile, int iconIndex = 0);
1015
1016 // set the short desc
1017 void SetShortDesc(const wxString& shortDesc);
1018
1019 // accessors
1020 // get the MIME type
1021 const wxString& GetMimeType() const;
1022 // get the open command
1023 const wxString& GetOpenCommand() const;
1024 // get the print command
1025 const wxString& GetPrintCommand() const;
1026 // get the short description (only used under Win32 so far)
1027 const wxString& GetShortDesc() const;
1028 // get the long, user visible description
1029 const wxString& GetDescription() const;
1030
1031
1032 // get the array of all extensions
1033 //const wxArrayString& GetExtensions() const;
1034 %addmethods {
1035 PyObject* GetExtensions() {
1036 wxArrayString& arr = (wxArrayString&)self->GetExtensions();
1037 return wxArrayString2PyList_helper(arr);
1038 }
1039 }
1040
1041 int GetExtensionsCount() const;
1042
1043 // get the icon info
1044 const wxString& GetIconFile() const;
1045 int GetIconIndex() const;
1046};
1047
1048
1049
1050
1051class wxFileType
1052{
1053public:
1054
1055 // TODO: Make a wxPyMessageParameters with virtual GetParamValue...
1056
1057 // An object of this class must be passed to Get{Open|Print}Command. The
1058 // default implementation is trivial and doesn't know anything at all about
1059 // parameters, only filename and MIME type are used (so it's probably ok for
1060 // Windows where %{param} is not used anyhow)
1061 class MessageParameters
1062 {
1063 public:
1064 // ctors
137b5242
RD
1065 MessageParameters(const wxString& filename=wxPyEmptyString,
1066 const wxString& mimetype=wxPyEmptyString);
b37c7e1d
RD
1067
1068 // accessors (called by GetOpenCommand)
1069 // filename
1070 const wxString& GetFileName() const;
1071 // mime type
1072 const wxString& GetMimeType() const;;
1073
1074 // override this function in derived class
1075 virtual wxString GetParamValue(const wxString& name) const;
1076
1077 // virtual dtor as in any base class
1078 virtual ~MessageParameters();
1079 };
1080
1081
1082 // ctor from static data
1083 wxFileType(const wxFileTypeInfo& ftInfo);
1084
1085 // return the MIME type for this file type
1086 %addmethods {
1087 PyObject* GetMimeType() {
1088 wxString str;
c8bc7bb8
RD
1089 if (self->GetMimeType(&str)) {
1090#if wxUSE_UNICODE
1091 return PyUnicode_FromUnicode(str.c_str(), str.Len());
1092#else
1093 return PyString_FromStringAndSize(str.c_str(), str.Len());
1094#endif
1095 }
b37c7e1d
RD
1096 else
1097 RETURN_NONE();
1098 }
1099 PyObject* GetMimeTypes() {
1100 wxArrayString arr;
1101 if (self->GetMimeTypes(arr))
1102 return wxArrayString2PyList_helper(arr);
1103 else
1104 RETURN_NONE();
1105 }
1106 }
1107
1108
1109 // Get all extensions associated with this file type
1110 %addmethods {
1111 PyObject* GetExtensions() {
1112 wxArrayString arr;
1113 if (self->GetExtensions(arr))
1114 return wxArrayString2PyList_helper(arr);
1115 else
1116 RETURN_NONE();
1117 }
1118 }
1119
1120
1121 %addmethods {
1122 // Get the icon corresponding to this file type
1123 %new wxIcon* GetIcon() {
1124 wxIcon icon;
1125 if (self->GetIcon(&icon))
1126 return new wxIcon(icon);
1127 else
1128 return NULL;
1129 }
1130
1131 // Get the icon corresponding to this file type, the name of the file
1132 // where this icon resides, and its index in this file if applicable.
1133 PyObject* GetIconInfo() {
1134 wxIcon icon;
1135 wxString iconFile;
1136 int iconIndex;
1137 if (self->GetIcon(&icon, &iconFile, &iconIndex)) {
4268f798 1138 wxPyBeginBlockThreads();
b37c7e1d
RD
1139 PyObject* tuple = PyTuple_New(3);
1140 PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(icon),
1141 "wxIcon", TRUE));
c8bc7bb8
RD
1142#if wxUSE_UNICODE
1143 PyTuple_SetItem(tuple, 1, PyUnicode_FromUnicode(iconFile.c_str(), iconFile.Len()));
1144#else
1145 PyTuple_SetItem(tuple, 1, PyString_FromStringAndSize(iconFile.c_str(), iconFile.Len()));
1146#endif
b37c7e1d 1147 PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex));
4268f798 1148 wxPyEndBlockThreads();
b37c7e1d
RD
1149 return tuple;
1150 }
1151 else
1152 RETURN_NONE();
1153 }
1154 }
1155
1156 %addmethods {
1157 // get a brief file type description ("*.txt" => "text document")
1158 PyObject* GetDescription() {
1159 wxString str;
c8bc7bb8
RD
1160 if (self->GetDescription(&str)) {
1161#if wxUSE_UNICODE
1162 return PyUnicode_FromUnicode(str.c_str(), str.Len());
1163#else
1164 return PyString_FromStringAndSize(str.c_str(), str.Len());
1165#endif
1166 } else
b37c7e1d
RD
1167 RETURN_NONE();
1168 }
1169 }
1170
1171
1172 // get the command to open/execute the file of given type
1173 %addmethods {
1174 PyObject* GetOpenCommand(const wxString& filename,
137b5242 1175 const wxString& mimetype=wxPyEmptyString) {
b37c7e1d 1176 wxString str;
c8bc7bb8
RD
1177 if (self->GetOpenCommand(&str, wxFileType::MessageParameters(filename, mimetype))) {
1178#if wxUSE_UNICODE
1179 return PyUnicode_FromUnicode(str.c_str(), str.Len());
1180#else
1181 return PyString_FromStringAndSize(str.c_str(), str.Len());
1182#endif
1183 } else
b37c7e1d
RD
1184 RETURN_NONE();
1185 }
1186 }
1187
1188
1189 // get the command to print the file of given type
1190 %addmethods {
1191 PyObject* GetPrintCommand(const wxString& filename,
137b5242 1192 const wxString& mimetype=wxPyEmptyString) {
b37c7e1d 1193 wxString str;
c8bc7bb8
RD
1194 if (self->GetPrintCommand(&str, wxFileType::MessageParameters(filename, mimetype))) {
1195#if wxUSE_UNICODE
1196 return PyUnicode_FromUnicode(str.c_str(), str.Len());
1197#else
1198 return PyString_FromStringAndSize(str.c_str(), str.Len());
1199#endif
1200 } else
b37c7e1d
RD
1201 RETURN_NONE();
1202 }
1203 }
1204
1205
1206 // Get all commands defined for this file type
1207 %addmethods {
1208 PyObject* GetAllCommands(const wxString& filename,
137b5242 1209 const wxString& mimetype=wxPyEmptyString) {
b37c7e1d
RD
1210 wxArrayString verbs;
1211 wxArrayString commands;
1212 if (self->GetAllCommands(&verbs, &commands,
1213 wxFileType::MessageParameters(filename, mimetype))) {
4268f798 1214 wxPyBeginBlockThreads();
b37c7e1d
RD
1215 PyObject* tuple = PyTuple_New(2);
1216 PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs));
1217 PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands));
4268f798 1218 wxPyEndBlockThreads();
b37c7e1d
RD
1219 return tuple;
1220 }
1221 else
1222 RETURN_NONE();
1223 }
1224 }
1225
1226
1227 // set an arbitrary command, ask confirmation if it already exists and
1228 // overwriteprompt is TRUE
1229 bool SetCommand(const wxString& cmd, const wxString& verb,
1230 bool overwriteprompt = TRUE);
1231
137b5242 1232 bool SetDefaultIcon(const wxString& cmd = wxPyEmptyString, int index = 0);
b37c7e1d
RD
1233
1234
1235 // remove the association for this filetype from the system MIME database:
1236 // notice that it will only work if the association is defined in the user
1237 // file/registry part, we will never modify the system-wide settings
1238 bool Unassociate();
1239
1240 // operations
1241 // expand a string in the format of GetOpenCommand (which may contain
1242 // '%s' and '%t' format specificators for the file name and mime type
1243 // and %{param} constructions).
1244 static wxString ExpandCommand(const wxString& command,
1245 const MessageParameters& params);
1246
1247 // dtor (not virtual, shouldn't be derived from)
1248 ~wxFileType();
1249
1250};
1251
1252
1253
1254
1255class wxMimeTypesManager
1256{
1257public:
1258 // static helper functions
1259 // -----------------------
1260
1261 // check if the given MIME type is the same as the other one: the
1262 // second argument may contain wildcards ('*'), but not the first. If
1263 // the types are equal or if the mimeType matches wildcard the function
1264 // returns TRUE, otherwise it returns FALSE
1265 static bool IsOfType(const wxString& mimeType, const wxString& wildcard);
1266
1267 // ctor
1268 wxMimeTypesManager();
1269
1270 // loads data from standard files according to the mailcap styles
1271 // specified: this is a bitwise OR of wxMailcapStyle values
1272 //
1273 // use the extraDir parameter if you want to look for files in another
1274 // directory
1275 void Initialize(int mailcapStyle = wxMAILCAP_STANDARD,
137b5242 1276 const wxString& extraDir = wxPyEmptyString);
b37c7e1d
RD
1277
1278 // and this function clears all the data from the manager
1279 void ClearData();
1280
1281 // Database lookup: all functions return a pointer to wxFileType object
1282 // whose methods may be used to query it for the information you're
1283 // interested in. If the return value is !NULL, caller is responsible for
1284 // deleting it.
1285 // get file type from file extension
1286 %new wxFileType *GetFileTypeFromExtension(const wxString& ext);
1287
1288 // get file type from MIME type (in format <category>/<format>)
1289 %new wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
1290
1291 // other operations: return TRUE if there were no errors or FALSE if there
1292 // were some unreckognized entries (the good entries are always read anyhow)
1293 //
1294
1295 // read in additional file (the standard ones are read automatically)
1296 // in mailcap format (see mimetype.cpp for description)
1297 //
1298 // 'fallback' parameter may be set to TRUE to avoid overriding the
1299 // settings from other, previously parsed, files by this one: normally,
1300 // the files read most recently would override the older files, but with
1301 // fallback == TRUE this won't happen
1302 bool ReadMailcap(const wxString& filename, bool fallback = FALSE);
1303
1304 // read in additional file in mime.types format
1305 bool ReadMimeTypes(const wxString& filename);
1306
1307 // enumerate all known MIME types
1308 %addmethods {
1309 PyObject* EnumAllFileTypes() {
1310 wxArrayString arr;
1311 self->EnumAllFileTypes(arr);
1312 return wxArrayString2PyList_helper(arr);
1313 }
1314 }
1315
1316 // these functions can be used to provide default values for some of the
1317 // MIME types inside the program itself (you may also use
1318 // ReadMailcap(filenameWithDefaultTypes, TRUE /* use as fallback */) to
1319 // achieve the same goal, but this requires having this info in a file).
1320 //
1321 void AddFallback(const wxFileTypeInfo& ft);
1322
1323
1324 // create or remove associations
1325
1326 // create a new association using the fields of wxFileTypeInfo (at least
1327 // the MIME type and the extension should be set)
1328 // if the other fields are empty, the existing values should be left alone
1329 %new wxFileType *Associate(const wxFileTypeInfo& ftInfo);
1330
1331 // undo Associate()
1332 bool Unassociate(wxFileType *ft) ;
1333
1334 // dtor (not virtual, shouldn't be derived from)
1335 ~wxMimeTypesManager();
1336};
1337
1338
1339%readonly
1340%{
1341#if 0
1342%}
1343extern wxMimeTypesManager* wxTheMimeTypesManager;
1344%{
1345#endif
1346%}
1347%readwrite
1348
7dbce44a
RD
1349//----------------------------------------------------------------------
1350
1351%{
1352#include <wx/docview.h>
1353%}
1354
1355class wxFileHistory : public wxObject
1356{
1357public:
1358 wxFileHistory(int maxFiles = 9);
1359 ~wxFileHistory();
1360
1361 // Operations
1362 void AddFileToHistory(const wxString& file);
1363 void RemoveFileFromHistory(int i);
1364 int GetMaxFiles() const;
1365 void UseMenu(wxMenu *menu);
1366
1367 // Remove menu from the list (MDI child may be closing)
1368 void RemoveMenu(wxMenu *menu);
1369
1370 void Load(wxConfigBase& config);
1371 void Save(wxConfigBase& config);
1372
1373 void AddFilesToMenu();
68bc8549 1374 %name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu);
7dbce44a
RD
1375
1376 // Accessors
1377 wxString GetHistoryFile(int i) const;
1378
1379 // A synonym for GetNoHistoryFiles
1380 int GetCount() const;
1381 int GetNoHistoryFiles() const;
1382
1383};
1384
4f3449b4 1385//----------------------------------------------------------------------
f0261a72 1386//----------------------------------------------------------------------
9416aa89 1387
493f1553 1388
9416aa89 1389%init %{
9416aa89
RD
1390 wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
1391 wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess");
1392%}
1393
f0261a72
RD
1394//----------------------------------------------------------------------
1395