]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/windows3.i
Use the OOR typemap for wxTreeCtrls too.
[wxWidgets.git] / wxPython / src / windows3.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: windows3.i
3 // Purpose: SWIG definitions of MORE window classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 22-Dec-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 %module windows3
14
15 %{
16 #include "helpers.h"
17 #include <wx/sashwin.h>
18 #include <wx/laywin.h>
19 #ifndef __WXMAC__
20 #include <wx/popupwin.h>
21 #include <wx/tipwin.h>
22 #endif
23 %}
24
25 //----------------------------------------------------------------------
26
27 %include typemaps.i
28 %include my_typemaps.i
29
30 // Import some definitions of other classes, etc.
31 %import _defs.i
32 %import misc.i
33 %import gdi.i
34 %import windows.i
35 %import windows2.i
36 %import mdi.i
37 %import events.i
38
39 %pragma(python) code = "import wx"
40
41 //----------------------------------------------------------------------
42
43 %{
44 // Put some wx default wxChar* values into wxStrings.
45 static const wxChar* wxSashNameStr = wxT("sashWindow");
46 DECLARE_DEF_STRING(SashNameStr);
47 static const wxChar* wxSashLayoutNameStr = wxT("layoutWindow");
48 DECLARE_DEF_STRING(SashLayoutNameStr);
49 %}
50 //---------------------------------------------------------------------------
51
52 enum wxSashEdgePosition {
53 wxSASH_TOP = 0,
54 wxSASH_RIGHT,
55 wxSASH_BOTTOM,
56 wxSASH_LEFT,
57 wxSASH_NONE = 100
58 };
59
60 enum {
61 wxEVT_SASH_DRAGGED,
62 wxSW_3D,
63 wxSW_3DSASH,
64 wxSW_3DBORDER,
65 wxSW_BORDER
66 };
67
68 enum wxSashDragStatus
69 {
70 wxSASH_STATUS_OK,
71 wxSASH_STATUS_OUT_OF_RANGE
72 };
73
74
75 class wxSashEvent : public wxCommandEvent {
76 public:
77 wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE);
78
79 void SetEdge(wxSashEdgePosition edge);
80 wxSashEdgePosition GetEdge();
81 void SetDragRect(const wxRect& rect);
82 wxRect GetDragRect();
83 void SetDragStatus(wxSashDragStatus status);
84 wxSashDragStatus GetDragStatus();
85 };
86
87
88
89 class wxSashWindow: public wxWindow {
90 public:
91 wxSashWindow(wxWindow* parent, wxWindowID id,
92 const wxPoint& pos = wxDefaultPosition,
93 const wxSize& size = wxDefaultSize,
94 long style = wxCLIP_CHILDREN | wxSW_3D,
95 const wxString& name = wxPySashNameStr);
96 %name(wxPreSashWindow)wxSashWindow();
97
98 bool Create(wxWindow* parent, wxWindowID id,
99 const wxPoint& pos = wxDefaultPosition,
100 const wxSize& size = wxDefaultSize,
101 long style = wxCLIP_CHILDREN | wxSW_3D,
102 const wxString& name = wxPySashNameStr);
103
104 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
105 %pragma(python) addtomethod = "wxPreSashWindow:val._setOORInfo(val)"
106
107 bool GetSashVisible(wxSashEdgePosition edge);
108 int GetDefaultBorderSize();
109 int GetEdgeMargin(wxSashEdgePosition edge);
110 int GetExtraBorderSize();
111 int GetMaximumSizeX();
112 int GetMaximumSizeY();
113 int GetMinimumSizeX();
114 int GetMinimumSizeY();
115 bool HasBorder(wxSashEdgePosition edge);
116 void SetDefaultBorderSize(int width);
117 void SetExtraBorderSize(int width);
118 void SetMaximumSizeX(int min);
119 void SetMaximumSizeY(int min);
120 void SetMinimumSizeX(int min);
121 void SetMinimumSizeY(int min);
122 void SetSashVisible(wxSashEdgePosition edge, bool visible);
123 void SetSashBorder(wxSashEdgePosition edge, bool hasBorder);
124
125 };
126
127
128 //---------------------------------------------------------------------------
129
130 enum wxLayoutOrientation {
131 wxLAYOUT_HORIZONTAL,
132 wxLAYOUT_VERTICAL
133 };
134
135 enum wxLayoutAlignment {
136 wxLAYOUT_NONE,
137 wxLAYOUT_TOP,
138 wxLAYOUT_LEFT,
139 wxLAYOUT_RIGHT,
140 wxLAYOUT_BOTTOM,
141 };
142
143
144 enum {
145 wxEVT_QUERY_LAYOUT_INFO,
146 wxEVT_CALCULATE_LAYOUT,
147 };
148
149
150 class wxQueryLayoutInfoEvent: public wxEvent {
151 public:
152 wxQueryLayoutInfoEvent(wxWindowID id = 0);
153
154 void SetRequestedLength(int length);
155 int GetRequestedLength();
156 void SetFlags(int flags);
157 int GetFlags();
158 void SetSize(const wxSize& size);
159 wxSize GetSize();
160 void SetOrientation(wxLayoutOrientation orient);
161 wxLayoutOrientation GetOrientation();
162 void SetAlignment(wxLayoutAlignment align);
163 wxLayoutAlignment GetAlignment();
164 };
165
166
167
168 class wxCalculateLayoutEvent: public wxEvent {
169 public:
170 wxCalculateLayoutEvent(wxWindowID id = 0);
171
172 void SetFlags(int flags);
173 int GetFlags();
174 void SetRect(const wxRect& rect);
175 wxRect GetRect();
176 };
177
178
179 class wxSashLayoutWindow: public wxSashWindow {
180 public:
181 wxSashLayoutWindow(wxWindow* parent, wxWindowID id,
182 const wxPoint& pos = wxDefaultPosition,
183 const wxSize& size = wxDefaultSize,
184 long style = wxCLIP_CHILDREN | wxSW_3D,
185 const wxString& name = wxPySashLayoutNameStr);
186 %name(wxPreSashLayoutWindow)wxSashLayoutWindow();
187
188 bool Create(wxWindow* parent, wxWindowID id,
189 const wxPoint& pos = wxDefaultPosition,
190 const wxSize& size = wxDefaultSize,
191 long style = wxCLIP_CHILDREN | wxSW_3D,
192 const wxString& name = wxPySashLayoutNameStr);
193
194 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
195 %pragma(python) addtomethod = "wxPreSashLayoutWindow:val._setOORInfo(val)"
196
197 wxLayoutAlignment GetAlignment();
198 wxLayoutOrientation GetOrientation();
199 void SetAlignment(wxLayoutAlignment alignment);
200 void SetDefaultSize(const wxSize& size);
201 void SetOrientation(wxLayoutOrientation orientation);
202 };
203
204 //---------------------------------------------------------------------------
205
206 class wxLayoutAlgorithm : public wxObject {
207 public:
208 wxLayoutAlgorithm();
209 ~wxLayoutAlgorithm();
210
211 bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL);
212 bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL);
213 bool LayoutWindow(wxWindow* parent, wxWindow* mainWindow = NULL);
214 };
215
216
217 //---------------------------------------------------------------------------
218 #ifndef __WXMAC__
219
220 // wxPopupWindow: a special kind of top level window used for popup menus,
221 // combobox popups and such.
222 class wxPopupWindow : public wxWindow {
223 public:
224 wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
225 %name(wxPrePopupWindow)wxPopupWindow();
226
227 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
228 %pragma(python) addtomethod = "wxPrePopupWindow:val._setOORInfo(val)"
229
230 bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
231
232 // the point must be given in screen coordinates!
233 void Position(const wxPoint& ptOrigin,
234 const wxSize& size);
235 };
236
237
238 %{
239 class wxPyPopupTransientWindow : public wxPopupTransientWindow
240 {
241 public:
242 wxPyPopupTransientWindow() : wxPopupTransientWindow() {}
243 wxPyPopupTransientWindow(wxWindow* parent, int style = wxBORDER_NONE)
244 : wxPopupTransientWindow(parent, style) {}
245
246 DEC_PYCALLBACK_BOOL_ME(ProcessLeftDown);
247 DEC_PYCALLBACK__(OnDismiss);
248 DEC_PYCALLBACK_BOOL_(CanDismiss);
249 PYPRIVATE;
250 };
251
252 IMP_PYCALLBACK_BOOL_ME(wxPyPopupTransientWindow, wxPopupTransientWindow, ProcessLeftDown);
253 IMP_PYCALLBACK__(wxPyPopupTransientWindow, wxPopupTransientWindow, OnDismiss);
254 IMP_PYCALLBACK_BOOL_(wxPyPopupTransientWindow, wxPopupTransientWindow, CanDismiss);
255 %}
256
257
258
259 // wxPopupTransientWindow: a wxPopupWindow which disappears automatically
260 // when the user clicks mouse outside it or if it loses focus in any other way
261 %name(wxPopupTransientWindow) class wxPyPopupTransientWindow : public wxPopupWindow
262 {
263 public:
264 wxPyPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE);
265 %name(wxPrePopupTransientWindow)wxPyPopupTransientWindow();
266
267 void _setCallbackInfo(PyObject* self, PyObject* _class);
268 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPopupTransientWindow)"
269
270 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
271 %pragma(python) addtomethod = "wxPrePopupTransientWindow:val._setOORInfo(val)"
272
273 // popup the window (this will show it too) and keep focus at winFocus
274 // (or itself if it's NULL), dismiss the popup if we lose focus
275 virtual void Popup(wxWindow *focus = NULL);
276
277 // hide the window
278 virtual void Dismiss();
279 };
280
281 //---------------------------------------------------------------------------
282
283 class wxTipWindow : public wxPyPopupTransientWindow
284 {
285 public:
286 %addmethods {
287 wxTipWindow(wxWindow *parent,
288 const wxString* text,
289 wxCoord maxLength = 100,
290 wxRect* rectBound = NULL) {
291 wxString tmp = *text;
292 return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound);
293 }
294 }
295
296 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
297
298 // If rectBound is not NULL, the window will disappear automatically when
299 // the mouse leave the specified rect: note that rectBound should be in the
300 // screen coordinates!
301 void SetBoundingRect(const wxRect& rectBound);
302
303 // Hide and destroy the window
304 void Close();
305 };
306
307
308 //---------------------------------------------------------------------------
309
310 #endif