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"
35 //---------------------------------------------------------------------------
37 class wxStatusBar : public wxWindow {
39 wxStatusBar(wxWindow* parent, wxWindowID id,
40 const wxPoint& pos = wxPyDefaultPosition,
41 const wxSize& size = wxPyDefaultSize,
42 long style = wxST_SIZEGRIP,
43 char* name = "statusBar");
45 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
48 %new wxRect* GetFieldRect(long item) {
49 wxRect* rect= new wxRect;
50 self->GetFieldRect(item, *rect);
54 int GetFieldsCount(void);
55 wxString GetStatusText(int ir = 0);
59 // void DrawField(wxDC& dc, int i);
60 // void DrawFieldText(wxDC& dc, int i);
61 // void InitColours(void);
63 void SetFieldsCount(int number = 1);
64 void SetStatusText(const wxString& text, int i = 0);
65 void SetStatusWidths(int LCOUNT, int* choices);
66 void SetMinHeight(int height);
70 //---------------------------------------------------------------------------
74 enum wxToolBarToolStyle
76 wxTOOL_STYLE_BUTTON = 1,
77 wxTOOL_STYLE_SEPARATOR = 2,
83 class wxToolBarToolBase {
85 // wxToolBarToolBase(wxToolBarBase *tbar = (wxToolBarBase *)NULL,
86 // int id = wxID_SEPARATOR,
87 // const wxBitmap& bitmap1 = wxNullBitmap,
88 // const wxBitmap& bitmap2 = wxNullBitmap,
89 // bool toggle = FALSE,
90 // wxObject *clientData = (wxObject *) NULL,
91 // const wxString& shortHelpString = wxEmptyString,
92 // const wxString& longHelpString = wxEmptyString);
93 // wxToolBarToolBase(wxToolBarBase *tbar, wxControl *control);
94 // ~wxToolBarToolBase();
96 %addmethods { void Destroy() { delete self; } }
99 wxControl *GetControl();
100 wxToolBarBase *GetToolBar();
108 const wxBitmap& GetBitmap1();
109 const wxBitmap& GetBitmap2();
110 const wxBitmap& GetBitmap();
111 wxString GetShortHelp();
112 wxString GetLongHelp();
113 bool Enable(bool enable);
114 bool Toggle(bool toggle);
115 bool SetToggle(bool toggle);
116 bool SetShortHelp(const wxString& help);
117 bool SetLongHelp(const wxString& help);
118 void SetBitmap1(const wxBitmap& bmp);
119 void SetBitmap2(const wxBitmap& bmp);
121 void Attach(wxToolBarBase *tbar);
123 //wxObject *GetClientData();
125 // convert the ClientData back to a PyObject
126 PyObject* GetClientData() {
127 wxPyUserData* udata = (wxPyUserData*)self->GetClientData();
129 Py_INCREF(udata->m_obj);
137 void SetClientData(PyObject* clientData) {
138 self->SetClientData(new wxPyUserData(clientData));
145 class wxToolBarBase : public wxControl {
148 // This is an Abstract Base Class
151 // wrap ClientData in a class that knows about PyObjects
152 wxToolBarToolBase *AddTool(int id,
153 const wxBitmap& bitmap,
154 const wxBitmap& pushedBitmap = wxNullBitmap,
155 int isToggle = FALSE,
156 PyObject *clientData = NULL,
157 const wxString& shortHelpString = wxPyEmptyStr,
158 const wxString& longHelpString = wxPyEmptyStr) {
159 wxPyUserData* udata = NULL;
161 udata = new wxPyUserData(clientData);
162 return self->AddTool(id, bitmap, pushedBitmap, (bool)isToggle,
163 udata, shortHelpString, longHelpString);
166 // This one is easier to use...
167 wxToolBarToolBase *AddSimpleTool(int id,
168 const wxBitmap& bitmap,
169 const wxString& shortHelpString = wxPyEmptyStr,
170 const wxString& longHelpString = wxPyEmptyStr,
171 int isToggle = FALSE) {
172 return self->AddTool(id, bitmap, wxNullBitmap, isToggle, NULL,
173 shortHelpString, longHelpString);
177 // wrap ClientData in a class that knows about PyObjects
178 wxToolBarToolBase *InsertTool(size_t pos,
180 const wxBitmap& bitmap,
181 const wxBitmap& pushedBitmap = wxNullBitmap,
182 int isToggle = FALSE,
183 PyObject *clientData = NULL,
184 const wxString& shortHelpString = wxPyEmptyStr,
185 const wxString& longHelpString = wxPyEmptyStr) {
186 wxPyUserData* udata = NULL;
188 udata = new wxPyUserData(clientData);
189 return self->InsertTool(pos, id, bitmap, pushedBitmap, (bool)isToggle,
190 udata, shortHelpString, longHelpString);
193 // This one is easier to use...
194 wxToolBarToolBase *InsertSimpleTool(size_t pos,
196 const wxBitmap& bitmap,
197 const wxString& shortHelpString = wxPyEmptyStr,
198 const wxString& longHelpString = wxPyEmptyStr,
199 int isToggle = FALSE) {
200 return self->InsertTool(pos, id, bitmap, wxNullBitmap, isToggle, NULL,
201 shortHelpString, longHelpString);
206 wxToolBarToolBase *AddControl(wxControl *control);
207 wxToolBarToolBase *InsertControl(size_t pos, wxControl *control);
209 wxToolBarToolBase *AddSeparator();
210 wxToolBarToolBase *InsertSeparator(size_t pos);
212 wxToolBarToolBase *RemoveTool(int id);
214 bool DeleteToolByPos(size_t pos);
215 bool DeleteTool(int id);
219 void EnableTool(int id, bool enable);
220 void ToggleTool(int id, bool toggle);
221 void SetToggle(int id, bool toggle);
225 // convert the ClientData back to a PyObject
226 PyObject* GetToolClientData(int index) {
227 wxPyUserData* udata = (wxPyUserData*)self->GetToolClientData(index);
229 Py_INCREF(udata->m_obj);
237 void SetToolClientData(int index, PyObject* clientData) {
238 self->SetToolClientData(index, new wxPyUserData(clientData));
243 bool GetToolState(int id);
244 bool GetToolEnabled(int id);
245 void SetToolShortHelp(int id, const wxString& helpString);
246 wxString GetToolShortHelp(int id);
247 void SetToolLongHelp(int id, const wxString& helpString);
248 wxString GetToolLongHelp(int id);
250 %name(SetMarginsXY) void SetMargins(int x, int y);
251 void SetMargins(const wxSize& size);
252 void SetToolPacking(int packing);
253 void SetToolSeparation(int separation);
254 wxSize GetToolMargins();
255 int GetToolPacking();
256 int GetToolSeparation();
258 void SetRows(int nRows);
259 void SetMaxRowsCols(int rows, int cols);
263 void SetToolBitmapSize(const wxSize& size);
264 wxSize GetToolBitmapSize();
265 wxSize GetToolSize();
272 class wxToolBar : public wxToolBarBase {
274 wxToolBar(wxWindow *parent,
276 const wxPoint& pos = wxPyDefaultPosition,
277 const wxSize& size = wxPyDefaultSize,
278 long style = wxNO_BORDER | wxTB_HORIZONTAL,
279 const char* name = wxToolBarNameStr);
281 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
283 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
289 class wxToolBarSimple : public wxToolBarBase {
291 wxToolBarSimple(wxWindow *parent,
293 const wxPoint& pos = wxPyDefaultPosition,
294 const wxSize& size = wxPyDefaultSize,
295 long style = wxNO_BORDER | wxTB_HORIZONTAL,
296 const char* name = wxToolBarNameStr);
298 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
300 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
303 //---------------------------------------------------------------------------
309 class wxToolBarTool {
313 void SetSize( long w, long h )
316 wxControl *GetControl();
320 wxObject * m_clientData;
328 bool m_deleteSecondBitmap;
332 bool m_isMenuCommand;
333 wxString m_shortHelpString;
334 wxString m_longHelpString;
339 // class wxToolBarBase : public wxControl {
342 class wxToolBar : public wxControl {
344 wxToolBar(wxWindow* parent, wxWindowID id,
345 const wxPoint& pos = wxPyDefaultPosition,
346 const wxSize& size = wxPyDefaultSize,
347 long style = wxTB_HORIZONTAL | wxNO_BORDER,
348 char* name = "toolBar");
350 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
353 bool AddControl(wxControl * control);
357 // Ignoge the clientData for now...
359 wxToolBarTool* AddTool(int toolIndex,
360 const wxBitmap& bitmap1,
361 const wxBitmap& bitmap2 = wxNullBitmap,
362 int isToggle = FALSE,
365 //wxObject* clientData = NULL,
366 const wxString& shortHelpString = wxPyEmptyStr,
367 const wxString& longHelpString = wxPyEmptyStr) {
368 return self->AddTool(toolIndex, bitmap1, bitmap2,
369 isToggle, xPos, yPos, NULL,
370 shortHelpString, longHelpString);
373 wxToolBarTool* AddSimpleTool(int toolIndex,
374 const wxBitmap& bitmap,
375 const wxString& shortHelpString = wxPyEmptyStr,
376 const wxString& longHelpString = wxPyEmptyStr) {
377 return self->AddTool(toolIndex, bitmap, wxNullBitmap,
379 shortHelpString, longHelpString);
384 void EnableTool(int toolIndex, bool enable);
386 wxToolBarTool* FindToolForPosition(long x, long y);
387 wxSize GetToolSize();
388 wxSize GetToolBitmapSize();
389 void SetToolBitmapSize(const wxSize& size);
392 wxSize GetToolMargins();
393 // wxObject* GetToolClientData(int toolIndex);
394 bool GetToolEnabled(int toolIndex);
395 wxString GetToolLongHelp(int toolIndex);
396 int GetToolPacking();
397 int GetToolSeparation();
398 wxString GetToolShortHelp(int toolIndex);
399 bool GetToolState(int toolIndex);
404 void SetToolLongHelp(int toolIndex, const wxString& helpString);
405 void SetToolShortHelp(int toolIndex, const wxString& helpString);
406 void SetMargins(const wxSize& size);
407 void SetToolPacking(int packing);
408 void SetToolSeparation(int separation);
409 void ToggleTool(int toolIndex, const bool toggle);
410 void SetToggle(int toolIndex, bool toggle);
411 void SetMaxRowsCols(int rows, int cols);
419 //---------------------------------------------------------------------------