1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for StatusBar and ToolBar classes
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include <wx/toolbar.h>
19 #include <wx/tbarsmpl.h>
22 //----------------------------------------------------------------------
25 %include my_typemaps.i
27 // Import some definitions of other classes, etc.
33 %pragma(python) code = "import wx"
36 //---------------------------------------------------------------------------
38 class wxStatusBar : public wxWindow {
40 wxStatusBar(wxWindow* parent, wxWindowID id = -1,
41 long style = wxST_SIZEGRIP,
42 char* name = "statusBar");
43 %name(wxPreStatusBar)wxStatusBar();
45 bool Create(wxWindow* parent, wxWindowID id,
46 long style = wxST_SIZEGRIP,
47 char* name = "statusBar");
49 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
50 %pragma(python) addtomethod = "wxPreStatusBar:val._setOORInfo(val)"
53 %new wxRect* GetFieldRect(long item) {
54 wxRect* rect= new wxRect;
55 self->GetFieldRect(item, *rect);
59 int GetFieldsCount(void);
60 wxString GetStatusText(int ir = 0);
64 void SetFieldsCount(int number = 1);
65 void SetStatusText(const wxString& text, int i = 0);
66 void SetStatusWidths(int LCOUNT, int* choices);
67 void SetMinHeight(int height);
71 //---------------------------------------------------------------------------
75 enum wxToolBarToolStyle
77 wxTOOL_STYLE_BUTTON = 1,
78 wxTOOL_STYLE_SEPARATOR = 2,
84 class wxToolBarToolBase : public wxObject {
86 // wxToolBarToolBase(wxToolBarBase *tbar = (wxToolBarBase *)NULL,
87 // int id = wxID_SEPARATOR,
88 // const wxBitmap& bitmap1 = wxNullBitmap,
89 // const wxBitmap& bitmap2 = wxNullBitmap,
90 // bool toggle = FALSE,
91 // wxObject *clientData = (wxObject *) NULL,
92 // const wxString& shortHelpString = wxEmptyString,
93 // const wxString& longHelpString = wxEmptyString);
94 // wxToolBarToolBase(wxToolBarBase *tbar, wxControl *control);
95 // ~wxToolBarToolBase();
97 %addmethods { void Destroy() { delete self; } }
100 wxControl *GetControl();
101 wxToolBarBase *GetToolBar();
109 wxBitmap GetBitmap1();
110 wxBitmap GetBitmap2();
111 wxBitmap GetBitmap();
112 wxString GetShortHelp();
113 wxString GetLongHelp();
114 bool Enable(bool enable);
115 bool Toggle(bool toggle);
116 bool SetToggle(bool toggle);
117 bool SetShortHelp(const wxString& help);
118 bool SetLongHelp(const wxString& help);
119 void SetBitmap1(const wxBitmap& bmp);
120 void SetBitmap2(const wxBitmap& bmp);
122 void Attach(wxToolBarBase *tbar);
124 //wxObject *GetClientData();
126 // convert the ClientData back to a PyObject
127 PyObject* GetClientData() {
128 wxPyUserData* udata = (wxPyUserData*)self->GetClientData();
130 Py_INCREF(udata->m_obj);
138 void SetClientData(PyObject* clientData) {
139 self->SetClientData(new wxPyUserData(clientData));
146 class wxToolBarBase : public wxControl {
149 // This is an Abstract Base Class
152 // wrap ClientData in a class that knows about PyObjects
153 wxToolBarToolBase *AddTool(int id,
154 const wxBitmap& bitmap,
155 const wxBitmap& pushedBitmap = wxNullBitmap,
156 int isToggle = FALSE,
157 PyObject *clientData = NULL,
158 const wxString& shortHelpString = wxEmptyString,
159 const wxString& longHelpString = wxEmptyString) {
160 wxPyUserData* udata = NULL;
162 udata = new wxPyUserData(clientData);
163 return self->AddTool(id, bitmap, pushedBitmap, (bool)isToggle,
164 udata, shortHelpString, longHelpString);
167 // This one is easier to use...
168 wxToolBarToolBase *AddSimpleTool(int id,
169 const wxBitmap& bitmap,
170 const wxString& shortHelpString = wxEmptyString,
171 const wxString& longHelpString = wxEmptyString,
172 int isToggle = FALSE) {
173 return self->AddTool(id, bitmap, wxNullBitmap, isToggle, NULL,
174 shortHelpString, longHelpString);
178 // wrap ClientData in a class that knows about PyObjects
179 wxToolBarToolBase *InsertTool(size_t pos,
181 const wxBitmap& bitmap,
182 const wxBitmap& pushedBitmap = wxNullBitmap,
183 int isToggle = FALSE,
184 PyObject *clientData = NULL,
185 const wxString& shortHelpString = wxEmptyString,
186 const wxString& longHelpString = wxEmptyString) {
187 wxPyUserData* udata = NULL;
189 udata = new wxPyUserData(clientData);
190 return self->InsertTool(pos, id, bitmap, pushedBitmap, (bool)isToggle,
191 udata, shortHelpString, longHelpString);
194 // This one is easier to use...
195 wxToolBarToolBase *InsertSimpleTool(size_t pos,
197 const wxBitmap& bitmap,
198 const wxString& shortHelpString = wxEmptyString,
199 const wxString& longHelpString = wxEmptyString,
200 int isToggle = FALSE) {
201 return self->InsertTool(pos, id, bitmap, wxNullBitmap, isToggle, NULL,
202 shortHelpString, longHelpString);
207 wxToolBarToolBase *AddControl(wxControl *control);
208 wxToolBarToolBase *InsertControl(size_t pos, wxControl *control);
210 wxToolBarToolBase *AddSeparator();
211 wxToolBarToolBase *InsertSeparator(size_t pos);
213 wxToolBarToolBase *RemoveTool(int id);
215 bool DeleteToolByPos(size_t pos);
216 bool DeleteTool(int id);
220 void EnableTool(int id, bool enable);
221 void ToggleTool(int id, bool toggle);
222 void SetToggle(int id, bool toggle);
226 // convert the ClientData back to a PyObject
227 PyObject* GetToolClientData(int index) {
228 wxPyUserData* udata = (wxPyUserData*)self->GetToolClientData(index);
230 Py_INCREF(udata->m_obj);
238 void SetToolClientData(int index, PyObject* clientData) {
239 self->SetToolClientData(index, new wxPyUserData(clientData));
244 bool GetToolState(int id);
245 bool GetToolEnabled(int id);
246 void SetToolShortHelp(int id, const wxString& helpString);
247 wxString GetToolShortHelp(int id);
248 void SetToolLongHelp(int id, const wxString& helpString);
249 wxString GetToolLongHelp(int id);
251 %name(SetMarginsXY) void SetMargins(int x, int y);
252 void SetMargins(const wxSize& size);
253 void SetToolPacking(int packing);
254 void SetToolSeparation(int separation);
255 wxSize GetToolMargins();
257 int GetToolPacking();
258 int GetToolSeparation();
260 void SetRows(int nRows);
261 void SetMaxRowsCols(int rows, int cols);
265 void SetToolBitmapSize(const wxSize& size);
266 wxSize GetToolBitmapSize();
267 wxSize GetToolSize();
274 class wxToolBar : public wxToolBarBase {
276 wxToolBar(wxWindow *parent,
278 const wxPoint& pos = wxDefaultPosition,
279 const wxSize& size = wxDefaultSize,
280 long style = wxNO_BORDER | wxTB_HORIZONTAL,
281 const char* name = wxToolBarNameStr);
282 %name(wxPreToolBar)wxToolBar();
284 bool Create(wxWindow *parent,
286 const wxPoint& pos = wxDefaultPosition,
287 const wxSize& size = wxDefaultSize,
288 long style = wxNO_BORDER | wxTB_HORIZONTAL,
289 const char* name = wxToolBarNameStr);
291 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
292 %pragma(python) addtomethod = "wxPreToolBar:val._setOORInfo(val)"
294 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
300 class wxToolBarSimple : public wxToolBarBase {
302 wxToolBarSimple(wxWindow *parent,
304 const wxPoint& pos = wxDefaultPosition,
305 const wxSize& size = wxDefaultSize,
306 long style = wxNO_BORDER | wxTB_HORIZONTAL,
307 const char* name = wxToolBarNameStr);
308 %name(wxPreToolBarSimple)wxToolBarSimple();
310 bool Create(wxWindow *parent,
312 const wxPoint& pos = wxDefaultPosition,
313 const wxSize& size = wxDefaultSize,
314 long style = wxNO_BORDER | wxTB_HORIZONTAL,
315 const char* name = wxToolBarNameStr);
317 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
318 %pragma(python) addtomethod = "wxPreToolBarSimple:val._setOORInfo(val)"
320 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
323 //---------------------------------------------------------------------------
324 //---------------------------------------------------------------------------