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