]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | %{ | |
19 | static const wxChar* wxSplitterNameStr = wxT("splitter"); | |
20 | DECLARE_DEF_STRING(SplitterNameStr); | |
21 | %} | |
22 | ||
23 | ||
24 | //--------------------------------------------------------------------------- | |
25 | %newgroup | |
26 | ||
27 | enum { | |
28 | wxSP_NOBORDER, | |
29 | wxSP_NOSASH, | |
30 | wxSP_PERMIT_UNSPLIT, | |
31 | wxSP_LIVE_UPDATE, | |
32 | wxSP_3DSASH, | |
33 | wxSP_3DBORDER, | |
34 | wxSP_BORDER, | |
35 | wxSP_3D, | |
36 | }; | |
37 | ||
38 | ||
39 | enum wxSplitMode | |
40 | { | |
41 | wxSPLIT_HORIZONTAL = 1, | |
42 | wxSPLIT_VERTICAL | |
43 | }; | |
44 | ||
45 | enum | |
46 | { | |
47 | wxSPLIT_DRAG_NONE, | |
48 | wxSPLIT_DRAG_DRAGGING, | |
49 | wxSPLIT_DRAG_LEFT_DOWN | |
50 | }; | |
51 | ||
52 | //--------------------------------------------------------------------------- | |
53 | ||
54 | ||
55 | // wxSplitterWindow maintains one or two panes, with an optional vertical or | |
56 | // horizontal split which can be used with the mouse or programmatically. | |
57 | class wxSplitterWindow: public wxWindow | |
58 | { | |
59 | public: | |
60 | %addtofunc wxSplitterWindow "self._setOORInfo(self)" | |
61 | %addtofunc wxSplitterWindow() "" | |
62 | ||
63 | wxSplitterWindow(wxWindow* parent, wxWindowID id, | |
64 | const wxPoint& point = wxDefaultPosition, | |
65 | const wxSize& size = wxDefaultSize, | |
66 | long style=wxSP_3D, | |
67 | const wxString& name = wxPySplitterNameStr); | |
68 | %name(PreSplitterWindow)wxSplitterWindow(); | |
69 | ||
70 | bool Create(wxWindow* parent, wxWindowID id, | |
71 | const wxPoint& point = wxDefaultPosition, | |
72 | const wxSize& size = wxDefaultSize, | |
73 | long style=wxSP_3D, | |
74 | const wxString& name = wxPySplitterNameStr); | |
75 | ||
76 | // Gets the only or left/top pane | |
77 | wxWindow *GetWindow1() const; | |
78 | ||
79 | // Gets the right/bottom pane | |
80 | wxWindow *GetWindow2() const; | |
81 | ||
82 | // Sets the split mode | |
83 | void SetSplitMode(int mode); | |
84 | ||
85 | // Gets the split mode | |
86 | wxSplitMode GetSplitMode() const; | |
87 | ||
88 | // Initialize with one window | |
89 | void Initialize(wxWindow *window); | |
90 | ||
91 | // Associates the given window with window 2, drawing the appropriate sash | |
92 | // and changing the split mode. | |
dd9f7fea | 93 | // Does nothing and returns False if the window is already split. |
d14a1e28 RD |
94 | // A sashPosition of 0 means choose a default sash position, |
95 | // negative sashPosition specifies the size of right/lower pane as it's | |
96 | // absolute value rather than the size of left/upper pane. | |
97 | virtual bool SplitVertically(wxWindow *window1, | |
98 | wxWindow *window2, | |
99 | int sashPosition = 0); | |
100 | ||
101 | virtual bool SplitHorizontally(wxWindow *window1, | |
102 | wxWindow *window2, | |
103 | int sashPosition = 0); | |
104 | ||
105 | // Removes the specified (or second) window from the view | |
106 | // Doesn't actually delete the window. | |
107 | bool Unsplit(wxWindow *toRemove = NULL); | |
108 | ||
109 | // Replaces one of the windows with another one (neither old nor new | |
110 | // parameter should be NULL) | |
111 | bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew); | |
112 | ||
113 | // Is the window split? | |
114 | bool IsSplit() const; | |
115 | ||
116 | // Sets the sash size | |
117 | void SetSashSize(int width); | |
118 | ||
119 | // Sets the border size | |
120 | void SetBorderSize(int width); | |
121 | ||
122 | // Gets the sash size | |
123 | int GetSashSize() const; | |
124 | ||
125 | // Gets the border size | |
126 | int GetBorderSize() const; | |
127 | ||
128 | // Set the sash position | |
dd9f7fea | 129 | void SetSashPosition(int position, bool redraw = True); |
d14a1e28 RD |
130 | |
131 | // Gets the sash position | |
132 | int GetSashPosition() const; | |
133 | ||
134 | // If this is zero, we can remove panes by dragging the sash. | |
135 | void SetMinimumPaneSize(int min); | |
136 | int GetMinimumPaneSize() const; | |
137 | ||
138 | ||
139 | // Tests for x, y over sash | |
140 | virtual bool SashHitTest(int x, int y, int tolerance = 5); | |
141 | ||
142 | // Resizes subwindows | |
143 | virtual void SizeWindows(); | |
144 | ||
145 | void SetNeedUpdating(bool needUpdating); | |
146 | bool GetNeedUpdating() const; | |
147 | }; | |
148 | ||
149 | ||
150 | ||
151 | ||
152 | // we reuse the same class for all splitter event types because this is the | |
153 | // usual wxWin convention, but the three event types have different kind of | |
154 | // data associated with them, so the accessors can be only used if the real | |
155 | // event type matches with the one for which the accessors make sense | |
156 | class wxSplitterEvent : public wxNotifyEvent | |
157 | { | |
158 | public: | |
159 | wxSplitterEvent(wxEventType type = wxEVT_NULL, | |
160 | wxSplitterWindow *splitter = (wxSplitterWindow *)NULL); | |
161 | ||
162 | ||
163 | // SASH_POS_CHANGED methods | |
164 | ||
165 | // setting the sash position to -1 prevents the change from taking place at | |
166 | // all | |
167 | void SetSashPosition(int pos); | |
168 | int GetSashPosition() const; | |
169 | ||
170 | // UNSPLIT event methods | |
171 | wxWindow *GetWindowBeingRemoved() const; | |
172 | ||
173 | // DCLICK event methods | |
174 | int GetX() const; | |
175 | int GetY() const; | |
176 | }; | |
177 | ||
178 | ||
179 | ||
180 | %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED; | |
181 | %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING; | |
182 | %constant wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED; | |
183 | %constant wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT; | |
184 | ||
185 | ||
186 | %pythoncode { | |
187 | EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 1 ) | |
188 | EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 1 ) | |
189 | EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 1 ) | |
190 | EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_UNSPLIT, 1 ) | |
191 | } | |
192 | ||
193 | //--------------------------------------------------------------------------- | |
194 |