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"
37 static wxString wxPyEmptyStr("");
40 //---------------------------------------------------------------------------
42 class wxStatusBar : public wxWindow {
44 wxStatusBar(wxWindow* parent, wxWindowID id,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = wxST_SIZEGRIP,
48 char* name = "statusBar");
49 %name(wxPreStatusBar)wxStatusBar();
51 bool Create(wxWindow* parent, wxWindowID id,
52 long style = wxST_SIZEGRIP,
53 char* name = "statusBar");
55 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
58 %new wxRect* GetFieldRect(long item) {
59 wxRect* rect= new wxRect;
60 self->GetFieldRect(item, *rect);
64 int GetFieldsCount(void);
65 wxString GetStatusText(int ir = 0);
69 void SetFieldsCount(int number = 1);
70 void SetStatusText(const wxString& text, int i = 0);
71 void SetStatusWidths(int LCOUNT, int* choices);
72 void SetMinHeight(int height);
76 //---------------------------------------------------------------------------
80 enum wxToolBarToolStyle
82 wxTOOL_STYLE_BUTTON = 1,
83 wxTOOL_STYLE_SEPARATOR = 2,
89 class wxToolBarToolBase : public wxObject {
91 // wxToolBarToolBase(wxToolBarBase *tbar = (wxToolBarBase *)NULL,
92 // int id = wxID_SEPARATOR,
93 // const wxBitmap& bitmap1 = wxNullBitmap,
94 // const wxBitmap& bitmap2 = wxNullBitmap,
95 // bool toggle = FALSE,
96 // wxObject *clientData = (wxObject *) NULL,
97 // const wxString& shortHelpString = wxEmptyString,
98 // const wxString& longHelpString = wxEmptyString);
99 // wxToolBarToolBase(wxToolBarBase *tbar, wxControl *control);
100 // ~wxToolBarToolBase();
102 %addmethods { void Destroy() { delete self; } }
105 wxControl *GetControl();
106 wxToolBarBase *GetToolBar();
114 const wxBitmap& GetBitmap1();
115 const wxBitmap& GetBitmap2();
116 const wxBitmap& GetBitmap();
117 wxString GetShortHelp();
118 wxString GetLongHelp();
119 bool Enable(bool enable);
120 bool Toggle(bool toggle);
121 bool SetToggle(bool toggle);
122 bool SetShortHelp(const wxString& help);
123 bool SetLongHelp(const wxString& help);
124 void SetBitmap1(const wxBitmap& bmp);
125 void SetBitmap2(const wxBitmap& bmp);
127 void Attach(wxToolBarBase *tbar);
129 //wxObject *GetClientData();
131 // convert the ClientData back to a PyObject
132 PyObject* GetClientData() {
133 wxPyUserData* udata = (wxPyUserData*)self->GetClientData();
135 Py_INCREF(udata->m_obj);
143 void SetClientData(PyObject* clientData) {
144 self->SetClientData(new wxPyUserData(clientData));
151 class wxToolBarBase : public wxControl {
154 // This is an Abstract Base Class
157 // wrap ClientData in a class that knows about PyObjects
158 wxToolBarToolBase *AddTool(int id,
159 const wxBitmap& bitmap,
160 const wxBitmap& pushedBitmap = wxNullBitmap,
161 int isToggle = FALSE,
162 PyObject *clientData = NULL,
163 const wxString& shortHelpString = wxPyEmptyStr,
164 const wxString& longHelpString = wxPyEmptyStr) {
165 wxPyUserData* udata = NULL;
167 udata = new wxPyUserData(clientData);
168 return self->AddTool(id, bitmap, pushedBitmap, (bool)isToggle,
169 udata, shortHelpString, longHelpString);
172 // This one is easier to use...
173 wxToolBarToolBase *AddSimpleTool(int id,
174 const wxBitmap& bitmap,
175 const wxString& shortHelpString = wxPyEmptyStr,
176 const wxString& longHelpString = wxPyEmptyStr,
177 int isToggle = FALSE) {
178 return self->AddTool(id, bitmap, wxNullBitmap, isToggle, NULL,
179 shortHelpString, longHelpString);
183 // wrap ClientData in a class that knows about PyObjects
184 wxToolBarToolBase *InsertTool(size_t pos,
186 const wxBitmap& bitmap,
187 const wxBitmap& pushedBitmap = wxNullBitmap,
188 int isToggle = FALSE,
189 PyObject *clientData = NULL,
190 const wxString& shortHelpString = wxPyEmptyStr,
191 const wxString& longHelpString = wxPyEmptyStr) {
192 wxPyUserData* udata = NULL;
194 udata = new wxPyUserData(clientData);
195 return self->InsertTool(pos, id, bitmap, pushedBitmap, (bool)isToggle,
196 udata, shortHelpString, longHelpString);
199 // This one is easier to use...
200 wxToolBarToolBase *InsertSimpleTool(size_t pos,
202 const wxBitmap& bitmap,
203 const wxString& shortHelpString = wxPyEmptyStr,
204 const wxString& longHelpString = wxPyEmptyStr,
205 int isToggle = FALSE) {
206 return self->InsertTool(pos, id, bitmap, wxNullBitmap, isToggle, NULL,
207 shortHelpString, longHelpString);
212 wxToolBarToolBase *AddControl(wxControl *control);
213 wxToolBarToolBase *InsertControl(size_t pos, wxControl *control);
215 wxToolBarToolBase *AddSeparator();
216 wxToolBarToolBase *InsertSeparator(size_t pos);
218 wxToolBarToolBase *RemoveTool(int id);
220 bool DeleteToolByPos(size_t pos);
221 bool DeleteTool(int id);
225 void EnableTool(int id, bool enable);
226 void ToggleTool(int id, bool toggle);
227 void SetToggle(int id, bool toggle);
231 // convert the ClientData back to a PyObject
232 PyObject* GetToolClientData(int index) {
233 wxPyUserData* udata = (wxPyUserData*)self->GetToolClientData(index);
235 Py_INCREF(udata->m_obj);
243 void SetToolClientData(int index, PyObject* clientData) {
244 self->SetToolClientData(index, new wxPyUserData(clientData));
249 bool GetToolState(int id);
250 bool GetToolEnabled(int id);
251 void SetToolShortHelp(int id, const wxString& helpString);
252 wxString GetToolShortHelp(int id);
253 void SetToolLongHelp(int id, const wxString& helpString);
254 wxString GetToolLongHelp(int id);
256 %name(SetMarginsXY) void SetMargins(int x, int y);
257 void SetMargins(const wxSize& size);
258 void SetToolPacking(int packing);
259 void SetToolSeparation(int separation);
260 wxSize GetToolMargins();
262 int GetToolPacking();
263 int GetToolSeparation();
265 void SetRows(int nRows);
266 void SetMaxRowsCols(int rows, int cols);
270 void SetToolBitmapSize(const wxSize& size);
271 wxSize GetToolBitmapSize();
272 wxSize GetToolSize();
279 class wxToolBar : public wxToolBarBase {
281 wxToolBar(wxWindow *parent,
283 const wxPoint& pos = wxDefaultPosition,
284 const wxSize& size = wxDefaultSize,
285 long style = wxNO_BORDER | wxTB_HORIZONTAL,
286 const char* name = wxToolBarNameStr);
287 %name(wxPreToolBar)wxToolBar();
289 bool Create(wxWindow *parent,
291 const wxPoint& pos = wxDefaultPosition,
292 const wxSize& size = wxDefaultSize,
293 long style = wxNO_BORDER | wxTB_HORIZONTAL,
294 const char* name = wxToolBarNameStr);
296 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
298 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
304 class wxToolBarSimple : public wxToolBarBase {
306 wxToolBarSimple(wxWindow *parent,
308 const wxPoint& pos = wxDefaultPosition,
309 const wxSize& size = wxDefaultSize,
310 long style = wxNO_BORDER | wxTB_HORIZONTAL,
311 const char* name = wxToolBarNameStr);
312 %name(wxPreToolBarSimple)wxToolBarSimple();
314 bool Create(wxWindow *parent,
316 const wxPoint& pos = wxDefaultPosition,
317 const wxSize& size = wxDefaultSize,
318 long style = wxNO_BORDER | wxTB_HORIZONTAL,
319 const char* name = wxToolBarNameStr);
321 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
323 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
326 //---------------------------------------------------------------------------
327 //---------------------------------------------------------------------------