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