1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Wrappers for the "gizmo" classes in wx/contrib
7 // Created: 23-Nov-2001
9 // Copyright: (c) 2001 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include "wx/gizmos/dynamicsash.h"
19 #include "wx/gizmos/editlbox.h"
22 //---------------------------------------------------------------------------
25 %include my_typemaps.i
34 //----------------------------------------------------------------------
37 wxEVT_DYNAMIC_SASH_SPLIT,
38 wxEVT_DYNAMIC_SASH_UNIFY,
40 wxDS_MANAGE_SCROLLBARS,
46 wxDynamicSashSplitEvents are sent to your view by wxDynamicSashWindow
47 whenever your view is being split by the user. It is your
48 responsibility to handle this event by creating a new view window as
49 a child of the wxDynamicSashWindow. wxDynamicSashWindow will
50 automatically reparent it to the proper place in its window hierarchy.
52 class wxDynamicSashSplitEvent : public wxCommandEvent {
54 wxDynamicSashSplitEvent(wxObject *target);
59 wxDynamicSashUnifyEvents are sent to your view by wxDynamicSashWindow
60 whenever the sash which splits your view and its sibling is being
61 reunified such that your view is expanding to replace its sibling.
62 You needn't do anything with this event if you are allowing
63 wxDynamicSashWindow to manage your view's scrollbars, but it is useful
64 if you are managing the scrollbars yourself so that you can keep
65 the scrollbars' event handlers connected to your view's event handler
68 class wxDynamicSashUnifyEvent : public wxCommandEvent {
70 wxDynamicSashUnifyEvent(wxObject *target);
79 wxDynamicSashWindow widgets manages the way other widgets are viewed.
80 When a wxDynamicSashWindow is first shown, it will contain one child
81 view, a viewport for that child, and a pair of scrollbars to allow the
82 user to navigate the child view area. Next to each scrollbar is a small
83 tab. By clicking on either tab and dragging to the appropriate spot, a
84 user can split the view area into two smaller views separated by a
85 draggable sash. Later, when the user wishes to reunify the two subviews,
86 the user simply drags the sash to the side of the window.
87 wxDynamicSashWindow will automatically reparent the appropriate child
88 view back up the window hierarchy, and the wxDynamicSashWindow will have
89 only one child view once again.
91 As an application developer, you will simply create a wxDynamicSashWindow
92 using either the Create() function or the more complex constructor
93 provided below, and then create a viewfrom wxPython.wx import * window whose parent is the
94 wxDynamicSashWindow. The child should respond to
95 wxDynamicSashSplitEvents -- perhaps with an OnSplit() event handler -- by
96 constructing a new view window whose parent is also the
97 wxDynamicSashWindow. That's it! Now your users can dynamically split
98 and reunify the view you provided.
100 If you wish to handle the scrollbar events for your view, rather than
101 allowing wxDynamicSashWindow to do it for you, things are a bit more
102 complex. (You might want to handle scrollbar events yourself, if,
103 for instance, you wish to scroll a subwindow of the view you add to
104 your wxDynamicSashWindow object, rather than scrolling the whole view.)
105 In this case, you will need to construfrom wxPython.wx import *ct your wxDynamicSashWindow without
106 the wxDS_MANAGE_SCROLLBARS style and you will need to use the
107 GetHScrollBar() and GetVScrollBar() methods to retrieve the scrollbar
108 controls and call SetEventHanler() on them to redirect the scrolling
109 events whenever your window is reparented by wxDyanmicSashWindow.
110 You will need to set the scrollbars' event handler at three times:
112 * When your view is created
113 * When your view receives a wxDynamicSashSplitEvent
114 * When your view receives a wxDynamicSashUnifyEvent
116 See the dynsash_switch sample application for an example which does this.
120 class wxDynamicSashWindow : public wxWindow {
122 wxDynamicSashWindow(wxWindow *parent, wxWindowID id,
123 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
124 long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
125 const char* name = "dynamicSashWindow");
126 %name(wxPreDynamicSashWindow)wxDynamicSashWindow();
128 bool Create(wxWindow *parent, wxWindowID id,
129 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
130 long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER,
131 const char* name = "dynamicSashWindow");
133 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
134 %pragma(python) addtomethod = "wxPreDynamicSashWindow:val._setOORInfo(val)"
136 wxScrollBar *GetHScrollBar(const wxWindow *child) const;
137 wxScrollBar *GetVScrollBar(const wxWindow *child) const;
142 //----------------------------------------------------------------------
143 // Python functions to act like the event macros
145 %pragma(python) code = "
146 def EVT_DYNAMIC_SASH_SPLIT(win, id, func):
147 win.Connect(id, -1, wxEVT_DYNAMIC_SASH_SPLIT, func)
149 def EVT_DYNAMIC_SASH_UNIFY(win, id, func):
150 win.Connect(id, -1, wxEVT_DYNAMIC_SASH_UNIFY, func)
153 //----------------------------------------------------------------------
154 //----------------------------------------------------------------------
157 // This class provides a composite control that lets the
158 // user easily enter list of strings
159 class wxEditableListBox : public wxPanel
162 wxEditableListBox(wxWindow *parent, wxWindowID id,
163 const wxString& label,
164 const wxPoint& pos = wxDefaultPosition,
165 const wxSize& size = wxDefaultSize,
166 const char* name = "editableListBox");
168 void SetStrings(const wxArrayString& strings);
170 //void GetStrings(wxArrayString& strings);
172 PyObject* GetStrings() {
173 wxArrayString strings;
174 self->GetStrings(strings);
175 return wxArrayString2PyList_helper(strings);
182 //----------------------------------------------------------------------
186 wxClassInfo::CleanUpClasses();
187 wxClassInfo::InitializeClasses();
192 %pragma(python) include="_gizmoextras.py";
194 //----------------------------------------------------------------------
195 //----------------------------------------------------------------------