]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_splitter.i
Removed calls to wx.InitAllImageHandlers.
[wxWidgets.git] / wxPython / src / _splitter.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _splitter.i
3// Purpose: SWIG interface defs for wxSplitterWindow
4//
5// Author: Robin Dunn
6//
7// Created: 2-June-1998
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17
b2dc1044 18MAKE_CONST_WXSTRING2(SplitterNameStr, wxT("splitter"));
d14a1e28
RD
19
20//---------------------------------------------------------------------------
21%newgroup
22
23enum {
24 wxSP_NOBORDER,
25 wxSP_NOSASH,
26 wxSP_PERMIT_UNSPLIT,
27 wxSP_LIVE_UPDATE,
28 wxSP_3DSASH,
29 wxSP_3DBORDER,
cefae4bc 30 wxSP_NO_XP_THEME,
d14a1e28
RD
31 wxSP_BORDER,
32 wxSP_3D,
33};
34
35
36enum wxSplitMode
37{
38 wxSPLIT_HORIZONTAL = 1,
39 wxSPLIT_VERTICAL
40};
41
42enum
43{
44 wxSPLIT_DRAG_NONE,
45 wxSPLIT_DRAG_DRAGGING,
46 wxSPLIT_DRAG_LEFT_DOWN
47};
48
49//---------------------------------------------------------------------------
50
66394199 51DocStr(wxSplitterWindow,
d07d2bc9
RD
52"wx.SplitterWindow manages up to two subwindows or panes, with an
53optional vertical or horizontal split which can be used with the mouse
54or programmatically.", "
66394199 55
d07d2bc9
RD
56Styles
57-------
58 ==================== ======================================
66394199
RD
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
68 pre-XP look.
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.
d07d2bc9
RD
73 ==================== ======================================
74
75Events
76------
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.
66394199
RD
85
86 EVT_SPLITTER_SASH_POS_CHANGED
d07d2bc9
RD
87 The sash position was
88 changed. May be used to modify
89 the sash position before it is
90 set, or to prevent the change
91 from taking place.
92
93 EVT_SPLITTER_UNSPLIT The splitter has been just unsplit.
94
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
100 zero.)
101 ============================== =======================================
66394199
RD
102
103");
104
d14a1e28 105
d07d2bc9 106
d14a1e28
RD
107class wxSplitterWindow: public wxWindow
108{
109public:
94eaeb1b 110 %pythonPrepend wxSplitterWindow "if kwargs.has_key('point'): kwargs['pos'] = kwargs['point'];del kwargs['point']"
2b9048c5
RD
111 %pythonPrepend wxSplitterWindow() ""
112 %pythonAppend wxSplitterWindow "self._setOORInfo(self)"
113 %pythonAppend wxSplitterWindow() ""
d14a1e28 114
66394199 115 DocCtorStr(
baf1aa5d 116 wxSplitterWindow(wxWindow* parent, wxWindowID id=-1,
66394199
RD
117 const wxPoint& pos = wxDefaultPosition,
118 const wxSize& size = wxDefaultSize,
119 long style=wxSP_3D,
120 const wxString& name = wxPySplitterNameStr),
d07d2bc9 121 "Constructor. Creates and shows a SplitterWindow.", "");
66394199
RD
122
123 DocCtorStrName(
124 wxSplitterWindow(),
d07d2bc9 125 "Precreate a SplitterWindow for 2-phase creation.", "",
66394199
RD
126 PreSplitterWindow);
127
128
129 DocDeclStr(
baf1aa5d 130 bool , Create(wxWindow* parent, wxWindowID id=-1,
66394199
RD
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& size = wxDefaultSize,
133 long style=wxSP_3D,
134 const wxString& name = wxPySplitterNameStr),
d07d2bc9 135 "Create the GUI part of the SplitterWindow for the 2-phase create.", "");
66394199
RD
136
137
138
139 DocDeclStr(
140 wxWindow *, GetWindow1() const,
d07d2bc9 141 "Gets the only or left/top pane.", "");
66394199
RD
142
143
144 DocDeclStr(
145 wxWindow *, GetWindow2() const,
d07d2bc9 146 "Gets the right/bottom pane.", "");
66394199
RD
147
148
149 DocDeclStr(
150 void , SetSplitMode(int mode),
151 "Sets the split mode. The mode can be wx.SPLIT_VERTICAL or
d07d2bc9
RD
152wx.SPLIT_HORIZONTAL. This only sets the internal variable; does not
153update the display.", "");
66394199
RD
154
155
156 DocDeclStr(
157 wxSplitMode , GetSplitMode() const,
d07d2bc9 158 "Gets the split mode", "");
66394199
RD
159
160
161 DocDeclStr(
162 void , Initialize(wxWindow *window),
d07d2bc9
RD
163 "Initializes the splitter window to have one pane. This should be
164called if you wish to initially view only a single pane in the
165splitter window.", "");
66394199 166
d14a1e28
RD
167
168 // Associates the given window with window 2, drawing the appropriate sash
169 // and changing the split mode.
dd9f7fea 170 // Does nothing and returns False if the window is already split.
d14a1e28
RD
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.
66394199
RD
174
175 DocDeclStr(
176 virtual bool , SplitVertically(wxWindow *window1,
177 wxWindow *window2,
178 int sashPosition = 0),
d07d2bc9
RD
179 "Initializes the left and right panes of the splitter window.",
180 "
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).
189
190Returns True if successful, False otherwise (the window was already
191split).
192
193SplitVertically should be called if you wish to initially view two
194panes. It can also be called at any subsequent time, but the
195application should check that the window is not currently split using
196IsSplit.
197");
66394199
RD
198
199
200 DocDeclStr(
201 virtual bool , SplitHorizontally(wxWindow *window1,
202 wxWindow *window2,
203 int sashPosition = 0),
d07d2bc9
RD
204 "Initializes the top and bottom panes of the splitter window.",
205 "
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
66394199
RD
213 the total window height).
214
d07d2bc9
RD
215Returns True if successful, False otherwise (the window was already
216split).
66394199 217
d07d2bc9
RD
218SplitHorizontally should be called if you wish to initially view two
219panes. It can also be called at any subsequent time, but the
220application should check that the window is not currently split using
221IsSplit.
222");
66394199
RD
223
224
225
226 DocDeclStr(
227 bool , Unsplit(wxWindow *toRemove = NULL),
d07d2bc9
RD
228 "Unsplits the window. Pass the pane to remove, or None to remove the
229right or bottom pane. Returns True if successful, False otherwise (the
230window was not split).
66394199
RD
231
232This function will not actually delete the pane being
233removed; it sends EVT_SPLITTER_UNSPLIT which can be handled
234for the desired behaviour. By default, the pane being
d07d2bc9 235removed is only hidden.", "");
66394199
RD
236
237
238
239 DocDeclStr(
240 bool , ReplaceWindow(wxWindow *winOld, wxWindow *winNew),
241 "This function replaces one of the windows managed by the
d07d2bc9
RD
242SplitterWindow with another one. It is in general better to use it
243instead of calling Unsplit() and then resplitting the window back
244because it will provoke much less flicker. It is valid to call this
245function whether the splitter has two windows or only one.
246
247Both parameters should be non-None and winOld must specify one of the
248windows managed by the splitter. If the parameters are incorrect or
249the window couldn't be replaced, False is returned. Otherwise the
250function will return True, but please notice that it will not Destroy
251the replaced window and you may wish to do it yourself.", "");
66394199
RD
252
253
254 DocDeclStr(
255 void , UpdateSize(),
d07d2bc9
RD
256 "Causes any pending sizing of the sash and child panes to take place
257immediately.
66394199 258
d07d2bc9
RD
259Such resizing normally takes place in idle time, in order to wait for
260layout to be completed. However, this can cause unacceptable flicker
261as the panes are resized after the window has been shown. To work
262around this, you can perform window layout (for example by sending a
263size event to the parent window), and then call this function, before
264showing the top-level window.", "");
66394199
RD
265
266
267
268 DocDeclStr(
269 bool , IsSplit() const,
d07d2bc9 270 "Is the window split?", "");
66394199
RD
271
272
273 DocDeclStr(
274 void , SetSashSize(int width),
d07d2bc9 275 "Sets the sash size", "");
66394199
RD
276
277
278 DocDeclStr(
279 void , SetBorderSize(int width),
d07d2bc9 280 "Sets the border size", "");
66394199
RD
281
282
283 DocDeclStr(
284 int , GetSashSize() const,
d07d2bc9 285 "Gets the sash size", "");
66394199
RD
286
287
288 DocDeclStr(
289 int , GetBorderSize() const,
d07d2bc9 290 "Gets the border size", "");
66394199
RD
291
292
293 DocDeclStr(
294 void , SetSashPosition(int position, bool redraw = True),
d07d2bc9
RD
295 "Sets the sash position, in pixels. If redraw is Ttrue then the panes
296are resized and the sash and border are redrawn.", "");
66394199
RD
297
298
299 DocDeclStr(
300 int , GetSashPosition() const,
d07d2bc9 301 "Returns the surrent sash position.", "");
66394199
RD
302
303
304 DocDeclStr(
305 void , SetMinimumPaneSize(int min),
306 "Sets the minimum pane size in pixels.
307
d07d2bc9
RD
308The default minimum pane size is zero, which means that either pane
309can be reduced to zero by dragging the sash, thus removing one of the
310panes. To prevent this behaviour (and veto out-of-range sash
311dragging), set a minimum size, for example 20 pixels. If the
312wx.SP_PERMIT_UNSPLIT style is used when a splitter window is created,
313the window may be unsplit even if minimum size is non-zero.", "");
66394199
RD
314
315 DocDeclStr(
316 int , GetMinimumPaneSize() const,
d07d2bc9 317 "Gets the minimum pane size in pixels.", "");
66394199
RD
318
319
320 DocDeclStr(
321 virtual bool , SashHitTest(int x, int y, int tolerance = 5),
d07d2bc9 322 "Tests for x, y over the sash", "");
66394199
RD
323
324
325 DocDeclStr(
326 virtual void , SizeWindows(),
d07d2bc9 327 "Resizes subwindows", "");
66394199 328
d14a1e28
RD
329
330 void SetNeedUpdating(bool needUpdating);
331 bool GetNeedUpdating() const;
880715c9
RD
332
333 static wxVisualAttributes
334 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
d14a1e28
RD
335};
336
337
338
66394199 339DocStr(wxSplitterEvent,
d07d2bc9 340 "This class represents the events generated by a splitter control.", "");
d14a1e28 341
d14a1e28
RD
342class wxSplitterEvent : public wxNotifyEvent
343{
344public:
345 wxSplitterEvent(wxEventType type = wxEVT_NULL,
346 wxSplitterWindow *splitter = (wxSplitterWindow *)NULL);
347
348
66394199
RD
349 DocDeclStr(
350 void , SetSashPosition(int pos),
d07d2bc9
RD
351 "This funciton is only meaningful during EVT_SPLITTER_SASH_POS_CHANGING
352and EVT_SPLITTER_SASH_POS_CHANGED events. In the case of _CHANGED
353events, sets the the new sash position. In the case of _CHANGING
354events, sets the new tracking bar position so visual feedback during
355dragging will represent that change that will actually take place. Set
356to -1 from the event handler code to prevent repositioning.", "");
66394199
RD
357
358 DocDeclStr(
359 int , GetSashPosition() const,
d07d2bc9
RD
360 "Returns the new sash position while in EVT_SPLITTER_SASH_POS_CHANGING
361and EVT_SPLITTER_SASH_POS_CHANGED events.", "");
66394199 362
d14a1e28 363
66394199
RD
364 DocDeclStr(
365 wxWindow *, GetWindowBeingRemoved() const,
d07d2bc9
RD
366 "Returns a pointer to the window being removed when a splitter window
367is unsplit.", "");
66394199 368
d14a1e28 369
66394199
RD
370 DocDeclStr(
371 int , GetX() const,
372 "Returns the x coordinate of the double-click point in a
d07d2bc9 373EVT_SPLITTER_DCLICK event.", "");
66394199
RD
374
375 DocDeclStr(
376 int , GetY() const,
377 "Returns the y coordinate of the double-click point in a
d07d2bc9 378EVT_SPLITTER_DCLICK event.", "");
66394199 379
d14a1e28
RD
380};
381
382
383
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;
388
389
390%pythoncode {
391EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 1 )
392EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 1 )
393EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 1 )
394EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_UNSPLIT, 1 )
bb96dd93 395EVT_SPLITTER_DCLICK = EVT_SPLITTER_DOUBLECLICKED
d14a1e28
RD
396}
397
398//---------------------------------------------------------------------------
399