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