]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _sashwin.i | |
3 | // Purpose: SWIG interface defs for wxSashWindow and wxSashLayoutWindow | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 22-Dec-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* wxSashNameStr = wxT("sashWindow"); | |
20 | DECLARE_DEF_STRING(SashNameStr); | |
21 | static const wxChar* wxSashLayoutNameStr = wxT("layoutWindow"); | |
22 | DECLARE_DEF_STRING(SashLayoutNameStr); | |
23 | %} | |
24 | ||
25 | //--------------------------------------------------------------------------- | |
26 | %newgroup; | |
27 | ||
28 | ||
29 | enum { | |
30 | wxSASH_DRAG_NONE, | |
31 | wxSASH_DRAG_DRAGGING, | |
32 | wxSASH_DRAG_LEFT_DOWN, | |
33 | ||
34 | wxSW_NOBORDER, | |
35 | wxSW_BORDER, | |
36 | wxSW_3DSASH, | |
37 | wxSW_3DBORDER, | |
38 | wxSW_3D, | |
39 | }; | |
40 | ||
41 | ||
42 | enum wxSashEdgePosition { | |
43 | wxSASH_TOP = 0, | |
44 | wxSASH_RIGHT, | |
45 | wxSASH_BOTTOM, | |
46 | wxSASH_LEFT, | |
47 | wxSASH_NONE = 100 | |
48 | }; | |
49 | ||
50 | ||
51 | ||
52 | // wxSashWindow allows any of its edges to have a sash which can be dragged | |
53 | // to resize the window. The actual content window will be created as a child | |
54 | // of wxSashWindow. | |
55 | class wxSashWindow: public wxWindow | |
56 | { | |
57 | public: | |
58 | %addtofunc wxSashWindow "self._setOORInfo(self)" | |
59 | %addtofunc wxSashWindow() "" | |
60 | ||
61 | wxSashWindow(wxWindow* parent, wxWindowID id, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | long style = wxCLIP_CHILDREN | wxSW_3D, | |
65 | const wxString& name = wxPySashNameStr); | |
66 | %name(PreSashWindow)wxSashWindow(); | |
67 | ||
68 | bool Create(wxWindow* parent, wxWindowID id, | |
69 | const wxPoint& pos = wxDefaultPosition, | |
70 | const wxSize& size = wxDefaultSize, | |
71 | long style = wxCLIP_CHILDREN | wxSW_3D, | |
72 | const wxString& name = wxPySashNameStr); | |
73 | ||
74 | ||
75 | // Set whether there's a sash in this position | |
76 | void SetSashVisible(wxSashEdgePosition edge, bool sash); | |
77 | ||
78 | // Get whether there's a sash in this position | |
79 | bool GetSashVisible(wxSashEdgePosition edge) const; | |
80 | ||
81 | // Set whether there's a border in this position | |
82 | void SetSashBorder(wxSashEdgePosition edge, bool border); | |
83 | ||
84 | // Get whether there's a border in this position | |
85 | bool HasBorder(wxSashEdgePosition edge) const; | |
86 | ||
87 | // Get border size | |
88 | int GetEdgeMargin(wxSashEdgePosition edge) const; | |
89 | ||
90 | // Sets the default sash border size | |
91 | void SetDefaultBorderSize(int width); | |
92 | ||
93 | // Gets the default sash border size | |
94 | int GetDefaultBorderSize() const; | |
95 | ||
96 | // Sets the addition border size between child and sash window | |
97 | void SetExtraBorderSize(int width); | |
98 | ||
99 | // Gets the addition border size between child and sash window | |
100 | int GetExtraBorderSize() const; | |
101 | ||
102 | virtual void SetMinimumSizeX(int min); | |
103 | virtual void SetMinimumSizeY(int min); | |
104 | virtual int GetMinimumSizeX() const; | |
105 | virtual int GetMinimumSizeY() const; | |
106 | ||
107 | virtual void SetMaximumSizeX(int max); | |
108 | virtual void SetMaximumSizeY(int max); | |
109 | virtual int GetMaximumSizeX() const; | |
110 | virtual int GetMaximumSizeY() const; | |
111 | ||
112 | // Tests for x, y over sash | |
113 | wxSashEdgePosition SashHitTest(int x, int y, int tolerance = 2); | |
114 | ||
115 | // Resizes subwindows | |
116 | void SizeWindows(); | |
117 | }; | |
118 | ||
119 | ||
120 | ||
121 | enum wxSashDragStatus | |
122 | { | |
123 | wxSASH_STATUS_OK, | |
124 | wxSASH_STATUS_OUT_OF_RANGE | |
125 | }; | |
126 | ||
127 | class wxSashEvent: public wxCommandEvent | |
128 | { | |
129 | public: | |
130 | wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE); | |
131 | ||
132 | void SetEdge(wxSashEdgePosition edge); | |
133 | wxSashEdgePosition GetEdge() const; | |
134 | ||
135 | //// The rectangle formed by the drag operation | |
136 | void SetDragRect(const wxRect& rect); | |
137 | wxRect GetDragRect() const; | |
138 | ||
139 | //// Whether the drag caused the rectangle to be reversed (e.g. | |
140 | //// dragging the top below the bottom) | |
141 | void SetDragStatus(wxSashDragStatus status); | |
142 | wxSashDragStatus GetDragStatus() const; | |
143 | }; | |
144 | ||
145 | ||
146 | ||
147 | %constant wxEventType wxEVT_SASH_DRAGGED; | |
148 | ||
149 | %pythoncode { | |
150 | EVT_SASH_DRAGGED = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 1 ) | |
151 | EVT_SASH_DRAGGED_RANGE = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 2 ) | |
152 | }; | |
153 | ||
154 | ||
155 | ||
156 | ||
157 | //--------------------------------------------------------------------------- | |
158 | %newgroup; | |
159 | ||
160 | ||
161 | ||
162 | enum wxLayoutOrientation | |
163 | { | |
164 | wxLAYOUT_HORIZONTAL, | |
165 | wxLAYOUT_VERTICAL | |
166 | }; | |
167 | ||
168 | enum wxLayoutAlignment | |
169 | { | |
170 | wxLAYOUT_NONE, | |
171 | wxLAYOUT_TOP, | |
172 | wxLAYOUT_LEFT, | |
173 | wxLAYOUT_RIGHT, | |
174 | wxLAYOUT_BOTTOM | |
175 | }; | |
176 | ||
177 | enum { | |
178 | wxLAYOUT_LENGTH_Y, | |
179 | wxLAYOUT_LENGTH_X, | |
180 | wxLAYOUT_MRU_LENGTH, | |
181 | wxLAYOUT_QUERY, | |
182 | }; | |
183 | ||
184 | ||
185 | %constant wxEventType wxEVT_QUERY_LAYOUT_INFO; | |
186 | %constant wxEventType wxEVT_CALCULATE_LAYOUT; | |
187 | ||
188 | ||
189 | // This event is used to get information about window alignment, | |
190 | // orientation and size. | |
191 | class wxQueryLayoutInfoEvent: public wxEvent | |
192 | { | |
193 | public: | |
194 | wxQueryLayoutInfoEvent(wxWindowID id = 0); | |
195 | ||
196 | // Read by the app | |
197 | void SetRequestedLength(int length); | |
198 | int GetRequestedLength() const; | |
199 | ||
200 | void SetFlags(int flags); | |
201 | int GetFlags() const; | |
202 | ||
203 | // Set by the app | |
204 | void SetSize(const wxSize& size); | |
205 | wxSize GetSize() const; | |
206 | ||
207 | void SetOrientation(wxLayoutOrientation orient); | |
208 | wxLayoutOrientation GetOrientation() const; | |
209 | ||
210 | void SetAlignment(wxLayoutAlignment align); | |
211 | wxLayoutAlignment GetAlignment() const; | |
212 | }; | |
213 | ||
214 | ||
215 | // This event is used to take a bite out of the available client area. | |
216 | class wxCalculateLayoutEvent: public wxEvent | |
217 | { | |
218 | public: | |
219 | wxCalculateLayoutEvent(wxWindowID id = 0); | |
220 | ||
221 | // Read by the app | |
222 | void SetFlags(int flags); | |
223 | int GetFlags() const; | |
224 | ||
225 | // Set by the app | |
226 | void SetRect(const wxRect& rect); | |
227 | wxRect GetRect() const; | |
228 | }; | |
229 | ||
230 | ||
231 | %pythoncode { | |
232 | EVT_QUERY_LAYOUT_INFO = wx.PyEventBinder( wxEVT_QUERY_LAYOUT_INFO ) | |
233 | EVT_CALCULATE_LAYOUT = wx.PyEventBinder( wxEVT_CALCULATE_LAYOUT ) | |
234 | }; | |
235 | ||
236 | ||
237 | ||
238 | // This is window that can remember alignment/orientation, does its own layout, | |
239 | // and can provide sashes too. Useful for implementing docked windows with sashes in | |
240 | // an IDE-style interface. | |
241 | class wxSashLayoutWindow: public wxSashWindow | |
242 | { | |
243 | public: | |
244 | %addtofunc wxSashLayoutWindow "self._setOORInfo(self)" | |
245 | %addtofunc wxSashLayoutWindow() "" | |
246 | ||
247 | wxSashLayoutWindow(wxWindow* parent, wxWindowID id, | |
248 | const wxPoint& pos = wxDefaultPosition, | |
249 | const wxSize& size = wxDefaultSize, | |
250 | long style = wxCLIP_CHILDREN | wxSW_3D, | |
251 | const wxString& name = wxPySashLayoutNameStr); | |
252 | %name(PreSashLayoutWindow)wxSashLayoutWindow(); | |
253 | ||
254 | bool Create(wxWindow* parent, wxWindowID id, | |
255 | const wxPoint& pos = wxDefaultPosition, | |
256 | const wxSize& size = wxDefaultSize, | |
257 | long style = wxCLIP_CHILDREN | wxSW_3D, | |
258 | const wxString& name = wxPySashLayoutNameStr); | |
259 | ||
260 | wxLayoutAlignment GetAlignment(); | |
261 | wxLayoutOrientation GetOrientation(); | |
262 | void SetAlignment(wxLayoutAlignment alignment); | |
263 | void SetDefaultSize(const wxSize& size); | |
264 | void SetOrientation(wxLayoutOrientation orientation); | |
265 | }; | |
266 | ||
267 | ||
268 | ||
269 | class wxLayoutAlgorithm : public wxObject { | |
270 | public: | |
271 | wxLayoutAlgorithm(); | |
272 | ~wxLayoutAlgorithm(); | |
273 | ||
274 | bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL); | |
275 | bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL); | |
276 | bool LayoutWindow(wxWindow* parent, wxWindow* mainWindow = NULL); | |
277 | }; | |
278 | ||
279 | ||
280 | //--------------------------------------------------------------------------- |