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