]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_sashwin.i
fixed deadlock when calling wxPostEvent() from worker thread
[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 %property(DefaultBorderSize, GetDefaultBorderSize, SetDefaultBorderSize, doc="See `GetDefaultBorderSize` and `SetDefaultBorderSize`");
117 %property(ExtraBorderSize, GetExtraBorderSize, SetExtraBorderSize, doc="See `GetExtraBorderSize` and `SetExtraBorderSize`");
118 %property(MaximumSizeX, GetMaximumSizeX, SetMaximumSizeX, doc="See `GetMaximumSizeX` and `SetMaximumSizeX`");
119 %property(MaximumSizeY, GetMaximumSizeY, SetMaximumSizeY, doc="See `GetMaximumSizeY` and `SetMaximumSizeY`");
120 %property(MinimumSizeX, GetMinimumSizeX, SetMinimumSizeX, doc="See `GetMinimumSizeX` and `SetMinimumSizeX`");
121 %property(MinimumSizeY, GetMinimumSizeY, SetMinimumSizeY, doc="See `GetMinimumSizeY` and `SetMinimumSizeY`");
122 };
123
124
125
126 enum wxSashDragStatus
127 {
128 wxSASH_STATUS_OK,
129 wxSASH_STATUS_OUT_OF_RANGE
130 };
131
132 class wxSashEvent: public wxCommandEvent
133 {
134 public:
135 wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE);
136
137 void SetEdge(wxSashEdgePosition edge);
138 wxSashEdgePosition GetEdge() const;
139
140 //// The rectangle formed by the drag operation
141 void SetDragRect(const wxRect& rect);
142 wxRect GetDragRect() const;
143
144 //// Whether the drag caused the rectangle to be reversed (e.g.
145 //// dragging the top below the bottom)
146 void SetDragStatus(wxSashDragStatus status);
147 wxSashDragStatus GetDragStatus() const;
148
149 %property(DragRect, GetDragRect, SetDragRect, doc="See `GetDragRect` and `SetDragRect`");
150 %property(DragStatus, GetDragStatus, SetDragStatus, doc="See `GetDragStatus` and `SetDragStatus`");
151 %property(Edge, GetEdge, SetEdge, doc="See `GetEdge` and `SetEdge`");
152 };
153
154
155
156 %constant wxEventType wxEVT_SASH_DRAGGED;
157
158 %pythoncode {
159 EVT_SASH_DRAGGED = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 1 )
160 EVT_SASH_DRAGGED_RANGE = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 2 )
161 };
162
163
164
165
166 //---------------------------------------------------------------------------
167 %newgroup;
168
169
170
171 enum wxLayoutOrientation
172 {
173 wxLAYOUT_HORIZONTAL,
174 wxLAYOUT_VERTICAL
175 };
176
177 enum wxLayoutAlignment
178 {
179 wxLAYOUT_NONE,
180 wxLAYOUT_TOP,
181 wxLAYOUT_LEFT,
182 wxLAYOUT_RIGHT,
183 wxLAYOUT_BOTTOM
184 };
185
186 enum {
187 wxLAYOUT_LENGTH_Y,
188 wxLAYOUT_LENGTH_X,
189 wxLAYOUT_MRU_LENGTH,
190 wxLAYOUT_QUERY,
191 };
192
193
194 %constant wxEventType wxEVT_QUERY_LAYOUT_INFO;
195 %constant wxEventType wxEVT_CALCULATE_LAYOUT;
196
197
198 // This event is used to get information about window alignment,
199 // orientation and size.
200 class wxQueryLayoutInfoEvent: public wxEvent
201 {
202 public:
203 wxQueryLayoutInfoEvent(wxWindowID id = 0);
204
205 // Read by the app
206 void SetRequestedLength(int length);
207 int GetRequestedLength() const;
208
209 void SetFlags(int flags);
210 int GetFlags() const;
211
212 // Set by the app
213 void SetSize(const wxSize& size);
214 wxSize GetSize() const;
215
216 void SetOrientation(wxLayoutOrientation orient);
217 wxLayoutOrientation GetOrientation() const;
218
219 void SetAlignment(wxLayoutAlignment align);
220 wxLayoutAlignment GetAlignment() const;
221
222 %property(Alignment, GetAlignment, SetAlignment, doc="See `GetAlignment` and `SetAlignment`");
223 %property(Flags, GetFlags, SetFlags, doc="See `GetFlags` and `SetFlags`");
224 %property(Orientation, GetOrientation, SetOrientation, doc="See `GetOrientation` and `SetOrientation`");
225 %property(RequestedLength, GetRequestedLength, SetRequestedLength, doc="See `GetRequestedLength` and `SetRequestedLength`");
226 %property(Size, GetSize, SetSize, doc="See `GetSize` and `SetSize`");
227 };
228
229
230 // This event is used to take a bite out of the available client area.
231 class wxCalculateLayoutEvent: public wxEvent
232 {
233 public:
234 wxCalculateLayoutEvent(wxWindowID id = 0);
235
236 // Read by the app
237 void SetFlags(int flags);
238 int GetFlags() const;
239
240 // Set by the app
241 void SetRect(const wxRect& rect);
242 wxRect GetRect() const;
243
244 %property(Flags, GetFlags, SetFlags, doc="See `GetFlags` and `SetFlags`");
245 %property(Rect, GetRect, SetRect, doc="See `GetRect` and `SetRect`");
246 };
247
248
249 %pythoncode {
250 EVT_QUERY_LAYOUT_INFO = wx.PyEventBinder( wxEVT_QUERY_LAYOUT_INFO )
251 EVT_CALCULATE_LAYOUT = wx.PyEventBinder( wxEVT_CALCULATE_LAYOUT )
252 };
253
254
255
256 // This is window that can remember alignment/orientation, does its own layout,
257 // and can provide sashes too. Useful for implementing docked windows with sashes in
258 // an IDE-style interface.
259 MustHaveApp(wxSashLayoutWindow);
260
261 class wxSashLayoutWindow: public wxSashWindow
262 {
263 public:
264 %pythonAppend wxSashLayoutWindow "self._setOORInfo(self)"
265 %pythonAppend wxSashLayoutWindow() ""
266
267 wxSashLayoutWindow(wxWindow* parent, wxWindowID id=-1,
268 const wxPoint& pos = wxDefaultPosition,
269 const wxSize& size = wxDefaultSize,
270 long style = wxCLIP_CHILDREN | wxSW_3D,
271 const wxString& name = wxPySashLayoutNameStr);
272 %RenameCtor(PreSashLayoutWindow, wxSashLayoutWindow());
273
274 bool Create(wxWindow* parent, wxWindowID id=-1,
275 const wxPoint& pos = wxDefaultPosition,
276 const wxSize& size = wxDefaultSize,
277 long style = wxCLIP_CHILDREN | wxSW_3D,
278 const wxString& name = wxPySashLayoutNameStr);
279
280 wxLayoutAlignment GetAlignment();
281 wxLayoutOrientation GetOrientation();
282 void SetAlignment(wxLayoutAlignment alignment);
283 void SetDefaultSize(const wxSize& size);
284 void SetOrientation(wxLayoutOrientation orientation);
285
286 %property(Alignment, GetAlignment, SetAlignment, doc="See `GetAlignment` and `SetAlignment`");
287 %property(Orientation, GetOrientation, SetOrientation, doc="See `GetOrientation` and `SetOrientation`");
288 };
289
290
291
292 class wxLayoutAlgorithm : public wxObject {
293 public:
294 wxLayoutAlgorithm();
295 ~wxLayoutAlgorithm();
296
297 bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL);
298 bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL);
299 bool LayoutWindow(wxWindow* parent, wxWindow* mainWindow = NULL);
300 };
301
302
303 //---------------------------------------------------------------------------