1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG definitions of MORE window classes
 
   7 // Created:     22-Dec-1998
 
   9 // Copyright:   (c) 1998 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  17 #include <wx/sashwin.h>
 
  18 #include <wx/laywin.h>
 
  19 #include <wx/popupwin.h>
 
  20 #include <wx/tipwin.h>
 
  23 //----------------------------------------------------------------------
 
  26 %include my_typemaps.i
 
  28 // Import some definitions of other classes, etc.
 
  37 %pragma(python) code = "import wx"
 
  39 //----------------------------------------------------------------------
 
  42     // Put some wx default wxChar* values into wxStrings.
 
  43     static const wxChar* wxSashNameStr = wxT("sashWindow");
 
  44     DECLARE_DEF_STRING(SashNameStr);
 
  45     static const wxChar* wxSashLayoutNameStr = wxT("layoutWindow");
 
  46     DECLARE_DEF_STRING(SashLayoutNameStr);
 
  48 //---------------------------------------------------------------------------
 
  50 enum wxSashEdgePosition {
 
  69     wxSASH_STATUS_OUT_OF_RANGE
 
  73 class wxSashEvent : public wxCommandEvent {
 
  75     wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE);
 
  77     void SetEdge(wxSashEdgePosition edge);
 
  78     wxSashEdgePosition GetEdge();
 
  79     void SetDragRect(const wxRect& rect);
 
  81     void SetDragStatus(wxSashDragStatus status);
 
  82     wxSashDragStatus GetDragStatus();
 
  87 class wxSashWindow: public wxWindow {
 
  89     wxSashWindow(wxWindow* parent, wxWindowID id,
 
  90                  const wxPoint& pos = wxDefaultPosition,
 
  91                  const wxSize& size = wxDefaultSize,
 
  92                  long style = wxCLIP_CHILDREN | wxSW_3D,
 
  93                  const wxString& name = wxPySashNameStr);
 
  94     %name(wxPreSashWindow)wxSashWindow();
 
  96     bool Create(wxWindow* parent, wxWindowID id,
 
  97                  const wxPoint& pos = wxDefaultPosition,
 
  98                  const wxSize& size = wxDefaultSize,
 
  99                  long style = wxCLIP_CHILDREN | wxSW_3D,
 
 100                  const wxString& name = wxPySashNameStr);
 
 102     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 103     %pragma(python) addtomethod = "wxPreSashWindow:val._setOORInfo(val)"
 
 105     bool GetSashVisible(wxSashEdgePosition edge);
 
 106     int GetDefaultBorderSize();
 
 107     int GetEdgeMargin(wxSashEdgePosition edge);
 
 108     int GetExtraBorderSize();
 
 109     int GetMaximumSizeX();
 
 110     int GetMaximumSizeY();
 
 111     int GetMinimumSizeX();
 
 112     int GetMinimumSizeY();
 
 113     bool HasBorder(wxSashEdgePosition edge);
 
 114     void SetDefaultBorderSize(int width);
 
 115     void SetExtraBorderSize(int width);
 
 116     void SetMaximumSizeX(int min);
 
 117     void SetMaximumSizeY(int min);
 
 118     void SetMinimumSizeX(int min);
 
 119     void SetMinimumSizeY(int min);
 
 120     void SetSashVisible(wxSashEdgePosition edge, bool visible);
 
 121     void SetSashBorder(wxSashEdgePosition edge, bool hasBorder);
 
 126 //---------------------------------------------------------------------------
 
 128 enum wxLayoutOrientation {
 
 133 enum wxLayoutAlignment {
 
 143      wxEVT_QUERY_LAYOUT_INFO,
 
 144      wxEVT_CALCULATE_LAYOUT,
 
 148 class wxQueryLayoutInfoEvent: public wxEvent {
 
 150     wxQueryLayoutInfoEvent(wxWindowID id = 0);
 
 152     void SetRequestedLength(int length);
 
 153     int GetRequestedLength();
 
 154     void SetFlags(int flags);
 
 156     void SetSize(const wxSize& size);
 
 158     void SetOrientation(wxLayoutOrientation orient);
 
 159     wxLayoutOrientation GetOrientation();
 
 160     void SetAlignment(wxLayoutAlignment align);
 
 161     wxLayoutAlignment GetAlignment();
 
 166 class wxCalculateLayoutEvent: public wxEvent {
 
 168     wxCalculateLayoutEvent(wxWindowID id = 0);
 
 170     void SetFlags(int flags);
 
 172     void SetRect(const wxRect& rect);
 
 177 class wxSashLayoutWindow: public wxSashWindow {
 
 179     wxSashLayoutWindow(wxWindow* parent, wxWindowID id,
 
 180                        const wxPoint& pos = wxDefaultPosition,
 
 181                        const wxSize& size = wxDefaultSize,
 
 182                        long style = wxCLIP_CHILDREN | wxSW_3D,
 
 183                        const wxString& name = wxPySashLayoutNameStr);
 
 184     %name(wxPreSashLayoutWindow)wxSashLayoutWindow();
 
 186     bool Create(wxWindow* parent, wxWindowID id,
 
 187                 const wxPoint& pos = wxDefaultPosition,
 
 188                 const wxSize& size = wxDefaultSize,
 
 189                 long style = wxCLIP_CHILDREN | wxSW_3D,
 
 190                 const wxString& name = wxPySashLayoutNameStr);
 
 192     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 193     %pragma(python) addtomethod = "wxPreSashLayoutWindow:val._setOORInfo(val)"
 
 195     wxLayoutAlignment GetAlignment();
 
 196     wxLayoutOrientation GetOrientation();
 
 197     void SetAlignment(wxLayoutAlignment alignment);
 
 198     void SetDefaultSize(const wxSize& size);
 
 199     void SetOrientation(wxLayoutOrientation orientation);
 
 202 //---------------------------------------------------------------------------
 
 204 class wxLayoutAlgorithm : public wxObject {
 
 207     ~wxLayoutAlgorithm();
 
 209     bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL);
 
 210     bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL);
 
 211     bool LayoutWindow(wxWindow* parent, wxWindow* mainWindow = NULL);
 
 215 //---------------------------------------------------------------------------
 
 218 // wxPopupWindow: a special kind of top level window used for popup menus,
 
 219 // combobox popups and such.
 
 220 class wxPopupWindow : public wxWindow {
 
 222     wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
 
 223     %name(wxPrePopupWindow)wxPopupWindow();
 
 225     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 226     %pragma(python) addtomethod = "wxPrePopupWindow:val._setOORInfo(val)"
 
 228     bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
 
 230     // the point must be given in screen coordinates!
 
 231     void Position(const wxPoint& ptOrigin,
 
 237 class wxPyPopupTransientWindow : public wxPopupTransientWindow
 
 240     wxPyPopupTransientWindow() : wxPopupTransientWindow() {}
 
 241     wxPyPopupTransientWindow(wxWindow* parent, int style = wxBORDER_NONE)
 
 242         : wxPopupTransientWindow(parent, style) {}
 
 244     DEC_PYCALLBACK_BOOL_ME(ProcessLeftDown);
 
 245     DEC_PYCALLBACK__(OnDismiss);
 
 246     DEC_PYCALLBACK_BOOL_(CanDismiss);
 
 250 IMP_PYCALLBACK_BOOL_ME(wxPyPopupTransientWindow, wxPopupTransientWindow, ProcessLeftDown);
 
 251 IMP_PYCALLBACK__(wxPyPopupTransientWindow, wxPopupTransientWindow, OnDismiss);
 
 252 IMP_PYCALLBACK_BOOL_(wxPyPopupTransientWindow, wxPopupTransientWindow, CanDismiss);
 
 257 // wxPopupTransientWindow: a wxPopupWindow which disappears automatically
 
 258 // when the user clicks mouse outside it or if it loses focus in any other way
 
 259 %name(wxPopupTransientWindow) class wxPyPopupTransientWindow : public wxPopupWindow
 
 262     wxPyPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE);
 
 263     %name(wxPrePopupTransientWindow)wxPyPopupTransientWindow();
 
 265     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
 266     %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPopupTransientWindow)"
 
 268     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 269     %pragma(python) addtomethod = "wxPrePopupTransientWindow:val._setOORInfo(val)"
 
 271     // popup the window (this will show it too) and keep focus at winFocus
 
 272     // (or itself if it's NULL), dismiss the popup if we lose focus
 
 273     virtual void Popup(wxWindow *focus = NULL);
 
 276     virtual void Dismiss();
 
 279 //---------------------------------------------------------------------------
 
 281 class wxTipWindow : public wxPyPopupTransientWindow
 
 285         wxTipWindow(wxWindow *parent,
 
 286                     const wxString* text,
 
 287                     wxCoord maxLength = 100,
 
 288                     wxRect* rectBound = NULL) {
 
 289             wxString tmp = *text;
 
 290             return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound);
 
 294     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 296     // If rectBound is not NULL, the window will disappear automatically when
 
 297     // the mouse leave the specified rect: note that rectBound should be in the
 
 298     // screen coordinates!
 
 299     void SetBoundingRect(const wxRect& rectBound);
 
 301     // Hide and destroy the window
 
 305 #endif // ! __WXMAC__
 
 307 //---------------------------------------------------------------------------
 
 313 class wxTipWindow : public wxFrame
 
 317         wxTipWindow(wxWindow *parent,
 
 318                     const wxString* text,
 
 319                     wxCoord maxLength = 100,
 
 320                     wxRect* rectBound = NULL) {
 
 321             wxString tmp = *text;
 
 322             return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound);
 
 326     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 328     // If rectBound is not NULL, the window will disappear automatically when
 
 329     // the mouse leave the specified rect: note that rectBound should be in the
 
 330     // screen coordinates!
 
 331     void SetBoundingRect(const wxRect& rectBound);
 
 333     // Hide and destroy the window
 
 339 //---------------------------------------------------------------------------