X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/92956ab232b5154998cb82e9f1df83307e3c05b6..69555b5c861e666a038c5adfbb64178408f50e88:/wxPython/src/_misc.i diff --git a/wxPython/src/_misc.i b/wxPython/src/_misc.i index 3390427f94..0f7c62c3ea 100644 --- a/wxPython/src/_misc.i +++ b/wxPython/src/_misc.i @@ -24,8 +24,13 @@ MustHaveApp(wxToolTip); class wxToolTip : public wxObject { public: + %typemap(out) wxToolTip*; // turn off this typemap wxToolTip(const wxString &tip); + // Turn it back on again + %typemap(out) wxToolTip* { $result = wxPyMake_wxObject($1, $owner); } + ~wxToolTip(); + void SetTip(const wxString& tip); wxString GetTip(); // *** Not in the "public" interface void SetWindow(wxWindow *win); @@ -43,8 +48,17 @@ MustHaveApp(wxCaret); class wxCaret { public: wxCaret(wxWindow* window, const wxSize& size); - ~wxCaret(); - + ~wxCaret(); + + %extend { + %pythonAppend Destroy "args[0].thisown = 0" + DocStr(Destroy, + "Deletes the C++ object this Python object is a proxy for.", ""); + void Destroy() { + delete self; + } + } + bool IsOk(); bool IsVisible(); @@ -62,25 +76,19 @@ public: 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 Hide(); %pythoncode { def __nonzero__(self): return self.IsOk() } + + static int GetBlinkTime(); + static void SetBlinkTime(int milliseconds); }; -%inline %{ - int wxCaret_GetBlinkTime() { - return wxCaret::GetBlinkTime(); - } - - void wxCaret_SetBlinkTime(int milliseconds) { - wxCaret::SetBlinkTime(milliseconds); - } -%} //--------------------------------------------------------------------------- @@ -110,6 +118,8 @@ class wxBusyInfo : public wxObject { public: wxBusyInfo(const wxString& message); ~wxBusyInfo(); + + %pythoncode { def Destroy(self): pass } }; @@ -159,7 +169,7 @@ 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; @@ -184,7 +194,7 @@ public: const wxString& path = wxPyEmptyString); // default ctor, use Create() after it - %name(PreSingleInstanceChecker) wxSingleInstanceChecker(); + %RenameCtor(PreSingleInstanceChecker, wxSingleInstanceChecker()); ~wxSingleInstanceChecker(); @@ -207,8 +217,6 @@ public: //--------------------------------------------------------------------------- // Experimental... - - %{ #ifdef __WXMSW__ #include @@ -219,10 +227,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: @@ -234,11 +246,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 @@ -246,6 +261,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: @@ -279,20 +296,75 @@ 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__ } %} + + +#if 0 +%{ + void t_output_tester1(int* a, int* b, int* c, int* d) + { + *a = 1234; + *b = 2345; + *c = 3456; + *d = 4567; + } + PyObject* t_output_tester2(int* a, int* b, int* c, int* d) + { + *a = 1234; + *b = 2345; + *c = 3456; + *d = 4567; + Py_INCREF(Py_None); + return Py_None; + } + PyObject* t_output_tester3(int* a, int* b, int* c, int* d) + { + *a = 1234; + *b = 2345; + *c = 3456; + *d = 4567; + PyObject* res = PyTuple_New(2); + PyTuple_SetItem(res, 0, PyInt_FromLong(1)); + PyTuple_SetItem(res, 1, PyInt_FromLong(2)); + return res; + } + PyObject* t_output_tester4() + { + PyObject* res = PyTuple_New(2); + PyTuple_SetItem(res, 0, PyInt_FromLong(132)); + PyTuple_SetItem(res, 1, PyInt_FromLong(244)); + return res; + } +%} + +%newobject t_output_tester2; +%newobject t_output_tester3; +%newobject t_output_tester4; + +void t_output_tester1(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT); +PyObject* t_output_tester2(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT); +PyObject* t_output_tester3(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT); +PyObject* t_output_tester4(); + +#endif + //--------------------------------------------------------------------------- //---------------------------------------------------------------------------