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 //---------------------------------------------------------------------------
51 DocStr(wxSplitterWindow,
52 "wx.SplitterWindow manages up to two subwindows or panes, with an
53 optional vertical or horizontal split which can be used with the mouse
54 or programmatically.", "
58 ==================== ======================================
59 wx.SP_3D Draws a 3D effect border and sash.
60 wx.SP_3DSASH Draws a 3D effect sash.
61 wx.SP_3DBORDER Synonym for wxSP_BORDER.
62 wx.SP_BORDER Draws a standard border.
63 wx.SP_NOBORDER No border (default).
64 wx.SP_NO_XP_THEME Under Windows XP, switches off the
65 attempt to draw the splitter
66 using Windows XP theming, so the
67 borders and sash will take on the
69 wx.SP_PERMIT_UNSPLIT Always allow to unsplit, even with
70 the minimum pane size other than zero.
71 wx.SP_LIVE_UPDATE Don't draw XOR line but resize the
72 child windows immediately.
73 ==================== ======================================
77 ============================== =======================================
78 EVT_SPLITTER_SASH_POS_CHANGING The sash position is in the
79 process of being changed. May be
80 used to modify the position of
81 the tracking bar to properly
82 reflect the position that would
83 be set if the drag were to be
84 completed at this point.
86 EVT_SPLITTER_SASH_POS_CHANGED
88 changed. May be used to modify
89 the sash position before it is
90 set, or to prevent the change
93 EVT_SPLITTER_UNSPLIT The splitter has been just unsplit.
95 EVT_SPLITTER_DCLICK The sash was double clicked. The
96 default behaviour is to unsplit
97 the window when this happens
98 (unless the minimum pane size has
99 been set to a value greater than
101 ============================== =======================================
107 class wxSplitterWindow: public wxWindow
110 %pythonPrepend wxSplitterWindow "if kwargs.has_key('point'): kwargs['pos'] = kwargs['point'];del kwargs['point']"
111 %pythonPrepend wxSplitterWindow() ""
112 %pythonAppend wxSplitterWindow "self._setOORInfo(self)"
113 %pythonAppend wxSplitterWindow() ""
116 wxSplitterWindow(wxWindow* parent, wxWindowID id=-1,
117 const wxPoint& pos = wxDefaultPosition,
118 const wxSize& size = wxDefaultSize,
120 const wxString& name = wxPySplitterNameStr),
121 "Constructor. Creates and shows a SplitterWindow.", "");
125 "Precreate a SplitterWindow for 2-phase creation.", "",
130 bool , Create(wxWindow* parent, wxWindowID id=-1,
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& size = wxDefaultSize,
134 const wxString& name = wxPySplitterNameStr),
135 "Create the GUI part of the SplitterWindow for the 2-phase create.", "");
140 wxWindow *, GetWindow1() const,
141 "Gets the only or left/top pane.", "");
145 wxWindow *, GetWindow2() const,
146 "Gets the right/bottom pane.", "");
150 void , SetSplitMode(int mode),
151 "Sets the split mode. The mode can be wx.SPLIT_VERTICAL or
152 wx.SPLIT_HORIZONTAL. This only sets the internal variable; does not
153 update the display.", "");
157 wxSplitMode , GetSplitMode() const,
158 "Gets the split mode", "");
162 void , Initialize(wxWindow *window),
163 "Initializes the splitter window to have one pane. This should be
164 called if you wish to initially view only a single pane in the
165 splitter window.", "");
168 // Associates the given window with window 2, drawing the appropriate sash
169 // and changing the split mode.
170 // Does nothing and returns False if the window is already split.
171 // A sashPosition of 0 means choose a default sash position,
172 // negative sashPosition specifies the size of right/lower pane as it's
173 // absolute value rather than the size of left/upper pane.
176 virtual bool , SplitVertically(wxWindow *window1,
178 int sashPosition = 0),
179 "Initializes the left and right panes of the splitter window.",
181 :param window1: The left pane.
182 :param window2: The right pane.
183 :param sashPosition: The initial position of the sash. If this
184 value is positive, it specifies the size of the left
185 pane. If it is negative, it is absolute value gives
186 the size of the right pane. Finally, specify 0
187 (default) to choose the default position (half of
188 the total window width).
190 Returns True if successful, False otherwise (the window was already
193 SplitVertically should be called if you wish to initially view two
194 panes. It can also be called at any subsequent time, but the
195 application should check that the window is not currently split using
201 virtual bool , SplitHorizontally(wxWindow *window1,
203 int sashPosition = 0),
204 "Initializes the top and bottom panes of the splitter window.",
206 :param window1: The top pane.
207 :param window2: The bottom pane.
208 :param sashPosition: The initial position of the sash. If this
209 value is positive, it specifies the size of the
210 upper pane. If it is negative, it is absolute value
211 gives the size of the lower pane. Finally, specify 0
212 (default) to choose the default position (half of
213 the total window height).
215 Returns True if successful, False otherwise (the window was already
218 SplitHorizontally should be called if you wish to initially view two
219 panes. It can also be called at any subsequent time, but the
220 application should check that the window is not currently split using
227 bool , Unsplit(wxWindow *toRemove = NULL),
228 "Unsplits the window. Pass the pane to remove, or None to remove the
229 right or bottom pane. Returns True if successful, False otherwise (the
230 window was not split).
232 This function will not actually delete the pane being
233 removed; it sends EVT_SPLITTER_UNSPLIT which can be handled
234 for the desired behaviour. By default, the pane being
235 removed is only hidden.", "");
240 bool , ReplaceWindow(wxWindow *winOld, wxWindow *winNew),
241 "This function replaces one of the windows managed by the
242 SplitterWindow with another one. It is in general better to use it
243 instead of calling Unsplit() and then resplitting the window back
244 because it will provoke much less flicker. It is valid to call this
245 function whether the splitter has two windows or only one.
247 Both parameters should be non-None and winOld must specify one of the
248 windows managed by the splitter. If the parameters are incorrect or
249 the window couldn't be replaced, False is returned. Otherwise the
250 function will return True, but please notice that it will not Destroy
251 the replaced window and you may wish to do it yourself.", "");
256 "Causes any pending sizing of the sash and child panes to take place
259 Such resizing normally takes place in idle time, in order to wait for
260 layout to be completed. However, this can cause unacceptable flicker
261 as the panes are resized after the window has been shown. To work
262 around this, you can perform window layout (for example by sending a
263 size event to the parent window), and then call this function, before
264 showing the top-level window.", "");
269 bool , IsSplit() const,
270 "Is the window split?", "");
274 void , SetSashSize(int width),
275 "Sets the sash size", "");
279 void , SetBorderSize(int width),
280 "Sets the border size", "");
284 int , GetSashSize() const,
285 "Gets the sash size", "");
289 int , GetBorderSize() const,
290 "Gets the border size", "");
294 void , SetSashPosition(int position, bool redraw = True),
295 "Sets the sash position, in pixels. If redraw is Ttrue then the panes
296 are resized and the sash and border are redrawn.", "");
300 int , GetSashPosition() const,
301 "Returns the surrent sash position.", "");
305 void , SetMinimumPaneSize(int min),
306 "Sets the minimum pane size in pixels.
308 The default minimum pane size is zero, which means that either pane
309 can be reduced to zero by dragging the sash, thus removing one of the
310 panes. To prevent this behaviour (and veto out-of-range sash
311 dragging), set a minimum size, for example 20 pixels. If the
312 wx.SP_PERMIT_UNSPLIT style is used when a splitter window is created,
313 the window may be unsplit even if minimum size is non-zero.", "");
316 int , GetMinimumPaneSize() const,
317 "Gets the minimum pane size in pixels.", "");
321 virtual bool , SashHitTest(int x, int y, int tolerance = 5),
322 "Tests for x, y over the sash", "");
326 virtual void , SizeWindows(),
327 "Resizes subwindows", "");
330 void SetNeedUpdating(bool needUpdating);
331 bool GetNeedUpdating() const;
333 static wxVisualAttributes
334 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
339 DocStr(wxSplitterEvent,
340 "This class represents the events generated by a splitter control.", "");
342 class wxSplitterEvent : public wxNotifyEvent
345 wxSplitterEvent(wxEventType type = wxEVT_NULL,
346 wxSplitterWindow *splitter = (wxSplitterWindow *)NULL);
350 void , SetSashPosition(int pos),
351 "This funciton is only meaningful during EVT_SPLITTER_SASH_POS_CHANGING
352 and EVT_SPLITTER_SASH_POS_CHANGED events. In the case of _CHANGED
353 events, sets the the new sash position. In the case of _CHANGING
354 events, sets the new tracking bar position so visual feedback during
355 dragging will represent that change that will actually take place. Set
356 to -1 from the event handler code to prevent repositioning.", "");
359 int , GetSashPosition() const,
360 "Returns the new sash position while in EVT_SPLITTER_SASH_POS_CHANGING
361 and EVT_SPLITTER_SASH_POS_CHANGED events.", "");
365 wxWindow *, GetWindowBeingRemoved() const,
366 "Returns a pointer to the window being removed when a splitter window
372 "Returns the x coordinate of the double-click point in a
373 EVT_SPLITTER_DCLICK event.", "");
377 "Returns the y coordinate of the double-click point in a
378 EVT_SPLITTER_DCLICK event.", "");
384 %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED;
385 %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING;
386 %constant wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED;
387 %constant wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT;
391 EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 1 )
392 EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 1 )
393 EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 1 )
394 EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_UNSPLIT, 1 )
395 EVT_SPLITTER_DCLICK = EVT_SPLITTER_DOUBLECLICKED
398 //---------------------------------------------------------------------------