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