X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..46ae103b9f08fc4e447d16a6a92b03cf55ee3189:/wxPython/src/_misc.i diff --git a/wxPython/src/_misc.i b/wxPython/src/_misc.i index d2f040c223..291fca6802 100644 --- a/wxPython/src/_misc.i +++ b/wxPython/src/_misc.i @@ -18,6 +18,10 @@ %newgroup +#ifndef __WXX11__ + +MustHaveApp(wxToolTip); + class wxToolTip : public wxObject { public: wxToolTip(const wxString &tip); @@ -30,43 +34,60 @@ public: static void Enable(bool flag); static void SetDelay(long milliseconds); }; +#endif //--------------------------------------------------------------------------- +MustHaveApp(wxCaret); + class wxCaret { public: wxCaret(wxWindow* window, const wxSize& size); - ~wxCaret(); - +// ~wxCaret(); Window takes ownership + + %extend { + DocStr(Destroy, + "Deletes the C++ object this Python object is a proxy for.", ""); + void Destroy() { + delete self; + } + } + bool IsOk(); bool IsVisible(); - %name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT); + wxPoint GetPosition(); - %name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT); + DocDeclAName( + void, GetPosition(int *OUTPUT, int *OUTPUT), + "GetPositionTuple() -> (x,y)", + GetPositionTuple); + wxSize GetSize(); + DocDeclAName( + void, GetSize( int *OUTPUT, int *OUTPUT ), + "GetSizeTuple() -> (width, height)", + GetSizeTuple); + + wxWindow *GetWindow(); - %name(MoveXY)void Move(int x, int y); + %Rename(MoveXY, void, Move(int x, int y)); void Move(const wxPoint& pt); - %name(SetSizeWH) void SetSize(int width, int height); + %Rename(SetSizeWH, void, SetSize(int width, int height)); void SetSize(const wxSize& size); - void Show(int show = TRUE); + void Show(int show = true); void Hide(); - %pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()" -}; + %pythoncode { def __nonzero__(self): return self.IsOk() } -%inline %{ - int wxCaret_GetBlinkTime() { - return wxCaret::GetBlinkTime(); - } + static int GetBlinkTime(); + static void SetBlinkTime(int milliseconds); +}; - void wxCaret_SetBlinkTime(int milliseconds) { - wxCaret::SetBlinkTime(milliseconds); - } -%} //--------------------------------------------------------------------------- +MustHaveApp(wxBusyCursor); + class wxBusyCursor { public: wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR); @@ -75,6 +96,8 @@ public: //--------------------------------------------------------------------------- +MustHaveApp(wxWindowDisabler); + class wxWindowDisabler { public: wxWindowDisabler(wxWindow *winToSkip = NULL); @@ -83,6 +106,8 @@ public: //--------------------------------------------------------------------------- +MustHaveApp(wxBusyInfo); + class wxBusyInfo : public wxObject { public: wxBusyInfo(const wxString& message); @@ -120,7 +145,7 @@ public: class wxFileHistory : public wxObject { public: - wxFileHistory(int maxFiles = 9); + wxFileHistory(int maxFiles = 9, wxWindowID idBase = wxID_FILE1); ~wxFileHistory(); // Operations @@ -136,13 +161,13 @@ public: void Save(wxConfigBase& config); void AddFilesToMenu(); - %name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu); + %Rename(AddFilesToThisMenu, void, AddFilesToMenu(wxMenu* menu)); // Accessors wxString GetHistoryFile(int i) const; int GetCount() const; - %pragma(python) addtoclass = "GetNoHistoryFiles = GetCount" + %pythoncode { GetNoHistoryFiles = GetCount } }; @@ -161,7 +186,7 @@ public: const wxString& path = wxPyEmptyString); // default ctor, use Create() after it - %name(PreSingleInstanceChecker) wxSingleInstanceChecker(); + %RenameCtor(PreSingleInstanceChecker, wxSingleInstanceChecker()); ~wxSingleInstanceChecker(); @@ -173,7 +198,7 @@ public: // path is optional and is ignored under Win32 and used as the directory to // create the lock file in under Unix (default is wxGetHomeDir()) // - // returns FALSE if initialization failed, it doesn't mean that another + // returns False if initialization failed, it doesn't mean that another // instance is running - use IsAnotherRunning() to check it bool Create(const wxString& name, const wxString& path = wxPyEmptyString); @@ -184,8 +209,6 @@ public: //--------------------------------------------------------------------------- // Experimental... - - %{ #ifdef __WXMSW__ #include @@ -196,10 +219,14 @@ public: %inline %{ -void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method) +bool wxDrawWindowOnDC(wxWindow* window, const wxDC& dc +#if 0 + , int method +#endif + ) { #ifdef __WXMSW__ - +#if 0 switch (method) { case 1: @@ -211,11 +238,14 @@ void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method) break; case 2: - // This one works much better, except for on XP. On Win2k nearly - // all widgets and their children are captured correctly[**]. On - // XP with Themes activated most native widgets draw only - // partially, if at all. Without themes it works just like on - // Win2k. +#endif + // This one works much better, nearly all widgets and their + // children are captured correctly[**]. Prior to the big + // background erase changes that Vadim did in 2004-2005 this + // method failed badly on XP with Themes activated, most native + // widgets draw only partially, if at all. Without themes it + // worked just like on Win2k. After those changes this method + // works very well. // // ** For example the radio buttons in a wxRadioBox are not its // children by default, but you can capture it via the panel @@ -223,6 +253,8 @@ void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method) ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc), PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED ); + return true; +#if 0 break; case 3: @@ -256,20 +288,25 @@ void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method) } if (pfnPrintWindow) { - printf("Using PrintWindow\n"); + //printf("Using PrintWindow\n"); pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); } else { - printf("Using WM_PRINT\n"); + //printf("Using WM_PRINT\n"); ::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc), - PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED ); + PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | + PRF_ERASEBKGND | PRF_OWNED ); } } -#endif +#endif // 0 +#else + return false; +#endif // __WXMSW__ } %} + //--------------------------------------------------------------------------- //---------------------------------------------------------------------------