]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/src/_splitter.i
Removed calls to wx.InitAllImageHandlers.
[wxWidgets.git] / wxPython / src / _splitter.i
... / ...
CommitLineData
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
18MAKE_CONST_WXSTRING2(SplitterNameStr, wxT("splitter"));
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,
30 wxSP_NO_XP_THEME,
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
51DocStr(wxSplitterWindow,
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.", "
55
56Styles
57-------
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
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.
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.
85
86 EVT_SPLITTER_SASH_POS_CHANGED
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 ============================== =======================================
102
103");
104
105
106
107class wxSplitterWindow: public wxWindow
108{
109public:
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() ""
114
115 DocCtorStr(
116 wxSplitterWindow(wxWindow* parent, wxWindowID id=-1,
117 const wxPoint& pos = wxDefaultPosition,
118 const wxSize& size = wxDefaultSize,
119 long style=wxSP_3D,
120 const wxString& name = wxPySplitterNameStr),
121 "Constructor. Creates and shows a SplitterWindow.", "");
122
123 DocCtorStrName(
124 wxSplitterWindow(),
125 "Precreate a SplitterWindow for 2-phase creation.", "",
126 PreSplitterWindow);
127
128
129 DocDeclStr(
130 bool , Create(wxWindow* parent, wxWindowID id=-1,
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& size = wxDefaultSize,
133 long style=wxSP_3D,
134 const wxString& name = wxPySplitterNameStr),
135 "Create the GUI part of the SplitterWindow for the 2-phase create.", "");
136
137
138
139 DocDeclStr(
140 wxWindow *, GetWindow1() const,
141 "Gets the only or left/top pane.", "");
142
143
144 DocDeclStr(
145 wxWindow *, GetWindow2() const,
146 "Gets the right/bottom pane.", "");
147
148
149 DocDeclStr(
150 void , SetSplitMode(int mode),
151 "Sets the split mode. The mode can be wx.SPLIT_VERTICAL or
152wx.SPLIT_HORIZONTAL. This only sets the internal variable; does not
153update the display.", "");
154
155
156 DocDeclStr(
157 wxSplitMode , GetSplitMode() const,
158 "Gets the split mode", "");
159
160
161 DocDeclStr(
162 void , Initialize(wxWindow *window),
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.", "");
166
167
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.
174
175 DocDeclStr(
176 virtual bool , SplitVertically(wxWindow *window1,
177 wxWindow *window2,
178 int sashPosition = 0),
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");
198
199
200 DocDeclStr(
201 virtual bool , SplitHorizontally(wxWindow *window1,
202 wxWindow *window2,
203 int sashPosition = 0),
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
213 the total window height).
214
215Returns True if successful, False otherwise (the window was already
216split).
217
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");
223
224
225
226 DocDeclStr(
227 bool , Unsplit(wxWindow *toRemove = NULL),
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).
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
235removed is only hidden.", "");
236
237
238
239 DocDeclStr(
240 bool , ReplaceWindow(wxWindow *winOld, wxWindow *winNew),
241 "This function replaces one of the windows managed by the
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.", "");
252
253
254 DocDeclStr(
255 void , UpdateSize(),
256 "Causes any pending sizing of the sash and child panes to take place
257immediately.
258
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.", "");
265
266
267
268 DocDeclStr(
269 bool , IsSplit() const,
270 "Is the window split?", "");
271
272
273 DocDeclStr(
274 void , SetSashSize(int width),
275 "Sets the sash size", "");
276
277
278 DocDeclStr(
279 void , SetBorderSize(int width),
280 "Sets the border size", "");
281
282
283 DocDeclStr(
284 int , GetSashSize() const,
285 "Gets the sash size", "");
286
287
288 DocDeclStr(
289 int , GetBorderSize() const,
290 "Gets the border size", "");
291
292
293 DocDeclStr(
294 void , SetSashPosition(int position, bool redraw = True),
295 "Sets the sash position, in pixels. If redraw is Ttrue then the panes
296are resized and the sash and border are redrawn.", "");
297
298
299 DocDeclStr(
300 int , GetSashPosition() const,
301 "Returns the surrent sash position.", "");
302
303
304 DocDeclStr(
305 void , SetMinimumPaneSize(int min),
306 "Sets the minimum pane size in pixels.
307
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.", "");
314
315 DocDeclStr(
316 int , GetMinimumPaneSize() const,
317 "Gets the minimum pane size in pixels.", "");
318
319
320 DocDeclStr(
321 virtual bool , SashHitTest(int x, int y, int tolerance = 5),
322 "Tests for x, y over the sash", "");
323
324
325 DocDeclStr(
326 virtual void , SizeWindows(),
327 "Resizes subwindows", "");
328
329
330 void SetNeedUpdating(bool needUpdating);
331 bool GetNeedUpdating() const;
332
333 static wxVisualAttributes
334 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
335};
336
337
338
339DocStr(wxSplitterEvent,
340 "This class represents the events generated by a splitter control.", "");
341
342class wxSplitterEvent : public wxNotifyEvent
343{
344public:
345 wxSplitterEvent(wxEventType type = wxEVT_NULL,
346 wxSplitterWindow *splitter = (wxSplitterWindow *)NULL);
347
348
349 DocDeclStr(
350 void , SetSashPosition(int pos),
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.", "");
357
358 DocDeclStr(
359 int , GetSashPosition() const,
360 "Returns the new sash position while in EVT_SPLITTER_SASH_POS_CHANGING
361and EVT_SPLITTER_SASH_POS_CHANGED events.", "");
362
363
364 DocDeclStr(
365 wxWindow *, GetWindowBeingRemoved() const,
366 "Returns a pointer to the window being removed when a splitter window
367is unsplit.", "");
368
369
370 DocDeclStr(
371 int , GetX() const,
372 "Returns the x coordinate of the double-click point in a
373EVT_SPLITTER_DCLICK event.", "");
374
375 DocDeclStr(
376 int , GetY() const,
377 "Returns the y coordinate of the double-click point in a
378EVT_SPLITTER_DCLICK event.", "");
379
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 )
395EVT_SPLITTER_DCLICK = EVT_SPLITTER_DOUBLECLICKED
396}
397
398//---------------------------------------------------------------------------
399