]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_splitter.i
reSWIGged
[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
51
52// wxSplitterWindow maintains one or two panes, with an optional vertical or
53// horizontal split which can be used with the mouse or programmatically.
54class wxSplitterWindow: public wxWindow
55{
56public:
2b9048c5
RD
57 %pythonPrepend wxSplitterWindow "if kwargs.has_key('point'): kwargs['pos'] = kwargs['point']"
58 %pythonPrepend wxSplitterWindow() ""
59 %pythonAppend wxSplitterWindow "self._setOORInfo(self)"
60 %pythonAppend wxSplitterWindow() ""
d14a1e28
RD
61
62 wxSplitterWindow(wxWindow* parent, wxWindowID id,
2b9048c5 63 const wxPoint& pos = wxDefaultPosition,
d14a1e28
RD
64 const wxSize& size = wxDefaultSize,
65 long style=wxSP_3D,
66 const wxString& name = wxPySplitterNameStr);
67 %name(PreSplitterWindow)wxSplitterWindow();
68
69 bool Create(wxWindow* parent, wxWindowID id,
2b9048c5 70 const wxPoint& pos = wxDefaultPosition,
d14a1e28
RD
71 const wxSize& size = wxDefaultSize,
72 long style=wxSP_3D,
73 const wxString& name = wxPySplitterNameStr);
74
75 // Gets the only or left/top pane
76 wxWindow *GetWindow1() const;
77
78 // Gets the right/bottom pane
79 wxWindow *GetWindow2() const;
80
81 // Sets the split mode
82 void SetSplitMode(int mode);
83
84 // Gets the split mode
85 wxSplitMode GetSplitMode() const;
86
87 // Initialize with one window
88 void Initialize(wxWindow *window);
89
90 // Associates the given window with window 2, drawing the appropriate sash
91 // and changing the split mode.
dd9f7fea 92 // Does nothing and returns False if the window is already split.
d14a1e28
RD
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,
97 wxWindow *window2,
98 int sashPosition = 0);
99
100 virtual bool SplitHorizontally(wxWindow *window1,
101 wxWindow *window2,
102 int sashPosition = 0);
103
104 // Removes the specified (or second) window from the view
105 // Doesn't actually delete the window.
106 bool Unsplit(wxWindow *toRemove = NULL);
107
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);
111
112 // Is the window split?
113 bool IsSplit() const;
114
115 // Sets the sash size
116 void SetSashSize(int width);
117
118 // Sets the border size
119 void SetBorderSize(int width);
120
121 // Gets the sash size
122 int GetSashSize() const;
123
124 // Gets the border size
125 int GetBorderSize() const;
126
127 // Set the sash position
dd9f7fea 128 void SetSashPosition(int position, bool redraw = True);
d14a1e28
RD
129
130 // Gets the sash position
131 int GetSashPosition() const;
132
133 // If this is zero, we can remove panes by dragging the sash.
134 void SetMinimumPaneSize(int min);
135 int GetMinimumPaneSize() const;
136
137
138 // Tests for x, y over sash
139 virtual bool SashHitTest(int x, int y, int tolerance = 5);
140
141 // Resizes subwindows
142 virtual void SizeWindows();
143
144 void SetNeedUpdating(bool needUpdating);
145 bool GetNeedUpdating() const;
146};
147
148
149
150
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
155class wxSplitterEvent : public wxNotifyEvent
156{
157public:
158 wxSplitterEvent(wxEventType type = wxEVT_NULL,
159 wxSplitterWindow *splitter = (wxSplitterWindow *)NULL);
160
161
162 // SASH_POS_CHANGED methods
163
164 // setting the sash position to -1 prevents the change from taking place at
165 // all
166 void SetSashPosition(int pos);
167 int GetSashPosition() const;
168
169 // UNSPLIT event methods
170 wxWindow *GetWindowBeingRemoved() const;
171
172 // DCLICK event methods
173 int GetX() const;
174 int GetY() const;
175};
176
177
178
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;
183
184
185%pythoncode {
186EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 1 )
187EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 1 )
188EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 1 )
189EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_UNSPLIT, 1 )
190}
191
192//---------------------------------------------------------------------------
193