1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface defs for wxSplitterWindow
7 // Created: 2-June-1998
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
18 MAKE_CONST_WXSTRING2(SplitterNameStr, wxT("splitter"));
20 //---------------------------------------------------------------------------
38 wxSPLIT_HORIZONTAL = 1,
45 wxSPLIT_DRAG_DRAGGING,
46 wxSPLIT_DRAG_LEFT_DOWN
49 //---------------------------------------------------------------------------
52 // wxSplitterWindow maintains one or two panes, with an optional vertical or
53 // horizontal split which can be used with the mouse or programmatically.
54 class wxSplitterWindow: public wxWindow
57 %pythonPrepend wxSplitterWindow "if kwargs.has_key('point'): kwargs['pos'] = kwargs['point']"
58 %pythonPrepend wxSplitterWindow() ""
59 %pythonAppend wxSplitterWindow "self._setOORInfo(self)"
60 %pythonAppend wxSplitterWindow() ""
62 wxSplitterWindow(wxWindow* parent, wxWindowID id,
63 const wxPoint& pos = wxDefaultPosition,
64 const wxSize& size = wxDefaultSize,
66 const wxString& name = wxPySplitterNameStr);
67 %name(PreSplitterWindow)wxSplitterWindow();
69 bool Create(wxWindow* parent, wxWindowID id,
70 const wxPoint& pos = wxDefaultPosition,
71 const wxSize& size = wxDefaultSize,
73 const wxString& name = wxPySplitterNameStr);
75 // Gets the only or left/top pane
76 wxWindow *GetWindow1() const;
78 // Gets the right/bottom pane
79 wxWindow *GetWindow2() const;
81 // Sets the split mode
82 void SetSplitMode(int mode);
84 // Gets the split mode
85 wxSplitMode GetSplitMode() const;
87 // Initialize with one window
88 void Initialize(wxWindow *window);
90 // Associates the given window with window 2, drawing the appropriate sash
91 // and changing the split mode.
92 // Does nothing and returns False if the window is already split.
93 // A sashPosition of 0 means choose a default sash position,
94 // negative sashPosition specifies the size of right/lower pane as it's
95 // absolute value rather than the size of left/upper pane.
96 virtual bool SplitVertically(wxWindow *window1,
98 int sashPosition = 0);
100 virtual bool SplitHorizontally(wxWindow *window1,
102 int sashPosition = 0);
104 // Removes the specified (or second) window from the view
105 // Doesn't actually delete the window.
106 bool Unsplit(wxWindow *toRemove = NULL);
108 // Replaces one of the windows with another one (neither old nor new
109 // parameter should be NULL)
110 bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
112 // Is the window split?
113 bool IsSplit() const;
115 // Sets the sash size
116 void SetSashSize(int width);
118 // Sets the border size
119 void SetBorderSize(int width);
121 // Gets the sash size
122 int GetSashSize() const;
124 // Gets the border size
125 int GetBorderSize() const;
127 // Set the sash position
128 void SetSashPosition(int position, bool redraw = True);
130 // Gets the sash position
131 int GetSashPosition() const;
133 // If this is zero, we can remove panes by dragging the sash.
134 void SetMinimumPaneSize(int min);
135 int GetMinimumPaneSize() const;
138 // Tests for x, y over sash
139 virtual bool SashHitTest(int x, int y, int tolerance = 5);
141 // Resizes subwindows
142 virtual void SizeWindows();
144 void SetNeedUpdating(bool needUpdating);
145 bool GetNeedUpdating() const;
151 // we reuse the same class for all splitter event types because this is the
152 // usual wxWin convention, but the three event types have different kind of
153 // data associated with them, so the accessors can be only used if the real
154 // event type matches with the one for which the accessors make sense
155 class wxSplitterEvent : public wxNotifyEvent
158 wxSplitterEvent(wxEventType type = wxEVT_NULL,
159 wxSplitterWindow *splitter = (wxSplitterWindow *)NULL);
162 // SASH_POS_CHANGED methods
164 // setting the sash position to -1 prevents the change from taking place at
166 void SetSashPosition(int pos);
167 int GetSashPosition() const;
169 // UNSPLIT event methods
170 wxWindow *GetWindowBeingRemoved() const;
172 // DCLICK event methods
179 %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED;
180 %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING;
181 %constant wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED;
182 %constant wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT;
186 EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 1 )
187 EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 1 )
188 EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 1 )
189 EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_UNSPLIT, 1 )
192 //---------------------------------------------------------------------------