]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/gizmos/gizmos.i
Regenerated file lists so features.h would be installed
[wxWidgets.git] / wxPython / contrib / gizmos / gizmos.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gizmos.i
3 // Purpose: Wrappers for the "gizmo" classes in wx/contrib
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 23-Nov-2001
8 // RCS-ID: $Id$
9 // Copyright: (c) 2001 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 %module gizmos
14
15
16 %{
17 #include "export.h"
18 #include <wx/gizmos/dynamicsash.h>
19 #include <wx/gizmos/editlbox.h>
20 #include <wx/gizmos/splittree.h>
21 #include <wx/gizmos/ledctrl.h>
22 %}
23
24 //---------------------------------------------------------------------------
25
26 %include typemaps.i
27 %include my_typemaps.i
28
29 %extern wx.i
30 %extern windows.i
31 %extern _defs.i
32 %extern events.i
33 %extern controls.i
34
35
36 //----------------------------------------------------------------------
37
38 enum {
39 wxEVT_DYNAMIC_SASH_SPLIT,
40 wxEVT_DYNAMIC_SASH_UNIFY,
41
42 wxDS_MANAGE_SCROLLBARS,
43 wxDS_DRAG_CORNER,
44 };
45
46
47 /*
48 wxDynamicSashSplitEvents are sent to your view by wxDynamicSashWindow
49 whenever your view is being split by the user. It is your
50 responsibility to handle this event by creating a new view window as
51 a child of the wxDynamicSashWindow. wxDynamicSashWindow will
52 automatically reparent it to the proper place in its window hierarchy.
53 */
54 class wxDynamicSashSplitEvent : public wxCommandEvent {
55 public:
56 wxDynamicSashSplitEvent(wxObject *target);
57 };
58
59
60 /*
61 wxDynamicSashUnifyEvents are sent to your view by wxDynamicSashWindow
62 whenever the sash which splits your view and its sibling is being
63 reunified such that your view is expanding to replace its sibling.
64 You needn't do anything with this event if you are allowing
65 wxDynamicSashWindow to manage your view's scrollbars, but it is useful
66 if you are managing the scrollbars yourself so that you can keep
67 the scrollbars' event handlers connected to your view's event handler
68 class.
69 */
70 class wxDynamicSashUnifyEvent : public wxCommandEvent {
71 public:
72 wxDynamicSashUnifyEvent(wxObject *target);
73 };
74
75
76
77 /*
78
79 wxDynamicSashWindow
80
81 wxDynamicSashWindow widgets manages the way other widgets are viewed.
82 When a wxDynamicSashWindow is first shown, it will contain one child
83 view, a viewport for that child, and a pair of scrollbars to allow the
84 user to navigate the child view area. Next to each scrollbar is a small
85 tab. By clicking on either tab and dragging to the appropriate spot, a
86 user can split the view area into two smaller views separated by a
87 draggable sash. Later, when the user wishes to reunify the two subviews,
88 the user simply drags the sash to the side of the window.
89 wxDynamicSashWindow will automatically reparent the appropriate child
90 view back up the window hierarchy, and the wxDynamicSashWindow will have
91 only one child view once again.
92
93 As an application developer, you will simply create a wxDynamicSashWindow
94 using either the Create() function or the more complex constructor
95 provided below, and then create a view window whose parent is the
96 wxDynamicSashWindow. The child should respond to
97 wxDynamicSashSplitEvents -- perhaps with an OnSplit() event handler -- by
98 constructing a new view window whose parent is also the
99 wxDynamicSashWindow. That's it! Now your users can dynamically split
100 and reunify the view you provided.
101
102 If you wish to handle the scrollbar events for your view, rather than
103 allowing wxDynamicSashWindow to do it for you, things are a bit more
104 complex. (You might want to handle scrollbar events yourself, if,
105 for instance, you wish to scroll a subwindow of the view you add to
106 your wxDynamicSashWindow object, rather than scrolling the whole view.)
107 In this case, you will need to construct your wxDynamicSashWindow without
108 the wxDS_MANAGE_SCROLLBARS style and you will need to use the
109 GetHScrollBar() and GetVScrollBar() methods to retrieve the scrollbar
110 controls and call SetEventHanler() on them to redirect the scrolling
111 events whenever your window is reparented by wxDyanmicSashWindow.
112 You will need to set the scrollbars' event handler at three times:
113
114 * When your view is created
115 * When your view receives a wxDynamicSashSplitEvent
116 * When your view receives a wxDynamicSashUnifyEvent
117
118 See the dynsash_switch sample application for an example which does this.
119
120 */
121
122 class wxDynamicSashWindow : public wxWindow {
123 public:
124 wxDynamicSashWindow(wxWindow *parent, wxWindowID id,
125 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
126 long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
127 const char* name = "dynamicSashWindow");
128 %name(wxPreDynamicSashWindow)wxDynamicSashWindow();
129
130 bool Create(wxWindow *parent, wxWindowID id,
131 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
132 long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
133 const char* name = "dynamicSashWindow");
134
135 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
136 %pragma(python) addtomethod = "wxPreDynamicSashWindow:val._setOORInfo(val)"
137
138 wxScrollBar *GetHScrollBar(const wxWindow *child) const;
139 wxScrollBar *GetVScrollBar(const wxWindow *child) const;
140 };
141
142
143
144 //----------------------------------------------------------------------
145 // Python functions to act like the event macros
146
147 %pragma(python) code = "
148 def EVT_DYNAMIC_SASH_SPLIT(win, id, func):
149 win.Connect(id, -1, wxEVT_DYNAMIC_SASH_SPLIT, func)
150
151 def EVT_DYNAMIC_SASH_UNIFY(win, id, func):
152 win.Connect(id, -1, wxEVT_DYNAMIC_SASH_UNIFY, func)
153 "
154
155 //----------------------------------------------------------------------
156 //----------------------------------------------------------------------
157
158 enum {
159 wxEL_ALLOW_NEW,
160 wxEL_ALLOW_EDIT,
161 wxEL_ALLOW_DELETE,
162 };
163
164 // This class provides a composite control that lets the
165 // user easily enter list of strings
166 class wxEditableListBox : public wxPanel
167 {
168 public:
169 wxEditableListBox(wxWindow *parent, wxWindowID id,
170 const wxString& label,
171 const wxPoint& pos = wxDefaultPosition,
172 const wxSize& size = wxDefaultSize,
173 long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
174 const char* name = "editableListBox");
175
176 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
177
178 void SetStrings(const wxArrayString& strings);
179
180 //void GetStrings(wxArrayString& strings);
181 %addmethods {
182 PyObject* GetStrings() {
183 wxArrayString strings;
184 self->GetStrings(strings);
185 return wxArrayString2PyList_helper(strings);
186 }
187 }
188 };
189
190
191
192 //----------------------------------------------------------------------
193
194
195 /*
196 * wxRemotelyScrolledTreeCtrl
197 *
198 * This tree control disables its vertical scrollbar and catches scroll
199 * events passed by a scrolled window higher in the hierarchy.
200 * It also updates the scrolled window vertical scrollbar as appropriate.
201 */
202
203 %{
204 typedef wxTreeCtrl wxPyTreeCtrl;
205 %}
206
207 class wxRemotelyScrolledTreeCtrl: public wxPyTreeCtrl
208 {
209 public:
210 wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id,
211 const wxPoint& pos = wxDefaultPosition,
212 const wxSize& size = wxDefaultSize,
213 long style = wxTR_HAS_BUTTONS);
214 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
215
216
217 void HideVScrollbar();
218
219 // Adjust the containing wxScrolledWindow's scrollbars appropriately
220 void AdjustRemoteScrollbars();
221
222 // Find the scrolled window that contains this control
223 wxScrolledWindow* GetScrolledWindow() const;
224
225 // Scroll to the given line (in scroll units where each unit is
226 // the height of an item)
227 void ScrollToLine(int posHoriz, int posVert);
228
229 // The companion window is one which will get notified when certain
230 // events happen such as node expansion
231 void SetCompanionWindow(wxWindow* companion);
232 wxWindow* GetCompanionWindow() const;
233 };
234
235
236
237 /*
238 * wxTreeCompanionWindow
239 *
240 * A window displaying values associated with tree control items.
241 */
242
243 %{
244 class wxPyTreeCompanionWindow: public wxTreeCompanionWindow
245 {
246 public:
247 wxPyTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1,
248 const wxPoint& pos = wxDefaultPosition,
249 const wxSize& size = wxDefaultSize,
250 long style = 0)
251 : wxTreeCompanionWindow(parent, id, pos, size, style) {}
252
253
254 virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) {
255 bool found;
256 wxPyBeginBlockThreads();
257 if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
258 PyObject* dcobj = wxPyMake_wxObject(&dc);
259 PyObject* idobj = wxPyConstructObject((void*)&id, "wxTreeItemId", FALSE);
260 PyObject* recobj= wxPyConstructObject((void*)&rect, "wxRect", FALSE);
261 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj));
262 Py_DECREF(dcobj);
263 Py_DECREF(idobj);
264 Py_DECREF(recobj);
265 }
266 wxPyEndBlockThreads();
267 if (! found)
268 wxTreeCompanionWindow::DrawItem(dc, id, rect);
269 }
270
271 PYPRIVATE;
272 };
273 %}
274
275
276 %name(wxTreeCompanionWindow) class wxPyTreeCompanionWindow: public wxWindow
277 {
278 public:
279 wxPyTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1,
280 const wxPoint& pos = wxDefaultPosition,
281 const wxSize& size = wxDefaultSize,
282 long style = 0);
283 void _setCallbackInfo(PyObject* self, PyObject* _class);
284 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxTreeCompanionWindow)"
285 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
286
287 wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const;
288 void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl);
289 };
290
291
292
293 /*
294 * wxThinSplitterWindow
295 *
296 * Implements a splitter with a less obvious sash
297 * than the usual one.
298 */
299
300 class wxThinSplitterWindow: public wxSplitterWindow
301 {
302 public:
303 wxThinSplitterWindow(wxWindow* parent, wxWindowID id = -1,
304 const wxPoint& pos = wxDefaultPosition,
305 const wxSize& size = wxDefaultSize,
306 long style = wxSP_3D | wxCLIP_CHILDREN);
307 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
308
309 };
310
311
312 /*
313 * wxSplitterScrolledWindow
314 *
315 * This scrolled window is aware of the fact that one of its
316 * children is a splitter window. It passes on its scroll events
317 * (after some processing) to both splitter children for them
318 * scroll appropriately.
319 */
320
321 class wxSplitterScrolledWindow: public wxScrolledWindow
322 {
323 public:
324 wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = -1,
325 const wxPoint& pos = wxDefaultPosition,
326 const wxSize& size = wxDefaultSize,
327 long style = 0);
328 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
329 };
330
331
332 //----------------------------------------------------------------------
333 //----------------------------------------------------------------------
334
335
336 enum wxLEDValueAlign
337 {
338 wxLED_ALIGN_LEFT,
339 wxLED_ALIGN_RIGHT,
340 wxLED_ALIGN_CENTER,
341
342 wxLED_ALIGN_MASK,
343
344 wxLED_DRAW_FADED,
345 };
346
347
348 class wxLEDNumberCtrl : public wxControl
349 {
350 public:
351 // Constructors.
352 wxLEDNumberCtrl(wxWindow *parent, wxWindowID id = -1,
353 const wxPoint& pos = wxDefaultPosition,
354 const wxSize& size = wxDefaultSize,
355 long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
356 %name(wxPreLEDNumberCtrl) wxLEDNumberCtrl();
357
358 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
359 %pragma(python) addtomethod = "wxPreLEDNumberCtrl:val._setOORInfo(val)"
360
361 // Create functions.
362 bool Create(wxWindow *parent, wxWindowID id = -1,
363 const wxPoint& pos = wxDefaultPosition,
364 const wxSize& size = wxDefaultSize,
365 long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
366
367 wxLEDValueAlign GetAlignment() const { return m_Alignment; }
368 bool GetDrawFaded() const { return m_DrawFaded; }
369 const wxString &GetValue() const { return m_Value; }
370
371 void SetAlignment(wxLEDValueAlign Alignment, bool Redraw = true);
372 void SetDrawFaded(bool DrawFaded, bool Redraw = true);
373 void SetValue(const wxString &Value, bool Redraw = true);
374
375 };
376
377 //----------------------------------------------------------------------
378 //----------------------------------------------------------------------
379
380 %init %{
381
382 wxClassInfo::CleanUpClasses();
383 wxClassInfo::InitializeClasses();
384
385 wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow");
386 %}
387
388
389 %pragma(python) include="_gizmoextras.py";
390
391 //----------------------------------------------------------------------
392 //----------------------------------------------------------------------
393
394
395
396
397
398