1 /////////////////////////////////////////////////////////////////////////////
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.)
9 // Created: 18-June-1999
11 // Copyright: (c) 1998 by Total Control Software
12 // Licence: wxWindows license
13 /////////////////////////////////////////////////////////////////////////////
19 #include "pyistream.h"
20 #include <wx/tooltip.h>
22 #include <wx/tipdlg.h>
23 #include <wx/process.h>
25 #if wxUSE_JOYSTICK || defined(__WXMSW__)
26 #include <wx/joystick.h>
29 #if wxUSE_WAVE || defined(__WXMSW__)
33 #include <wx/mimetype.h>
34 #include <wx/snglinst.h>
35 #include <wx/effects.h>
36 #include <wx/sysopt.h>
39 //----------------------------------------------------------------------
42 %include my_typemaps.i
44 // Import some definitions of other classes, etc.
54 //----------------------------------------------------------------------
57 // Put some wx default wxChar* values into wxStrings.
58 DECLARE_DEF_STRING(FileSelectorPromptStr);
59 DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr);
60 DECLARE_DEF_STRING(DirSelectorPromptStr);
61 static const wxString wxPyEmptyString(wxT(""));
64 //---------------------------------------------------------------------------
67 wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
68 const wxString& default_path = wxPyEmptyString,
69 const wxString& default_filename = wxPyEmptyString,
70 const wxString& default_extension = wxPyEmptyString,
71 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
73 wxWindow *parent = NULL,
74 int x = -1, int y = -1);
76 // TODO: wxFileSelectorEx
79 // Ask for filename to load
80 wxString wxLoadFileSelector(const wxString& what,
81 const wxString& extension,
82 const wxString& default_name = wxPyEmptyString,
83 wxWindow *parent = NULL);
85 // Ask for filename to save
86 wxString wxSaveFileSelector(const wxString& what,
87 const wxString& extension,
88 const wxString& default_name = wxPyEmptyString,
89 wxWindow *parent = NULL);
92 wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
93 const wxString& defaultPath = wxPyEmptyString,
94 long style = wxDD_DEFAULT_STYLE,
95 const wxPoint& pos = wxDefaultPosition,
96 wxWindow *parent = NULL);
98 wxString wxGetTextFromUser(const wxString& message,
99 const wxString& caption = wxPyEmptyString,
100 const wxString& default_value = wxPyEmptyString,
101 wxWindow *parent = NULL,
102 int x = -1, int y = -1,
105 wxString wxGetPasswordFromUser(const wxString& message,
106 const wxString& caption = wxPyEmptyString,
107 const wxString& default_value = wxPyEmptyString,
108 wxWindow *parent = NULL);
111 // TODO: Need to custom wrap this one...
112 // int wxGetMultipleChoice(char* message, char* caption,
113 // int LCOUNT, char** choices,
114 // int nsel, int *selection,
115 // wxWindow *parent = NULL, int x = -1, int y = -1,
116 // bool centre = TRUE, int width=150, int height=200);
119 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
120 int LCOUNT, wxString* choices,
121 wxWindow *parent = NULL,
122 int x = -1, int y = -1,
124 int width=150, int height=200);
126 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
127 int LCOUNT, wxString* choices,
128 wxWindow *parent = NULL,
129 int x = -1, int y = -1,
131 int width=150, int height=200);
134 int wxMessageBox(const wxString& message,
135 const wxString& caption = wxPyEmptyString,
136 int style = wxOK | wxCENTRE,
137 wxWindow *parent = NULL,
138 int x = -1, int y = -1);
140 long wxGetNumberFromUser(const wxString& message,
141 const wxString& prompt,
142 const wxString& caption,
144 long min = 0, long max = 100,
145 wxWindow *parent = NULL,
146 const wxPoint& pos = wxDefaultPosition);
148 //---------------------------------------------------------------------------
151 bool wxColourDisplay();
153 int wxDisplayDepth();
154 int wxGetDisplayDepth();
156 void wxDisplaySize(int* OUTPUT, int* OUTPUT);
157 wxSize wxGetDisplaySize();
159 void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT);
160 wxSize wxGetDisplaySizeMM();
162 void wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT);
163 wxRect wxGetClientDisplayRect();
165 void wxSetCursor(wxCursor& cursor);
167 //----------------------------------------------------------------------
168 // Miscellaneous functions
170 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
171 wxWindow * wxGetActiveWindow();
173 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
174 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
177 bool wxCheckForInterrupt(wxWindow *wnd);
178 // link error? void wxFlushEvents();
181 wxWindow* wxGetTopLevelParent(wxWindow *win);
183 //bool wxSpawnBrowser(wxWindow *parent, wxString href);
185 //---------------------------------------------------------------------------
188 #ifdef wxUSE_WX_RESOURCES
189 bool wxResourceAddIdentifier(char* name, int value);
190 void wxResourceClear(void);
191 wxBitmap wxResourceCreateBitmap(char* resource);
192 wxIcon wxResourceCreateIcon(char* resource);
193 wxMenuBar * wxResourceCreateMenuBar(char* resource);
194 int wxResourceGetIdentifier(char* name);
195 bool wxResourceParseData(char* resource, wxResourceTable *table = NULL);
196 bool wxResourceParseFile(char* filename, wxResourceTable *table = NULL);
197 bool wxResourceParseString(char* resource, wxResourceTable *table = NULL);
200 //---------------------------------------------------------------------------
203 // possible values for wxSystemSettings::GetFont() parameter
207 wxSYS_OEM_FIXED_FONT = 10,
208 wxSYS_ANSI_FIXED_FONT,
211 wxSYS_DEVICE_DEFAULT_FONT,
212 wxSYS_DEFAULT_PALETTE,
213 wxSYS_SYSTEM_FIXED_FONT,
214 wxSYS_DEFAULT_GUI_FONT
217 // possible values for wxSystemSettings::GetColour() parameter
221 wxSYS_COLOUR_SCROLLBAR,
222 wxSYS_COLOUR_BACKGROUND,
223 wxSYS_COLOUR_DESKTOP = wxSYS_COLOUR_BACKGROUND,
224 wxSYS_COLOUR_ACTIVECAPTION,
225 wxSYS_COLOUR_INACTIVECAPTION,
228 wxSYS_COLOUR_WINDOWFRAME,
229 wxSYS_COLOUR_MENUTEXT,
230 wxSYS_COLOUR_WINDOWTEXT,
231 wxSYS_COLOUR_CAPTIONTEXT,
232 wxSYS_COLOUR_ACTIVEBORDER,
233 wxSYS_COLOUR_INACTIVEBORDER,
234 wxSYS_COLOUR_APPWORKSPACE,
235 wxSYS_COLOUR_HIGHLIGHT,
236 wxSYS_COLOUR_HIGHLIGHTTEXT,
237 wxSYS_COLOUR_BTNFACE,
238 wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE,
239 wxSYS_COLOUR_BTNSHADOW,
240 wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW,
241 wxSYS_COLOUR_GRAYTEXT,
242 wxSYS_COLOUR_BTNTEXT,
243 wxSYS_COLOUR_INACTIVECAPTIONTEXT,
244 wxSYS_COLOUR_BTNHIGHLIGHT,
245 wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
246 wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
247 wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
248 wxSYS_COLOUR_3DDKSHADOW,
249 wxSYS_COLOUR_3DLIGHT,
250 wxSYS_COLOUR_INFOTEXT,
252 wxSYS_COLOUR_LISTBOX,
253 wxSYS_COLOUR_HOTLIGHT,
254 wxSYS_COLOUR_GRADIENTACTIVECAPTION,
255 wxSYS_COLOUR_GRADIENTINACTIVECAPTION,
256 wxSYS_COLOUR_MENUHILIGHT,
257 wxSYS_COLOUR_MENUBAR,
262 // possible values for wxSystemSettings::GetMetric() parameter
266 wxSYS_MOUSE_BUTTONS = 1,
277 wxSYS_HSCROLL_ARROW_X,
278 wxSYS_HSCROLL_ARROW_Y,
294 wxSYS_VSCROLL_ARROW_X,
295 wxSYS_VSCROLL_ARROW_Y,
299 wxSYS_NETWORK_PRESENT,
300 wxSYS_PENWINDOWS_PRESENT,
305 // possible values for wxSystemSettings::HasFeature() parameter
308 wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1,
309 wxSYS_CAN_ICONIZE_FRAME
312 enum wxSystemScreenType
314 wxSYS_SCREEN_NONE = 0, // not yet defined
316 wxSYS_SCREEN_TINY, // <
317 wxSYS_SCREEN_PDA, // >= 320x240
318 wxSYS_SCREEN_SMALL, // >= 640x480
319 wxSYS_SCREEN_DESKTOP // >= 800x600
323 class wxSystemSettings {
325 // get a standard system colour
326 static wxColour GetColour(wxSystemColour index);
328 // get a standard system font
329 static wxFont GetFont(wxSystemFont index);
331 // get a system-dependent metric
332 static int GetMetric(wxSystemMetric index);
334 // return true if the port has certain feature
335 static bool HasFeature(wxSystemFeature index);
337 // Get system screen design (desktop, pda, ..) used for
338 // laying out various dialogs.
339 static wxSystemScreenType GetScreenType();
342 static void SetScreenType( wxSystemScreenType screen );
348 class wxSystemOptions : public wxObject
351 wxSystemOptions() { }
353 // User-customizable hints to wxWindows or associated libraries
354 // These could also be used to influence GetSystem... calls, indeed
355 // to implement SetSystemColour/Font/Metric
357 static void SetOption(const wxString& name, const wxString& value);
358 %name(SetOptionInt)static void SetOption(const wxString& name, int value);
359 static wxString GetOption(const wxString& name) ;
360 static int GetOptionInt(const wxString& name) ;
361 static bool HasOption(const wxString& name) ;
365 //---------------------------------------------------------------------------
368 class wxToolTip : public wxObject {
370 wxToolTip(const wxString &tip);
372 void SetTip(const wxString& tip);
374 // *** Not in the "public" interface void SetWindow(wxWindow *win);
375 wxWindow *GetWindow();
377 static void Enable(bool flag);
378 static void SetDelay(long milliseconds);
381 //----------------------------------------------------------------------
385 wxCaret(wxWindow* window, const wxSize& size);
390 %name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT);
391 wxPoint GetPosition();
392 %name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT);
394 wxWindow *GetWindow();
395 %name(MoveXY)void Move(int x, int y);
396 void Move(const wxPoint& pt);
397 %name(SetSizeWH) void SetSize(int width, int height);
398 void SetSize(const wxSize& size);
399 void Show(int show = TRUE);
402 %pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()"
406 int wxCaret_GetBlinkTime() {
407 return wxCaret::GetBlinkTime();
410 void wxCaret_SetBlinkTime(int milliseconds) {
411 wxCaret::SetBlinkTime(milliseconds);
415 //----------------------------------------------------------------------
419 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
423 //----------------------------------------------------------------------
425 class wxWindowDisabler {
427 wxWindowDisabler(wxWindow *winToSkip = NULL);
431 //----------------------------------------------------------------------
433 bool wxSafeYield(wxWindow* win=NULL, bool onlyIfNeeded=FALSE);
434 void wxPostEvent(wxEvtHandler *dest, wxEvent& event);
439 void wxWakeUpMainThread();
442 void wxMutexGuiEnter();
443 void wxMutexGuiLeave();
446 class wxMutexGuiLocker {
454 bool wxThread_IsMain() {
455 #ifdef WXP_WITH_THREAD
456 return wxThread::IsMain();
463 //----------------------------------------------------------------------
469 // wxTipProvider(size_t currentTip); **** Abstract base class
472 virtual wxString GetTip() = 0;
473 size_t GetCurrentTip();
474 virtual wxString PreprocessTip(const wxString& tip);
478 // The C++ version of wxPyTipProvider
480 class wxPyTipProvider : public wxTipProvider {
482 wxPyTipProvider(size_t currentTip)
483 : wxTipProvider(currentTip) {}
485 DEC_PYCALLBACK_STRING__pure(GetTip);
486 DEC_PYCALLBACK_STRING_STRING(PreprocessTip);
490 IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip);
491 IMP_PYCALLBACK_STRING_STRING(wxPyTipProvider, wxTipProvider, PreprocessTip);
495 // Now let SWIG know about it
496 class wxPyTipProvider : public wxTipProvider {
498 wxPyTipProvider(size_t currentTip);
500 void _setCallbackInfo(PyObject* self, PyObject* _class);
501 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyTipProvider)"
506 bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = TRUE);
507 %new wxTipProvider * wxCreateFileTipProvider(const wxString& filename, size_t currentTip);
510 //----------------------------------------------------------------------
513 #include <wx/generic/dragimgg.h>
516 %name (wxDragImage) class wxGenericDragImage : public wxObject
520 wxGenericDragImage(const wxBitmap& image,
521 const wxCursor& cursor = wxNullCursor);
522 %name(wxDragIcon)wxGenericDragImage(const wxIcon& image,
523 const wxCursor& cursor = wxNullCursor);
524 %name(wxDragString)wxGenericDragImage(const wxString& str,
525 const wxCursor& cursor = wxNullCursor);
526 %name(wxDragTreeItem)wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
527 %name(wxDragListItem)wxGenericDragImage(const wxListCtrl& listCtrl, long id);
529 ~wxGenericDragImage();
531 void SetBackingBitmap(wxBitmap* bitmap);
532 bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
533 bool fullScreen = FALSE, wxRect* rect = NULL);
535 %name(BeginDragBounded) bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
536 wxWindow* boundingWindow);
538 %pragma(python) addtoclass = "BeginDrag2 = BeginDragBounded"
541 bool Move(const wxPoint& pt);
545 wxRect GetImageRect(const wxPoint& pos) const;
546 bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos,
547 bool eraseOld, bool drawNew);
551 //----------------------------------------------------------------------
553 class wxPyTimer : public wxObject {
555 wxPyTimer(PyObject* notify);
560 void SetOwner(wxEvtHandler *owner, int id = -1);
561 bool Start(int milliseconds=-1, int oneShot=FALSE);
569 // ctor starts the stop watch
572 void Start(long t = 0);
576 // get elapsed time since the last Start() or Pause() in milliseconds
581 //----------------------------------------------------------------------
582 //----------------------------------------------------------------------
587 wxLOG_FatalError, // program can't continue, abort immediately
588 wxLOG_Error, // a serious error, user must be informed about it
589 wxLOG_Warning, // user is normally informed about it but may be ignored
590 wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
591 wxLOG_Info, // informational message (a.k.a. 'Verbose')
592 wxLOG_Status, // informational: might go to the status line of GUI app
593 wxLOG_Debug, // never shown to the user, disabled in release mode
594 wxLOG_Trace, // trace messages are also only enabled in debug mode
595 wxLOG_Progress, // used for progress indicator (not yet)
596 wxLOG_User = 100 // user defined levels start here
599 #define wxTRACE_MemAlloc "memalloc" // trace memory allocation (new/delete)
600 #define wxTRACE_Messages "messages" // trace window messages/X callbacks
601 #define wxTRACE_ResAlloc "resalloc" // trace GDI resource allocation
602 #define wxTRACE_RefCount "refcount" // trace various ref counting operations
605 #define wxTRACE_OleCalls "ole" // OLE interface calls
626 static bool IsEnabled();
627 static bool EnableLogging(bool doIt = TRUE);
628 static void OnLog(unsigned long level, const wxString& szString, int t=0);
630 virtual void Flush();
631 static void FlushActive();
632 static wxLog *GetActiveTarget();
633 static wxLog *SetActiveTarget(wxLog *pLogger);
635 static void Suspend();
636 static void Resume();
638 static void SetVerbose(bool bVerbose = TRUE);
640 static void DontCreateOnDemand();
641 static void SetTraceMask(long ulMask);
642 static void AddTraceMask(const wxString& str);
643 static void RemoveTraceMask(const wxString& str);
644 static void ClearTraceMasks();
645 static const wxArrayString &GetTraceMasks();
647 static void SetTimestamp(const wxString& ts);
648 static const wxString& GetTimestamp();
650 bool GetVerbose() const;
652 static unsigned long GetTraceMask();
653 static bool IsAllowedTraceMask(const wxString& mask);
655 static void SetLogLevel(unsigned long logLevel);
656 static unsigned long GetLogLevel();
659 // static void TimeStamp(wxString *str);
661 wxString TimeStamp() {
663 wxLog::TimeStamp(&msg);
671 class wxLogStderr : public wxLog
674 wxLogStderr(/* TODO: FILE *fp = (FILE *) NULL*/);
678 class wxLogTextCtrl : public wxLog
681 wxLogTextCtrl(wxTextCtrl *pTextCtrl);
685 class wxLogGui : public wxLog
691 class wxLogWindow : public wxLog
694 wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL)
695 const wxString& szTitle, // the title of the frame
696 bool bShow = TRUE, // show window immediately?
697 bool bPassToOld = TRUE); // pass log messages to the old target?
699 void Show(bool bShow = TRUE);
700 wxFrame *GetFrame() const;
701 wxLog *GetOldLog() const;
702 bool IsPassingMessages() const;
703 void PassMessages(bool bDoPass);
707 class wxLogChain : public wxLog
710 wxLogChain(wxLog *logger);
711 void SetLog(wxLog *logger);
712 void PassMessages(bool bDoPass);
713 bool IsPassingMessages();
718 unsigned long wxSysErrorCode();
719 const wxString wxSysErrorMsg(unsigned long nErrCode = 0);
720 void wxLogFatalError(const wxString& msg);
721 void wxLogError(const wxString& msg);
722 void wxLogWarning(const wxString& msg);
723 void wxLogMessage(const wxString& msg);
724 void wxLogInfo(const wxString& msg);
725 void wxLogDebug(const wxString& msg);
726 void wxLogVerbose(const wxString& msg);
727 void wxLogStatus(const wxString& msg);
728 %name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const wxString& msg);
729 void wxLogSysError(const wxString& msg);
731 void wxLogTrace(const wxString& msg);
732 %name(wxLogTraceMask)void wxLogTrace(const wxString& mask, const wxString& msg);
734 void wxLogGeneric(unsigned long level, const wxString& msg);
736 // wxLogFatalError helper: show the (fatal) error to the user in a safe way,
737 // i.e. without using wxMessageBox() for example because it could crash
738 void wxSafeShowMessage(const wxString& title, const wxString& text);
742 // Suspress logging while an instance of this class exists
754 // A wxLog class that can be derived from in wxPython
755 class wxPyLog : public wxLog {
757 wxPyLog() : wxLog() {}
759 virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
761 wxPyBeginBlockThreads();
762 if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) {
763 PyObject* s = wx2PyString(szString);
764 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t));
767 wxPyEndBlockThreads();
769 wxLog::DoLog(level, szString, t);
772 virtual void DoLogString(const wxChar *szString, time_t t) {
774 wxPyBeginBlockThreads();
775 if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) {
776 PyObject* s = wx2PyString(szString);
777 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t));
780 wxPyEndBlockThreads();
782 wxLog::DoLogString(szString, t);
789 // Now tell SWIG about it
790 class wxPyLog : public wxLog {
793 void _setCallbackInfo(PyObject* self, PyObject* _class);
794 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyLog)"
795 %addmethods { void Destroy() { delete self; } }
800 //----------------------------------------------------------------------
805 wxKILL_OK, // no error
806 wxKILL_BAD_SIGNAL, // no such signal
807 wxKILL_ACCESS_DENIED, // permission denied
808 wxKILL_NO_PROCESS, // no such process
809 wxKILL_ERROR // another, unspecified error
814 wxSIGNONE = 0, // verify if the process exists under Unix
821 wxSIGIOT = wxSIGABRT, // another name
832 // further signals are different in meaning between different Unix systems
844 class wxProcessEvent : public wxEvent {
846 wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0);
849 int m_pid, m_exitcode;
855 %{ // C++ version of wxProcess derived class
857 class wxPyProcess : public wxProcess {
859 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
860 : wxProcess(parent, id)
863 DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
868 IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate);
873 %name(wxProcess)class wxPyProcess : public wxEvtHandler {
875 // kill the process with the given PID
876 static wxKillError Kill(int pid, wxSignal sig = wxSIGTERM);
878 // test if the given process exists
879 static bool Exists(int pid);
881 // this function replaces the standard popen() one: it launches a process
882 // asynchronously and allows the caller to get the streams connected to its
885 // on error NULL is returned, in any case the process object will be
886 // deleted automatically when the process terminates and should *not* be
887 // deleted by the caller
888 static wxPyProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC);
892 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1);
893 %addmethods { void Destroy() { delete self; } }
895 void _setCallbackInfo(PyObject* self, PyObject* _class);
896 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxProcess)"
898 void base_OnTerminate(int pid, int status);
904 wxInputStream *GetInputStream();
905 wxInputStream *GetErrorStream();
906 wxOutputStream *GetOutputStream();
910 // return TRUE if the child process stdout is not closed
911 bool IsInputOpened() const;
913 // return TRUE if any input is available on the child process stdout/err
914 bool IsInputAvailable() const;
915 bool IsErrorAvailable() const;
921 // execute the process asynchronously
924 // execute it synchronously, i.e. wait until it finishes
927 // under Windows, don't hide the child even if it's IO is redirected (this
928 // is done by default)
931 // under Unix, if the process is the group leader then killing -pid kills
932 // all children as well as pid
933 wxEXEC_MAKE_GROUP_LEADER = 4
937 long wxExecute(const wxString& command,
938 int flags = wxEXEC_ASYNC,
939 wxPyProcess *process = NULL);
941 //----------------------------------------------------------------------
944 // Which joystick? Same as Windows ids so no conversion necessary.
951 // Which button is down?
963 #if !wxUSE_JOYSTICK && !defined(__WXMSW__)
964 // A C++ stub class for wxJoystick for platforms that don't have it.
965 class wxJoystick : public wxObject {
967 wxJoystick(int joystick = wxJOYSTICK1) {
968 wxPyBeginBlockThreads();
969 PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
970 wxPyEndBlockThreads();
972 wxPoint GetPosition() { return wxPoint(-1,-1); }
973 int GetZPosition() { return -1; }
974 int GetButtonState() { return -1; }
975 int GetPOVPosition() { return -1; }
976 int GetPOVCTSPosition() { return -1; }
977 int GetRudderPosition() { return -1; }
978 int GetUPosition() { return -1; }
979 int GetVPosition() { return -1; }
980 int GetMovementThreshold() { return -1; }
981 void SetMovementThreshold(int threshold) {}
983 bool IsOk(void) { return FALSE; }
984 int GetNumberJoysticks() { return -1; }
985 int GetManufacturerId() { return -1; }
986 int GetProductId() { return -1; }
987 wxString GetProductName() { return ""; }
988 int GetXMin() { return -1; }
989 int GetYMin() { return -1; }
990 int GetZMin() { return -1; }
991 int GetXMax() { return -1; }
992 int GetYMax() { return -1; }
993 int GetZMax() { return -1; }
994 int GetNumberButtons() { return -1; }
995 int GetNumberAxes() { return -1; }
996 int GetMaxButtons() { return -1; }
997 int GetMaxAxes() { return -1; }
998 int GetPollingMin() { return -1; }
999 int GetPollingMax() { return -1; }
1000 int GetRudderMin() { return -1; }
1001 int GetRudderMax() { return -1; }
1002 int GetUMin() { return -1; }
1003 int GetUMax() { return -1; }
1004 int GetVMin() { return -1; }
1005 int GetVMax() { return -1; }
1007 bool HasRudder() { return FALSE; }
1008 bool HasZ() { return FALSE; }
1009 bool HasU() { return FALSE; }
1010 bool HasV() { return FALSE; }
1011 bool HasPOV() { return FALSE; }
1012 bool HasPOV4Dir() { return FALSE; }
1013 bool HasPOVCTS() { return FALSE; }
1015 bool SetCapture(wxWindow* win, int pollingFreq = 0) { return FALSE; }
1016 bool ReleaseCapture() { return FALSE; }
1022 class wxJoystick : public wxObject {
1024 wxJoystick(int joystick = wxJOYSTICK1);
1027 wxPoint GetPosition();
1029 int GetButtonState();
1030 int GetPOVPosition();
1031 int GetPOVCTSPosition();
1032 int GetRudderPosition();
1035 int GetMovementThreshold();
1036 void SetMovementThreshold(int threshold) ;
1039 int GetNumberJoysticks();
1040 int GetManufacturerId();
1042 wxString GetProductName();
1049 int GetNumberButtons();
1050 int GetNumberAxes();
1051 int GetMaxButtons();
1053 int GetPollingMin();
1054 int GetPollingMax();
1070 bool SetCapture(wxWindow* win, int pollingFreq = 0);
1071 bool ReleaseCapture();
1073 %pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()"
1076 //----------------------------------------------------------------------
1080 // A C++ stub class for wxWave for platforms that don't have it.
1081 class wxWave : public wxObject
1084 wxWave(const wxString& fileName, bool isResource = FALSE) {
1085 wxPyBeginBlockThreads();
1086 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
1087 wxPyEndBlockThreads();
1089 wxWave(int size, const wxByte* data) {
1090 wxPyBeginBlockThreads();
1091 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
1092 wxPyEndBlockThreads();
1097 bool IsOk() const { return FALSE; }
1098 bool Play(bool async = TRUE, bool looped = FALSE) const { return FALSE; }
1104 class wxWave : public wxObject
1107 wxWave(const wxString& fileName, bool isResource = FALSE);
1111 bool Play(bool async = TRUE, bool looped = FALSE) const;
1113 %pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()"
1116 %new wxWave* wxWaveData(const wxString& data);
1117 %{ // Implementations of some alternate "constructors"
1118 wxWave* wxWaveData(const wxString& data) {
1119 return new wxWave(data.Len(), (wxByte*)data.c_str());
1124 //----------------------------------------------------------------------
1128 wxMAILCAP_STANDARD = 1,
1129 wxMAILCAP_NETSCAPE = 2,
1131 wxMAILCAP_GNOME = 8,
1138 class wxFileTypeInfo
1143 wxFileTypeInfo(const wxString& mimeType,
1144 const wxString& openCmd,
1145 const wxString& printCmd,
1146 const wxString& desc);
1149 // the array elements correspond to the parameters of the ctor above in
1151 %name(wxFileTypeInfoSequence)wxFileTypeInfo(const wxArrayString& sArray);
1153 // invalid item - use this to terminate the array passed to
1154 // wxMimeTypesManager::AddFallbacks
1155 %name(wxNullFileTypeInfo)wxFileTypeInfo();
1158 // test if this object can be used
1159 bool IsValid() const;
1162 // set the icon info
1163 void SetIcon(const wxString& iconFile, int iconIndex = 0);
1165 // set the short desc
1166 void SetShortDesc(const wxString& shortDesc);
1169 // get the MIME type
1170 const wxString& GetMimeType() const;
1171 // get the open command
1172 const wxString& GetOpenCommand() const;
1173 // get the print command
1174 const wxString& GetPrintCommand() const;
1175 // get the short description (only used under Win32 so far)
1176 const wxString& GetShortDesc() const;
1177 // get the long, user visible description
1178 const wxString& GetDescription() const;
1181 // get the array of all extensions
1182 //const wxArrayString& GetExtensions() const;
1184 PyObject* GetExtensions() {
1185 wxArrayString& arr = (wxArrayString&)self->GetExtensions();
1186 return wxArrayString2PyList_helper(arr);
1190 int GetExtensionsCount() const;
1192 // get the icon info
1193 const wxString& GetIconFile() const;
1194 int GetIconIndex() const;
1204 // TODO: Make a wxPyMessageParameters with virtual GetParamValue...
1206 // An object of this class must be passed to Get{Open|Print}Command. The
1207 // default implementation is trivial and doesn't know anything at all about
1208 // parameters, only filename and MIME type are used (so it's probably ok for
1209 // Windows where %{param} is not used anyhow)
1210 class MessageParameters
1214 MessageParameters(const wxString& filename=wxPyEmptyString,
1215 const wxString& mimetype=wxPyEmptyString);
1217 // accessors (called by GetOpenCommand)
1219 const wxString& GetFileName() const;
1221 const wxString& GetMimeType() const;;
1223 // override this function in derived class
1224 virtual wxString GetParamValue(const wxString& name) const;
1226 // virtual dtor as in any base class
1227 virtual ~MessageParameters();
1231 // ctor from static data
1232 wxFileType(const wxFileTypeInfo& ftInfo);
1234 // return the MIME type for this file type
1236 PyObject* GetMimeType() {
1238 if (self->GetMimeType(&str)) {
1240 return PyUnicode_FromWideChar(str.c_str(), str.Len());
1242 return PyString_FromStringAndSize(str.c_str(), str.Len());
1248 PyObject* GetMimeTypes() {
1250 if (self->GetMimeTypes(arr))
1251 return wxArrayString2PyList_helper(arr);
1258 // Get all extensions associated with this file type
1260 PyObject* GetExtensions() {
1262 if (self->GetExtensions(arr))
1263 return wxArrayString2PyList_helper(arr);
1271 // Get the icon corresponding to this file type
1272 %new wxIcon* GetIcon() {
1274 if (self->GetIcon(&loc))
1275 return new wxIcon(loc);
1280 // Get the icon corresponding to this file type, the name of the file
1281 // where this icon resides, and its index in this file if applicable.
1282 PyObject* GetIconInfo() {
1284 if (self->GetIcon(&loc)) {
1285 wxString iconFile = loc.GetFileName();
1288 iconIndex = loc.GetIndex();
1290 // Make a tuple and put the values in it
1291 wxPyBeginBlockThreads();
1292 PyObject* tuple = PyTuple_New(3);
1293 PyTuple_SetItem(tuple, 0,
1294 wxPyConstructObject(new wxIcon(loc), wxT("wxIcon"), TRUE));
1296 PyTuple_SetItem(tuple, 1, PyUnicode_FromWideChar(iconFile.c_str(), iconFile.Len()));
1298 PyTuple_SetItem(tuple, 1, PyString_FromStringAndSize(iconFile.c_str(), iconFile.Len()));
1300 PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex));
1301 wxPyEndBlockThreads();
1310 // get a brief file type description ("*.txt" => "text document")
1311 PyObject* GetDescription() {
1313 if (self->GetDescription(&str)) {
1315 return PyUnicode_FromWideChar(str.c_str(), str.Len());
1317 return PyString_FromStringAndSize(str.c_str(), str.Len());
1325 // get the command to open/execute the file of given type
1327 PyObject* GetOpenCommand(const wxString& filename,
1328 const wxString& mimetype=wxPyEmptyString) {
1330 if (self->GetOpenCommand(&str, wxFileType::MessageParameters(filename, mimetype))) {
1332 return PyUnicode_FromWideChar(str.c_str(), str.Len());
1334 return PyString_FromStringAndSize(str.c_str(), str.Len());
1342 // get the command to print the file of given type
1344 PyObject* GetPrintCommand(const wxString& filename,
1345 const wxString& mimetype=wxPyEmptyString) {
1347 if (self->GetPrintCommand(&str, wxFileType::MessageParameters(filename, mimetype))) {
1349 return PyUnicode_FromWideChar(str.c_str(), str.Len());
1351 return PyString_FromStringAndSize(str.c_str(), str.Len());
1359 // Get all commands defined for this file type
1361 PyObject* GetAllCommands(const wxString& filename,
1362 const wxString& mimetype=wxPyEmptyString) {
1363 wxArrayString verbs;
1364 wxArrayString commands;
1365 if (self->GetAllCommands(&verbs, &commands,
1366 wxFileType::MessageParameters(filename, mimetype))) {
1367 wxPyBeginBlockThreads();
1368 PyObject* tuple = PyTuple_New(2);
1369 PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs));
1370 PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands));
1371 wxPyEndBlockThreads();
1380 // set an arbitrary command, ask confirmation if it already exists and
1381 // overwriteprompt is TRUE
1382 bool SetCommand(const wxString& cmd, const wxString& verb,
1383 bool overwriteprompt = TRUE);
1385 bool SetDefaultIcon(const wxString& cmd = wxPyEmptyString, int index = 0);
1388 // remove the association for this filetype from the system MIME database:
1389 // notice that it will only work if the association is defined in the user
1390 // file/registry part, we will never modify the system-wide settings
1394 // expand a string in the format of GetOpenCommand (which may contain
1395 // '%s' and '%t' format specificators for the file name and mime type
1396 // and %{param} constructions).
1397 static wxString ExpandCommand(const wxString& command,
1398 const MessageParameters& params);
1400 // dtor (not virtual, shouldn't be derived from)
1408 class wxMimeTypesManager
1411 // static helper functions
1412 // -----------------------
1414 // check if the given MIME type is the same as the other one: the
1415 // second argument may contain wildcards ('*'), but not the first. If
1416 // the types are equal or if the mimeType matches wildcard the function
1417 // returns TRUE, otherwise it returns FALSE
1418 static bool IsOfType(const wxString& mimeType, const wxString& wildcard);
1421 wxMimeTypesManager();
1423 // loads data from standard files according to the mailcap styles
1424 // specified: this is a bitwise OR of wxMailcapStyle values
1426 // use the extraDir parameter if you want to look for files in another
1428 void Initialize(int mailcapStyle = wxMAILCAP_ALL,
1429 const wxString& extraDir = wxPyEmptyString);
1431 // and this function clears all the data from the manager
1434 // Database lookup: all functions return a pointer to wxFileType object
1435 // whose methods may be used to query it for the information you're
1436 // interested in. If the return value is !NULL, caller is responsible for
1438 // get file type from file extension
1439 %new wxFileType *GetFileTypeFromExtension(const wxString& ext);
1441 // get file type from MIME type (in format <category>/<format>)
1442 %new wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
1444 // other operations: return TRUE if there were no errors or FALSE if there
1445 // were some unreckognized entries (the good entries are always read anyhow)
1448 // read in additional file (the standard ones are read automatically)
1449 // in mailcap format (see mimetype.cpp for description)
1451 // 'fallback' parameter may be set to TRUE to avoid overriding the
1452 // settings from other, previously parsed, files by this one: normally,
1453 // the files read most recently would override the older files, but with
1454 // fallback == TRUE this won't happen
1455 bool ReadMailcap(const wxString& filename, bool fallback = FALSE);
1457 // read in additional file in mime.types format
1458 bool ReadMimeTypes(const wxString& filename);
1460 // enumerate all known MIME types
1462 PyObject* EnumAllFileTypes() {
1464 self->EnumAllFileTypes(arr);
1465 return wxArrayString2PyList_helper(arr);
1469 // these functions can be used to provide default values for some of the
1470 // MIME types inside the program itself (you may also use
1471 // ReadMailcap(filenameWithDefaultTypes, TRUE /* use as fallback */) to
1472 // achieve the same goal, but this requires having this info in a file).
1474 void AddFallback(const wxFileTypeInfo& ft);
1477 // create or remove associations
1479 // create a new association using the fields of wxFileTypeInfo (at least
1480 // the MIME type and the extension should be set)
1481 // if the other fields are empty, the existing values should be left alone
1482 %new wxFileType *Associate(const wxFileTypeInfo& ftInfo);
1485 bool Unassociate(wxFileType *ft) ;
1487 // dtor (not virtual, shouldn't be derived from)
1488 ~wxMimeTypesManager();
1496 // See also wxPy_ReinitStockObjects in helpers.cpp
1497 extern wxMimeTypesManager* wxTheMimeTypesManager;
1503 //----------------------------------------------------------------------
1506 #include <wx/artprov.h>
1508 DECLARE_DEF_STRING(ART_OTHER);
1512 %pragma(python) code = "
1514 wxART_TOOLBAR = 'wxART_TOOLBAR_C'
1515 wxART_MENU = 'wxART_MENU_C'
1516 wxART_FRAME_ICON = 'wxART_FRAME_ICON_C'
1517 wxART_CMN_DIALOG = 'wxART_CMN_DIALOG_C'
1518 wxART_HELP_BROWSER = 'wxART_HELP_BROWSER_C'
1519 wxART_MESSAGE_BOX = 'wxART_MESSAGE_BOX_C'
1520 wxART_OTHER = 'wxART_OTHER_C'
1523 wxART_ADD_BOOKMARK = 'wxART_ADD_BOOKMARK'
1524 wxART_DEL_BOOKMARK = 'wxART_DEL_BOOKMARK'
1525 wxART_HELP_SIDE_PANEL = 'wxART_HELP_SIDE_PANEL'
1526 wxART_HELP_SETTINGS = 'wxART_HELP_SETTINGS'
1527 wxART_HELP_BOOK = 'wxART_HELP_BOOK'
1528 wxART_HELP_FOLDER = 'wxART_HELP_FOLDER'
1529 wxART_HELP_PAGE = 'wxART_HELP_PAGE'
1530 wxART_GO_BACK = 'wxART_GO_BACK'
1531 wxART_GO_FORWARD = 'wxART_GO_FORWARD'
1532 wxART_GO_UP = 'wxART_GO_UP'
1533 wxART_GO_DOWN = 'wxART_GO_DOWN'
1534 wxART_GO_TO_PARENT = 'wxART_GO_TO_PARENT'
1535 wxART_GO_HOME = 'wxART_GO_HOME'
1536 wxART_FILE_OPEN = 'wxART_FILE_OPEN'
1537 wxART_PRINT = 'wxART_PRINT'
1538 wxART_HELP = 'wxART_HELP'
1539 wxART_TIP = 'wxART_TIP'
1540 wxART_REPORT_VIEW = 'wxART_REPORT_VIEW'
1541 wxART_LIST_VIEW = 'wxART_LIST_VIEW'
1542 wxART_NEW_DIR = 'wxART_NEW_DIR'
1543 wxART_FOLDER = 'wxART_FOLDER'
1544 wxART_GO_DIR_UP = 'wxART_GO_DIR_UP'
1545 wxART_EXECUTABLE_FILE = 'wxART_EXECUTABLE_FILE'
1546 wxART_NORMAL_FILE = 'wxART_NORMAL_FILE'
1547 wxART_TICK_MARK = 'wxART_TICK_MARK'
1548 wxART_CROSS_MARK = 'wxART_CROSS_MARK'
1549 wxART_ERROR = 'wxART_ERROR'
1550 wxART_QUESTION = 'wxART_QUESTION'
1551 wxART_WARNING = 'wxART_WARNING'
1552 wxART_INFORMATION = 'wxART_INFORMATION'
1553 wxART_MISSING_IMAGE = 'wxART_MISSING_IMAGE'
1556 %{ // Python aware wxArtProvider
1557 class wxPyArtProvider : public wxArtProvider {
1560 virtual wxBitmap CreateBitmap(const wxArtID& id,
1561 const wxArtClient& client,
1562 const wxSize& size) {
1563 wxBitmap rval = wxNullBitmap;
1564 wxPyBeginBlockThreads();
1565 if ((wxPyCBH_findCallback(m_myInst, "CreateBitmap"))) {
1566 PyObject* so = wxPyConstructObject((void*)&size, wxT("wxSize"), 0);
1570 s1 = wx2PyString(id);
1571 s2 = wx2PyString(client);
1572 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOO)", s1, s2, so));
1577 if (!SWIG_GetPtrObj(ro, (void**)&ptr, "_wxBitmap_p"))
1582 wxPyEndBlockThreads();
1590 // The one for SWIG to see
1591 %name(wxArtProvider) class wxPyArtProvider : public wxObject
1596 void _setCallbackInfo(PyObject* self, PyObject* _class);
1597 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxArtProvider)"
1599 // Add new provider to the top of providers stack.
1600 static void PushProvider(wxPyArtProvider *provider);
1602 // Remove latest added provider and delete it.
1603 static bool PopProvider();
1605 // Remove provider. The provider must have been added previously!
1606 // The provider is _not_ deleted.
1607 static bool RemoveProvider(wxPyArtProvider *provider);
1609 // Query the providers for bitmap with given ID and return it. Return
1610 // wxNullBitmap if no provider provides it.
1611 static wxBitmap GetBitmap(const wxString& id,
1612 const wxString& client = wxPyART_OTHER,
1613 const wxSize& size = wxDefaultSize);
1615 // Query the providers for icon with given ID and return it. Return
1616 // wxNullIcon if no provider provides it.
1617 static wxIcon GetIcon(const wxString& id,
1618 const wxString& client = wxPyART_OTHER,
1619 const wxSize& size = wxDefaultSize);
1624 //----------------------------------------------------------------------
1627 #include <wx/docview.h>
1630 class wxFileHistory : public wxObject
1633 wxFileHistory(int maxFiles = 9);
1637 void AddFileToHistory(const wxString& file);
1638 void RemoveFileFromHistory(int i);
1639 int GetMaxFiles() const;
1640 void UseMenu(wxMenu *menu);
1642 // Remove menu from the list (MDI child may be closing)
1643 void RemoveMenu(wxMenu *menu);
1645 void Load(wxConfigBase& config);
1646 void Save(wxConfigBase& config);
1648 void AddFilesToMenu();
1649 %name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu);
1652 wxString GetHistoryFile(int i) const;
1654 int GetCount() const;
1655 %pragma(python) addtoclass = "GetNoHistoryFiles = GetCount"
1659 //----------------------------------------------------------------------
1661 class wxEffects: public wxObject
1664 // Assume system colours
1667 wxColour GetHighlightColour() const;
1668 wxColour GetLightShadow() const;
1669 wxColour GetFaceColour() const;
1670 wxColour GetMediumShadow() const;
1671 wxColour GetDarkShadow() const;
1673 void SetHighlightColour(const wxColour& c);
1674 void SetLightShadow(const wxColour& c);
1675 void SetFaceColour(const wxColour& c);
1676 void SetMediumShadow(const wxColour& c);
1677 void SetDarkShadow(const wxColour& c);
1679 void Set(const wxColour& highlightColour, const wxColour& lightShadow,
1680 const wxColour& faceColour, const wxColour& mediumShadow,
1681 const wxColour& darkShadow);
1683 // Draw a sunken edge
1684 void DrawSunkenEdge(wxDC& dc, const wxRect& rect, int borderSize = 1);
1687 bool TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap);
1691 //----------------------------------------------------------------------
1693 class wxSingleInstanceChecker
1696 // like Create() but no error checking (dangerous!)
1697 wxSingleInstanceChecker(const wxString& name,
1698 const wxString& path = wxPyEmptyString);
1700 // default ctor, use Create() after it
1701 %name(wxPreSingleInstanceChecker) wxSingleInstanceChecker();
1703 ~wxSingleInstanceChecker();
1706 // name must be given and be as unique as possible, it is used as the mutex
1707 // name under Win32 and the lock file name under Unix -
1708 // wxTheApp->GetAppName() may be a good value for this parameter
1710 // path is optional and is ignored under Win32 and used as the directory to
1711 // create the lock file in under Unix (default is wxGetHomeDir())
1713 // returns FALSE if initialization failed, it doesn't mean that another
1714 // instance is running - use IsAnotherRunning() to check it
1715 bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
1717 // is another copy of this program already running?
1718 bool IsAnotherRunning() const;
1721 //----------------------------------------------------------------------
1725 #include <wx/msw/private.h>
1726 #include <wx/dynload.h>
1733 void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method)
1740 // This one only partially works. Appears to be an undocumented
1741 // "standard" convention that not all widgets adhear to. For
1742 // example, for some widgets backgrounds or non-client areas may
1744 ::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
1748 // This one works much better, except for on XP. On Win2k nearly
1749 // all widgets and their children are captured correctly[**]. On
1750 // XP with Themes activated most native widgets draw only
1751 // partially, if at all. Without themes it works just like on
1754 // ** For example the radio buttons in a wxRadioBox are not its
1755 // children by default, but you can capture it via the panel
1756 // instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
1757 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
1758 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
1759 PRF_ERASEBKGND | PRF_OWNED );
1763 // This one is only defined in the latest SDK and is only
1764 // available on XP. MSDN says it is similar to sending WM_PRINT
1765 // so I expect that it will work similar to the above. Since it
1766 // is avaialble only on XP, it can't be compiled like this and
1767 // will have to be loaded dynamically.
1768 // //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
1773 // Use PrintWindow if available, or fallback to WM_PRINT
1774 // otherwise. Unfortunately using PrintWindow is even worse than
1775 // WM_PRINT. For most native widgets nothing is drawn to the dc
1776 // at all, with or without Themes.
1777 typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
1778 static bool s_triedToLoad = false;
1779 static PrintWindow_t pfnPrintWindow = NULL;
1780 if ( !s_triedToLoad )
1783 s_triedToLoad = true;
1784 wxDynamicLibrary dllUser32(_T("user32.dll"));
1785 if ( dllUser32.IsLoaded() )
1787 wxLogNull nolog; // Don't report errors here
1788 pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
1793 printf("Using PrintWindow\n");
1794 pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
1798 printf("Using WM_PRINT\n");
1799 ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
1800 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED );
1807 //----------------------------------------------------------------------
1811 wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
1812 wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess");
1813 wxPyPtrTypeMap_Add("wxArtProvider", "wxPyArtProvider");
1817 //----------------------------------------------------------------------