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 const wxBitmap& GetNormalBitmap();
110 const wxBitmap& GetDisabledBitmap();
111 wxBitmap GetBitmap();
113 wxString GetShortHelp();
114 wxString GetLongHelp();
115 bool Enable(bool enable);
117 bool SetToggle(bool toggle);
118 bool SetShortHelp(const wxString& help);
119 bool SetLongHelp(const wxString& help);
120 void SetNormalBitmap(const wxBitmap& bmp);
121 void SetDisabledBitmap(const wxBitmap& bmp);
122 void SetLabel(const wxString& label);
124 void Attach(wxToolBarBase *tbar);
126 //wxObject *GetClientData();
128 // convert the ClientData back to a PyObject
129 PyObject* GetClientData() {
130 wxPyUserData* udata = (wxPyUserData*)self->GetClientData();
132 Py_INCREF(udata->m_obj);
140 void SetClientData(PyObject* clientData) {
141 self->SetClientData(new wxPyUserData(clientData));
145 %pragma(python) addtoclass="
146 GetBitmap1 = GetNormalBitmap
147 GetBitmap2 = GetDisabledBitmap
148 SetBitmap1 = SetNormalBitmap
149 SetBitmap2 = SetDisabledBitmap
155 class wxToolBarBase : public wxControl {
158 // This is an Abstract Base Class
161 // wrap ClientData in a class that knows about PyObjects
162 wxToolBarToolBase *AddTool(int id,
163 const wxBitmap& bitmap,
164 const wxBitmap& pushedBitmap = wxNullBitmap,
165 int isToggle = FALSE,
166 PyObject *clientData = NULL,
167 const wxString& shortHelpString = wxEmptyString,
168 const wxString& longHelpString = wxEmptyString) {
169 wxPyUserData* udata = NULL;
171 udata = new wxPyUserData(clientData);
172 return self->AddTool(id, bitmap, pushedBitmap, (bool)isToggle,
173 udata, shortHelpString, longHelpString);
176 // This one is easier to use...
177 wxToolBarToolBase *AddSimpleTool(int id,
178 const wxBitmap& bitmap,
179 const wxString& shortHelpString = wxEmptyString,
180 const wxString& longHelpString = wxEmptyString,
181 int isToggle = FALSE) {
182 return self->AddTool(id, bitmap, wxNullBitmap, isToggle, NULL,
183 shortHelpString, longHelpString);
187 // wrap ClientData in a class that knows about PyObjects
188 wxToolBarToolBase *InsertTool(size_t pos,
190 const wxBitmap& bitmap,
191 const wxBitmap& pushedBitmap = wxNullBitmap,
192 int isToggle = FALSE,
193 PyObject *clientData = NULL,
194 const wxString& shortHelpString = wxEmptyString,
195 const wxString& longHelpString = wxEmptyString) {
196 wxPyUserData* udata = NULL;
198 udata = new wxPyUserData(clientData);
199 return self->InsertTool(pos, id, bitmap, pushedBitmap, (bool)isToggle,
200 udata, shortHelpString, longHelpString);
203 // This one is easier to use...
204 wxToolBarToolBase *InsertSimpleTool(size_t pos,
206 const wxBitmap& bitmap,
207 const wxString& shortHelpString = wxEmptyString,
208 const wxString& longHelpString = wxEmptyString,
209 int isToggle = FALSE) {
210 return self->InsertTool(pos, id, bitmap, wxNullBitmap, isToggle, NULL,
211 shortHelpString, longHelpString);
216 wxToolBarToolBase *AddControl(wxControl *control);
217 wxToolBarToolBase *InsertControl(size_t pos, wxControl *control);
219 wxToolBarToolBase *AddSeparator();
220 wxToolBarToolBase *InsertSeparator(size_t pos);
222 wxToolBarToolBase *RemoveTool(int id);
224 bool DeleteToolByPos(size_t pos);
225 bool DeleteTool(int id);
229 void EnableTool(int id, bool enable);
230 void ToggleTool(int id, bool toggle);
231 void SetToggle(int id, bool toggle);
235 // convert the ClientData back to a PyObject
236 PyObject* GetToolClientData(int id) {
237 wxPyUserData* udata = (wxPyUserData*)self->GetToolClientData(id);
239 Py_INCREF(udata->m_obj);
247 void SetToolClientData(int id, PyObject* clientData) {
248 self->SetToolClientData(id, new wxPyUserData(clientData));
253 bool GetToolState(int id);
254 bool GetToolEnabled(int id);
255 void SetToolShortHelp(int id, const wxString& helpString);
256 wxString GetToolShortHelp(int id);
257 void SetToolLongHelp(int id, const wxString& helpString);
258 wxString GetToolLongHelp(int id);
260 %name(SetMarginsXY) void SetMargins(int x, int y);
261 void SetMargins(const wxSize& size);
262 void SetToolPacking(int packing);
263 void SetToolSeparation(int separation);
264 wxSize GetToolMargins();
266 int GetToolPacking();
267 int GetToolSeparation();
269 void SetRows(int nRows);
270 void SetMaxRowsCols(int rows, int cols);
274 void SetToolBitmapSize(const wxSize& size);
275 wxSize GetToolBitmapSize();
276 wxSize GetToolSize();
278 // returns a (non separator) tool containing the point (x, y) or NULL if
279 // there is no tool at this point (corrdinates are client)
280 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
282 // return TRUE if this is a vertical toolbar, otherwise FALSE
289 class wxToolBar : public wxToolBarBase {
291 wxToolBar(wxWindow *parent,
293 const wxPoint& pos = wxDefaultPosition,
294 const wxSize& size = wxDefaultSize,
295 long style = wxNO_BORDER | wxTB_HORIZONTAL,
296 const char* name = wxToolBarNameStr);
297 %name(wxPreToolBar)wxToolBar();
299 bool Create(wxWindow *parent,
301 const wxPoint& pos = wxDefaultPosition,
302 const wxSize& size = wxDefaultSize,
303 long style = wxNO_BORDER | wxTB_HORIZONTAL,
304 const char* name = wxToolBarNameStr);
306 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
307 %pragma(python) addtomethod = "wxPreToolBar:val._setOORInfo(val)"
309 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
315 class wxToolBarSimple : public wxToolBarBase {
317 wxToolBarSimple(wxWindow *parent,
319 const wxPoint& pos = wxDefaultPosition,
320 const wxSize& size = wxDefaultSize,
321 long style = wxNO_BORDER | wxTB_HORIZONTAL,
322 const char* name = wxToolBarNameStr);
323 %name(wxPreToolBarSimple)wxToolBarSimple();
325 bool Create(wxWindow *parent,
327 const wxPoint& pos = wxDefaultPosition,
328 const wxSize& size = wxDefaultSize,
329 long style = wxNO_BORDER | wxTB_HORIZONTAL,
330 const char* name = wxToolBarNameStr);
332 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
333 %pragma(python) addtomethod = "wxPreToolBarSimple:val._setOORInfo(val)"
335 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
338 //---------------------------------------------------------------------------
339 //---------------------------------------------------------------------------