X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/09f3d4e679f5742c54fb062ede846b77606a9c5b..bffe56c5d19df9926686722fc09ad096afb47633:/wxPython/src/windows3.i diff --git a/wxPython/src/windows3.i b/wxPython/src/windows3.i index 6b99ab1f32..bb2b7300d5 100644 --- a/wxPython/src/windows3.i +++ b/wxPython/src/windows3.i @@ -16,6 +16,10 @@ #include "helpers.h" #include #include +#ifndef __WXMAC__ +#include +#include +#endif %} //---------------------------------------------------------------------- @@ -34,6 +38,15 @@ %pragma(python) code = "import wx" +//---------------------------------------------------------------------- + +%{ + // Put some wx default wxChar* values into wxStrings. + static const wxChar* wxSashNameStr = wxT("sashWindow"); + DECLARE_DEF_STRING(SashNameStr); + static const wxChar* wxSashLayoutNameStr = wxT("layoutWindow"); + DECLARE_DEF_STRING(SashLayoutNameStr); +%} //--------------------------------------------------------------------------- enum wxSashEdgePosition { @@ -79,14 +92,17 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLIP_CHILDREN | wxSW_3D, - const char* name = "sashWindow"); + const wxString& name = wxPySashNameStr); %name(wxPreSashWindow)wxSashWindow(); bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLIP_CHILDREN | wxSW_3D, - const char* name = "sashWindow"); + const wxString& name = wxPySashNameStr); + + %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" + %pragma(python) addtomethod = "wxPreSashWindow:val._setOORInfo(val)" bool GetSashVisible(wxSashEdgePosition edge); int GetDefaultBorderSize(); @@ -166,14 +182,17 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLIP_CHILDREN | wxSW_3D, - const char* name = "layoutWindow"); + const wxString& name = wxPySashLayoutNameStr); %name(wxPreSashLayoutWindow)wxSashLayoutWindow(); bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLIP_CHILDREN | wxSW_3D, - const char* name = "layoutWindow"); + const wxString& name = wxPySashLayoutNameStr); + + %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" + %pragma(python) addtomethod = "wxPreSashLayoutWindow:val._setOORInfo(val)" wxLayoutAlignment GetAlignment(); wxLayoutOrientation GetOrientation(); @@ -195,5 +214,97 @@ public: }; +//--------------------------------------------------------------------------- +#ifndef __WXMAC__ + +// wxPopupWindow: a special kind of top level window used for popup menus, +// combobox popups and such. +class wxPopupWindow : public wxWindow { +public: + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE); + %name(wxPrePopupWindow)wxPopupWindow(); + + %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" + %pragma(python) addtomethod = "wxPrePopupWindow:val._setOORInfo(val)" + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + + // the point must be given in screen coordinates! + void Position(const wxPoint& ptOrigin, + const wxSize& size); +}; + + +%{ +class wxPyPopupTransientWindow : public wxPopupTransientWindow +{ +public: + wxPyPopupTransientWindow() : wxPopupTransientWindow() {} + wxPyPopupTransientWindow(wxWindow* parent, int style = wxBORDER_NONE) + : wxPopupTransientWindow(parent, style) {} + + DEC_PYCALLBACK_BOOL_ME(ProcessLeftDown); + DEC_PYCALLBACK__(OnDismiss); + DEC_PYCALLBACK_BOOL_(CanDismiss); + PYPRIVATE; +}; + +IMP_PYCALLBACK_BOOL_ME(wxPyPopupTransientWindow, wxPopupTransientWindow, ProcessLeftDown); +IMP_PYCALLBACK__(wxPyPopupTransientWindow, wxPopupTransientWindow, OnDismiss); +IMP_PYCALLBACK_BOOL_(wxPyPopupTransientWindow, wxPopupTransientWindow, CanDismiss); +%} + + + +// wxPopupTransientWindow: a wxPopupWindow which disappears automatically +// when the user clicks mouse outside it or if it loses focus in any other way +%name(wxPopupTransientWindow) class wxPyPopupTransientWindow : public wxPopupWindow +{ +public: + wxPyPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE); + %name(wxPrePopupTransientWindow)wxPyPopupTransientWindow(); + + void _setCallbackInfo(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPopupTransientWindow)" + + %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" + %pragma(python) addtomethod = "wxPrePopupTransientWindow:val._setOORInfo(val)" + + // popup the window (this will show it too) and keep focus at winFocus + // (or itself if it's NULL), dismiss the popup if we lose focus + virtual void Popup(wxWindow *focus = NULL); + + // hide the window + virtual void Dismiss(); +}; + +//--------------------------------------------------------------------------- + +class wxTipWindow : public wxPyPopupTransientWindow +{ +public: + %addmethods { + wxTipWindow(wxWindow *parent, + const wxString* text, + wxCoord maxLength = 100, + wxRect* rectBound = NULL) { + wxString tmp = *text; + return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound); + } + } + + %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" + + // If rectBound is not NULL, the window will disappear automatically when + // the mouse leave the specified rect: note that rectBound should be in the + // screen coordinates! + void SetBoundingRect(const wxRect& rectBound); + + // Hide and destroy the window + void Close(); +}; + + //--------------------------------------------------------------------------- +#endif