]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/misc2.i
corrected thread detection for Darwin / Mac OS X
[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
BP
581
582 bool GetVerbose() const { return m_bVerbose; }
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
635class wxLogNull
636{
637public:
638 wxLogNull();
639 ~wxLogNull();
640};
641
642
76bfdc78
RD
643class wxLogChain : public wxLog
644{
645public:
646 wxLogChain(wxLog *logger);
647 void SetLog(wxLog *logger);
648 void PassMessages(bool bDoPass);
649 bool IsPassingMessages();
650 wxLog *GetOldLog();
651};
652
653
f6bcfd97 654unsigned long wxSysErrorCode();
c8bc7bb8
RD
655const wxString wxSysErrorMsg(unsigned long nErrCode = 0);
656void wxLogFatalError(const wxString& szFormat);
657void wxLogError(const wxString& szFormat);
658void wxLogWarning(const wxString& szFormat);
659void wxLogMessage(const wxString& szFormat);
660void wxLogInfo(const wxString& szFormat);
661void wxLogVerbose(const wxString& szFormat);
662void wxLogStatus(const wxString& szFormat);
663%name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const wxString& szFormat);
664void wxLogSysError(const wxString& szFormat);
f6bcfd97
BP
665
666
76bfdc78
RD
667%{
668// A Log class that can be derived from in wxPython
669class wxPyLog : public wxLog {
670public:
671 wxPyLog() : wxLog() {}
672
673 virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
674 bool found;
4268f798 675 wxPyBeginBlockThreads();
76bfdc78 676 if ((found = wxPyCBH_findCallback(m_myInst, "DoLog")))
a541c325
RD
677 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level,
678 wx2PyString(szString), t));
4268f798 679 wxPyEndBlockThreads();
76bfdc78
RD
680 if (! found)
681 wxLog::DoLog(level, szString, t);
682 }
683
684 virtual void DoLogString(const wxChar *szString, time_t t) {
685 bool found;
4268f798 686 wxPyBeginBlockThreads();
76bfdc78 687 if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString")))
a541c325
RD
688 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)",
689 wx2PyString(szString), t));
4268f798 690 wxPyEndBlockThreads();
76bfdc78
RD
691 if (! found)
692 wxLog::DoLogString(szString, t);
693 }
694
695 PYPRIVATE;
696};
697%}
698
699// Now tell SWIG about it
700class wxPyLog : public wxLog {
701public:
702 wxPyLog();
0122b7e3
RD
703 void _setCallbackInfo(PyObject* self, PyObject* _class);
704 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyLog)"
76bfdc78
RD
705 %addmethods { void Destroy() { delete self; } }
706
707};
708
c368d904
RD
709
710//----------------------------------------------------------------------
711
1b62f00d
RD
712
713enum {
714 /* event type */
715 wxEVT_END_PROCESS
716};
717
718
c368d904
RD
719class wxProcessEvent : public wxEvent {
720public:
721 wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0);
722 int GetPid();
723 int GetExitCode();
724 int m_pid, m_exitcode;
725};
726
727
728
729
730%{ // C++ version of wxProcess derived class
731
732class wxPyProcess : public wxProcess {
733public:
734 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
735 : wxProcess(parent, id)
736 {}
737
738 DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
739
740 PYPRIVATE;
741};
742
743IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate);
19a97bd6 744
c368d904
RD
745%}
746
747
748%name(wxProcess)class wxPyProcess : public wxEvtHandler {
749public:
750 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1);
751 %addmethods { void Destroy() { delete self; } }
752
0122b7e3
RD
753 void _setCallbackInfo(PyObject* self, PyObject* _class);
754 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxProcess)"
c368d904
RD
755
756 void base_OnTerminate(int pid, int status);
757
758 void Redirect();
759 bool IsRedirected();
760 void Detach();
761
762 wxInputStream *GetInputStream();
763 wxInputStream *GetErrorStream();
764 wxOutputStream *GetOutputStream();
765
766 void CloseOutput();
767};
768
769
d6eacb25
RD
770enum
771{
772 // execute the process asynchronously
773 wxEXEC_ASYNC = 0,
774
775 // execute it synchronously, i.e. wait until it finishes
776 wxEXEC_SYNC = 1,
777
778 // under Windows, don't hide the child even if it's IO is redirected (this
779 // is done by default)
780 wxEXEC_NOHIDE = 2,
781
782 // under Unix, if the process is the group leader then killing -pid kills
783 // all children as well as pid
784 wxEXEC_MAKE_GROUP_LEADER = 4
b96c7a38
RD
785};
786
c368d904
RD
787
788long wxExecute(const wxString& command,
b96c7a38 789 int flags = wxEXEC_ASYNC,
c368d904
RD
790 wxPyProcess *process = NULL);
791
185d7c3e
RD
792//----------------------------------------------------------------------
793
493f1553
RD
794%{
795#if !wxUSE_JOYSTICK && !defined(__WXMSW__)
796// A C++ stub class for wxJoystick for platforms that don't have it.
797class wxJoystick : public wxObject {
798public:
799 wxJoystick(int joystick = wxJOYSTICK1) {
4268f798 800 wxPyBeginBlockThreads();
493f1553 801 PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
4268f798 802 wxPyEndBlockThreads();
493f1553
RD
803 }
804 wxPoint GetPosition() { return wxPoint(-1,-1); }
805 int GetZPosition() { return -1; }
806 int GetButtonState() { return -1; }
807 int GetPOVPosition() { return -1; }
808 int GetPOVCTSPosition() { return -1; }
809 int GetRudderPosition() { return -1; }
810 int GetUPosition() { return -1; }
811 int GetVPosition() { return -1; }
812 int GetMovementThreshold() { return -1; }
d56cebe7 813 void SetMovementThreshold(int threshold) {}
493f1553
RD
814
815 bool IsOk(void) { return FALSE; }
816 int GetNumberJoysticks() { return -1; }
817 int GetManufacturerId() { return -1; }
818 int GetProductId() { return -1; }
819 wxString GetProductName() { return ""; }
820 int GetXMin() { return -1; }
821 int GetYMin() { return -1; }
822 int GetZMin() { return -1; }
823 int GetXMax() { return -1; }
824 int GetYMax() { return -1; }
825 int GetZMax() { return -1; }
826 int GetNumberButtons() { return -1; }
827 int GetNumberAxes() { return -1; }
828 int GetMaxButtons() { return -1; }
829 int GetMaxAxes() { return -1; }
830 int GetPollingMin() { return -1; }
831 int GetPollingMax() { return -1; }
832 int GetRudderMin() { return -1; }
833 int GetRudderMax() { return -1; }
834 int GetUMin() { return -1; }
835 int GetUMax() { return -1; }
836 int GetVMin() { return -1; }
837 int GetVMax() { return -1; }
838
839 bool HasRudder() { return FALSE; }
840 bool HasZ() { return FALSE; }
841 bool HasU() { return FALSE; }
842 bool HasV() { return FALSE; }
843 bool HasPOV() { return FALSE; }
844 bool HasPOV4Dir() { return FALSE; }
845 bool HasPOVCTS() { return FALSE; }
846
847 bool SetCapture(wxWindow* win, int pollingFreq = 0) { return FALSE; }
848 bool ReleaseCapture() { return FALSE; }
849};
850#endif
851%}
852
853
9416aa89 854class wxJoystick : public wxObject {
185d7c3e
RD
855public:
856 wxJoystick(int joystick = wxJOYSTICK1);
ac346f50
RD
857 ~wxJoystick();
858
185d7c3e
RD
859 wxPoint GetPosition();
860 int GetZPosition();
861 int GetButtonState();
862 int GetPOVPosition();
863 int GetPOVCTSPosition();
864 int GetRudderPosition();
865 int GetUPosition();
866 int GetVPosition();
867 int GetMovementThreshold();
868 void SetMovementThreshold(int threshold) ;
869
870 bool IsOk(void);
871 int GetNumberJoysticks();
872 int GetManufacturerId();
873 int GetProductId();
874 wxString GetProductName();
875 int GetXMin();
876 int GetYMin();
877 int GetZMin();
878 int GetXMax();
879 int GetYMax();
880 int GetZMax();
881 int GetNumberButtons();
882 int GetNumberAxes();
883 int GetMaxButtons();
884 int GetMaxAxes();
885 int GetPollingMin();
886 int GetPollingMax();
887 int GetRudderMin();
888 int GetRudderMax();
889 int GetUMin();
890 int GetUMax();
891 int GetVMin();
892 int GetVMax();
893
894 bool HasRudder();
895 bool HasZ();
896 bool HasU();
897 bool HasV();
898 bool HasPOV();
899 bool HasPOV4Dir();
900 bool HasPOVCTS();
901
902 bool SetCapture(wxWindow* win, int pollingFreq = 0);
903 bool ReleaseCapture();
904};
493f1553
RD
905
906//----------------------------------------------------------------------
907
908%{
0adbc166 909#if !wxUSE_WAVE
493f1553
RD
910// A C++ stub class for wxWave for platforms that don't have it.
911class wxWave : public wxObject
912{
913public:
914 wxWave(const wxString& fileName, bool isResource = FALSE) {
4268f798 915 wxPyBeginBlockThreads();
493f1553 916 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
4268f798 917 wxPyEndBlockThreads();
493f1553
RD
918 }
919 wxWave(int size, const wxByte* data) {
4268f798 920 wxPyBeginBlockThreads();
493f1553 921 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
4268f798 922 wxPyEndBlockThreads();
493f1553
RD
923 }
924
925 ~wxWave() {}
926
927 bool IsOk() const { return FALSE; }
928 bool Play(bool async = TRUE, bool looped = FALSE) const { return FALSE; }
929};
930
2cd2fac8 931#endif
493f1553
RD
932%}
933
934class wxWave : public wxObject
935{
936public:
937 wxWave(const wxString& fileName, bool isResource = FALSE);
938 ~wxWave();
939
940 bool IsOk() const;
941 bool Play(bool async = TRUE, bool looped = FALSE) const;
942};
943
944%new wxWave* wxWaveData(const wxString& data);
945%{ // Implementations of some alternate "constructors"
946 wxWave* wxWaveData(const wxString& data) {
947 return new wxWave(data.Len(), (wxByte*)data.c_str());
948 }
949%}
185d7c3e 950
4f3449b4 951
b37c7e1d
RD
952//----------------------------------------------------------------------
953
954enum wxMailcapStyle
955{
956 wxMAILCAP_STANDARD = 1,
957 wxMAILCAP_NETSCAPE = 2,
958 wxMAILCAP_KDE = 4,
959 wxMAILCAP_GNOME = 8,
960
961 wxMAILCAP_ALL = 15
962};
963
964
965
966class wxFileTypeInfo
967{
968public:
969 // ctors
970 // a normal item
137b5242
RD
971 wxFileTypeInfo(const char* mimeType,
972 const char* openCmd,
973 const char* printCmd,
974 const char* desc);
b37c7e1d
RD
975
976
977 // the array elements correspond to the parameters of the ctor above in
978 // the same order
979 %name(wxFileTypeInfoSequence)wxFileTypeInfo(const wxArrayString& sArray);
980
981 // invalid item - use this to terminate the array passed to
982 // wxMimeTypesManager::AddFallbacks
983 %name(wxNullFileTypeInfo)wxFileTypeInfo();
984
985
986 // test if this object can be used
987 bool IsValid() const;
988
989 // setters
990 // set the icon info
991 void SetIcon(const wxString& iconFile, int iconIndex = 0);
992
993 // set the short desc
994 void SetShortDesc(const wxString& shortDesc);
995
996 // accessors
997 // get the MIME type
998 const wxString& GetMimeType() const;
999 // get the open command
1000 const wxString& GetOpenCommand() const;
1001 // get the print command
1002 const wxString& GetPrintCommand() const;
1003 // get the short description (only used under Win32 so far)
1004 const wxString& GetShortDesc() const;
1005 // get the long, user visible description
1006 const wxString& GetDescription() const;
1007
1008
1009 // get the array of all extensions
1010 //const wxArrayString& GetExtensions() const;
1011 %addmethods {
1012 PyObject* GetExtensions() {
1013 wxArrayString& arr = (wxArrayString&)self->GetExtensions();
1014 return wxArrayString2PyList_helper(arr);
1015 }
1016 }
1017
1018 int GetExtensionsCount() const;
1019
1020 // get the icon info
1021 const wxString& GetIconFile() const;
1022 int GetIconIndex() const;
1023};
1024
1025
1026
1027
1028class wxFileType
1029{
1030public:
1031
1032 // TODO: Make a wxPyMessageParameters with virtual GetParamValue...
1033
1034 // An object of this class must be passed to Get{Open|Print}Command. The
1035 // default implementation is trivial and doesn't know anything at all about
1036 // parameters, only filename and MIME type are used (so it's probably ok for
1037 // Windows where %{param} is not used anyhow)
1038 class MessageParameters
1039 {
1040 public:
1041 // ctors
137b5242
RD
1042 MessageParameters(const wxString& filename=wxPyEmptyString,
1043 const wxString& mimetype=wxPyEmptyString);
b37c7e1d
RD
1044
1045 // accessors (called by GetOpenCommand)
1046 // filename
1047 const wxString& GetFileName() const;
1048 // mime type
1049 const wxString& GetMimeType() const;;
1050
1051 // override this function in derived class
1052 virtual wxString GetParamValue(const wxString& name) const;
1053
1054 // virtual dtor as in any base class
1055 virtual ~MessageParameters();
1056 };
1057
1058
1059 // ctor from static data
1060 wxFileType(const wxFileTypeInfo& ftInfo);
1061
1062 // return the MIME type for this file type
1063 %addmethods {
1064 PyObject* GetMimeType() {
1065 wxString str;
c8bc7bb8
RD
1066 if (self->GetMimeType(&str)) {
1067#if wxUSE_UNICODE
1068 return PyUnicode_FromUnicode(str.c_str(), str.Len());
1069#else
1070 return PyString_FromStringAndSize(str.c_str(), str.Len());
1071#endif
1072 }
b37c7e1d
RD
1073 else
1074 RETURN_NONE();
1075 }
1076 PyObject* GetMimeTypes() {
1077 wxArrayString arr;
1078 if (self->GetMimeTypes(arr))
1079 return wxArrayString2PyList_helper(arr);
1080 else
1081 RETURN_NONE();
1082 }
1083 }
1084
1085
1086 // Get all extensions associated with this file type
1087 %addmethods {
1088 PyObject* GetExtensions() {
1089 wxArrayString arr;
1090 if (self->GetExtensions(arr))
1091 return wxArrayString2PyList_helper(arr);
1092 else
1093 RETURN_NONE();
1094 }
1095 }
1096
1097
1098 %addmethods {
1099 // Get the icon corresponding to this file type
1100 %new wxIcon* GetIcon() {
1101 wxIcon icon;
1102 if (self->GetIcon(&icon))
1103 return new wxIcon(icon);
1104 else
1105 return NULL;
1106 }
1107
1108 // Get the icon corresponding to this file type, the name of the file
1109 // where this icon resides, and its index in this file if applicable.
1110 PyObject* GetIconInfo() {
1111 wxIcon icon;
1112 wxString iconFile;
1113 int iconIndex;
1114 if (self->GetIcon(&icon, &iconFile, &iconIndex)) {
4268f798 1115 wxPyBeginBlockThreads();
b37c7e1d
RD
1116 PyObject* tuple = PyTuple_New(3);
1117 PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(icon),
1118 "wxIcon", TRUE));
c8bc7bb8
RD
1119#if wxUSE_UNICODE
1120 PyTuple_SetItem(tuple, 1, PyUnicode_FromUnicode(iconFile.c_str(), iconFile.Len()));
1121#else
1122 PyTuple_SetItem(tuple, 1, PyString_FromStringAndSize(iconFile.c_str(), iconFile.Len()));
1123#endif
b37c7e1d 1124 PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex));
4268f798 1125 wxPyEndBlockThreads();
b37c7e1d
RD
1126 return tuple;
1127 }
1128 else
1129 RETURN_NONE();
1130 }
1131 }
1132
1133 %addmethods {
1134 // get a brief file type description ("*.txt" => "text document")
1135 PyObject* GetDescription() {
1136 wxString str;
c8bc7bb8
RD
1137 if (self->GetDescription(&str)) {
1138#if wxUSE_UNICODE
1139 return PyUnicode_FromUnicode(str.c_str(), str.Len());
1140#else
1141 return PyString_FromStringAndSize(str.c_str(), str.Len());
1142#endif
1143 } else
b37c7e1d
RD
1144 RETURN_NONE();
1145 }
1146 }
1147
1148
1149 // get the command to open/execute the file of given type
1150 %addmethods {
1151 PyObject* GetOpenCommand(const wxString& filename,
137b5242 1152 const wxString& mimetype=wxPyEmptyString) {
b37c7e1d 1153 wxString str;
c8bc7bb8
RD
1154 if (self->GetOpenCommand(&str, wxFileType::MessageParameters(filename, mimetype))) {
1155#if wxUSE_UNICODE
1156 return PyUnicode_FromUnicode(str.c_str(), str.Len());
1157#else
1158 return PyString_FromStringAndSize(str.c_str(), str.Len());
1159#endif
1160 } else
b37c7e1d
RD
1161 RETURN_NONE();
1162 }
1163 }
1164
1165
1166 // get the command to print the file of given type
1167 %addmethods {
1168 PyObject* GetPrintCommand(const wxString& filename,
137b5242 1169 const wxString& mimetype=wxPyEmptyString) {
b37c7e1d 1170 wxString str;
c8bc7bb8
RD
1171 if (self->GetPrintCommand(&str, wxFileType::MessageParameters(filename, mimetype))) {
1172#if wxUSE_UNICODE
1173 return PyUnicode_FromUnicode(str.c_str(), str.Len());
1174#else
1175 return PyString_FromStringAndSize(str.c_str(), str.Len());
1176#endif
1177 } else
b37c7e1d
RD
1178 RETURN_NONE();
1179 }
1180 }
1181
1182
1183 // Get all commands defined for this file type
1184 %addmethods {
1185 PyObject* GetAllCommands(const wxString& filename,
137b5242 1186 const wxString& mimetype=wxPyEmptyString) {
b37c7e1d
RD
1187 wxArrayString verbs;
1188 wxArrayString commands;
1189 if (self->GetAllCommands(&verbs, &commands,
1190 wxFileType::MessageParameters(filename, mimetype))) {
4268f798 1191 wxPyBeginBlockThreads();
b37c7e1d
RD
1192 PyObject* tuple = PyTuple_New(2);
1193 PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs));
1194 PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands));
4268f798 1195 wxPyEndBlockThreads();
b37c7e1d
RD
1196 return tuple;
1197 }
1198 else
1199 RETURN_NONE();
1200 }
1201 }
1202
1203
1204 // set an arbitrary command, ask confirmation if it already exists and
1205 // overwriteprompt is TRUE
1206 bool SetCommand(const wxString& cmd, const wxString& verb,
1207 bool overwriteprompt = TRUE);
1208
137b5242 1209 bool SetDefaultIcon(const wxString& cmd = wxPyEmptyString, int index = 0);
b37c7e1d
RD
1210
1211
1212 // remove the association for this filetype from the system MIME database:
1213 // notice that it will only work if the association is defined in the user
1214 // file/registry part, we will never modify the system-wide settings
1215 bool Unassociate();
1216
1217 // operations
1218 // expand a string in the format of GetOpenCommand (which may contain
1219 // '%s' and '%t' format specificators for the file name and mime type
1220 // and %{param} constructions).
1221 static wxString ExpandCommand(const wxString& command,
1222 const MessageParameters& params);
1223
1224 // dtor (not virtual, shouldn't be derived from)
1225 ~wxFileType();
1226
1227};
1228
1229
1230
1231
1232class wxMimeTypesManager
1233{
1234public:
1235 // static helper functions
1236 // -----------------------
1237
1238 // check if the given MIME type is the same as the other one: the
1239 // second argument may contain wildcards ('*'), but not the first. If
1240 // the types are equal or if the mimeType matches wildcard the function
1241 // returns TRUE, otherwise it returns FALSE
1242 static bool IsOfType(const wxString& mimeType, const wxString& wildcard);
1243
1244 // ctor
1245 wxMimeTypesManager();
1246
1247 // loads data from standard files according to the mailcap styles
1248 // specified: this is a bitwise OR of wxMailcapStyle values
1249 //
1250 // use the extraDir parameter if you want to look for files in another
1251 // directory
1252 void Initialize(int mailcapStyle = wxMAILCAP_STANDARD,
137b5242 1253 const wxString& extraDir = wxPyEmptyString);
b37c7e1d
RD
1254
1255 // and this function clears all the data from the manager
1256 void ClearData();
1257
1258 // Database lookup: all functions return a pointer to wxFileType object
1259 // whose methods may be used to query it for the information you're
1260 // interested in. If the return value is !NULL, caller is responsible for
1261 // deleting it.
1262 // get file type from file extension
1263 %new wxFileType *GetFileTypeFromExtension(const wxString& ext);
1264
1265 // get file type from MIME type (in format <category>/<format>)
1266 %new wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
1267
1268 // other operations: return TRUE if there were no errors or FALSE if there
1269 // were some unreckognized entries (the good entries are always read anyhow)
1270 //
1271
1272 // read in additional file (the standard ones are read automatically)
1273 // in mailcap format (see mimetype.cpp for description)
1274 //
1275 // 'fallback' parameter may be set to TRUE to avoid overriding the
1276 // settings from other, previously parsed, files by this one: normally,
1277 // the files read most recently would override the older files, but with
1278 // fallback == TRUE this won't happen
1279 bool ReadMailcap(const wxString& filename, bool fallback = FALSE);
1280
1281 // read in additional file in mime.types format
1282 bool ReadMimeTypes(const wxString& filename);
1283
1284 // enumerate all known MIME types
1285 %addmethods {
1286 PyObject* EnumAllFileTypes() {
1287 wxArrayString arr;
1288 self->EnumAllFileTypes(arr);
1289 return wxArrayString2PyList_helper(arr);
1290 }
1291 }
1292
1293 // these functions can be used to provide default values for some of the
1294 // MIME types inside the program itself (you may also use
1295 // ReadMailcap(filenameWithDefaultTypes, TRUE /* use as fallback */) to
1296 // achieve the same goal, but this requires having this info in a file).
1297 //
1298 void AddFallback(const wxFileTypeInfo& ft);
1299
1300
1301 // create or remove associations
1302
1303 // create a new association using the fields of wxFileTypeInfo (at least
1304 // the MIME type and the extension should be set)
1305 // if the other fields are empty, the existing values should be left alone
1306 %new wxFileType *Associate(const wxFileTypeInfo& ftInfo);
1307
1308 // undo Associate()
1309 bool Unassociate(wxFileType *ft) ;
1310
1311 // dtor (not virtual, shouldn't be derived from)
1312 ~wxMimeTypesManager();
1313};
1314
1315
1316%readonly
1317%{
1318#if 0
1319%}
1320extern wxMimeTypesManager* wxTheMimeTypesManager;
1321%{
1322#endif
1323%}
1324%readwrite
1325
7dbce44a
RD
1326//----------------------------------------------------------------------
1327
1328%{
1329#include <wx/docview.h>
1330%}
1331
1332class wxFileHistory : public wxObject
1333{
1334public:
1335 wxFileHistory(int maxFiles = 9);
1336 ~wxFileHistory();
1337
1338 // Operations
1339 void AddFileToHistory(const wxString& file);
1340 void RemoveFileFromHistory(int i);
1341 int GetMaxFiles() const;
1342 void UseMenu(wxMenu *menu);
1343
1344 // Remove menu from the list (MDI child may be closing)
1345 void RemoveMenu(wxMenu *menu);
1346
1347 void Load(wxConfigBase& config);
1348 void Save(wxConfigBase& config);
1349
1350 void AddFilesToMenu();
68bc8549 1351 %name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu);
7dbce44a
RD
1352
1353 // Accessors
1354 wxString GetHistoryFile(int i) const;
1355
1356 // A synonym for GetNoHistoryFiles
1357 int GetCount() const;
1358 int GetNoHistoryFiles() const;
1359
1360};
1361
4f3449b4 1362//----------------------------------------------------------------------
f0261a72 1363//----------------------------------------------------------------------
9416aa89 1364
493f1553 1365
9416aa89 1366%init %{
9416aa89
RD
1367 wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
1368 wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess");
1369%}
1370
f0261a72
RD
1371//----------------------------------------------------------------------
1372