]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/stattool.i
enabled toolbar as it works now
[wxWidgets.git] / wxPython / src / stattool.i
CommitLineData
9c039d08
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: stattool.i
3// Purpose: SWIG definitions for StatusBar and ToolBar classes
4//
5// Author: Robin Dunn
6//
7// Created: 08/24/1998
8// RCS-ID: $Id$
9// Copyright: (c) 1998 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13
14%module stattool
15
16%{
17#include "helpers.h"
18#include <wx/toolbar.h>
19#include <wx/tbarsmpl.h>
20%}
21
22//----------------------------------------------------------------------
23
24%include typemaps.i
25%include my_typemaps.i
26
27// Import some definitions of other classes, etc.
28%import _defs.i
29%import misc.i
30%import windows.i
31%import controls.i
32
b8b8dda7 33%pragma(python) code = "import wx"
9c039d08 34
b68dc582 35
9c039d08
RD
36//---------------------------------------------------------------------------
37
38class wxStatusBar : public wxWindow {
39public:
99f7d340 40 wxStatusBar(wxWindow* parent, wxWindowID id = -1,
9c039d08
RD
41 long style = wxST_SIZEGRIP,
42 char* name = "statusBar");
09f3d4e6
RD
43 %name(wxPreStatusBar)wxStatusBar();
44
45 bool Create(wxWindow* parent, wxWindowID id,
46 long style = wxST_SIZEGRIP,
47 char* name = "statusBar");
9c039d08 48
0122b7e3 49 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 50 %pragma(python) addtomethod = "wxPreStatusBar:val._setOORInfo(val)"
9c039d08
RD
51
52 %addmethods {
53 %new wxRect* GetFieldRect(long item) {
54 wxRect* rect= new wxRect;
55 self->GetFieldRect(item, *rect);
56 return rect;
57 }
58 }
59 int GetFieldsCount(void);
60 wxString GetStatusText(int ir = 0);
26b9cf27
RD
61 int GetBorderX();
62 int GetBorderY();
63
9c039d08
RD
64 void SetFieldsCount(int number = 1);
65 void SetStatusText(const wxString& text, int i = 0);
eec92d76 66 void SetStatusWidths(int LCOUNT, int* choices);
26b9cf27 67 void SetMinHeight(int height);
9c039d08
RD
68};
69
70
71//---------------------------------------------------------------------------
72
9b3d3bc4
RD
73class wxToolBarBase;
74
75enum wxToolBarToolStyle
76{
77 wxTOOL_STYLE_BUTTON = 1,
78 wxTOOL_STYLE_SEPARATOR = 2,
79 wxTOOL_STYLE_CONTROL
80};
81
82
83
9416aa89 84class wxToolBarToolBase : public wxObject {
9b3d3bc4
RD
85public:
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();
96
97 %addmethods { void Destroy() { delete self; } }
98
99 int GetId();
100 wxControl *GetControl();
101 wxToolBarBase *GetToolBar();
102 int IsButton();
103 int IsControl();
104 int IsSeparator();
105 int GetStyle();
106 bool IsEnabled();
107 bool IsToggled();
108 bool CanBeToggled();
c6ebc32a
RD
109 const wxBitmap& GetNormalBitmap();
110 const wxBitmap& GetDisabledBitmap();
c5943253 111 wxBitmap GetBitmap();
c6ebc32a 112 wxString GetLabel();
9b3d3bc4
RD
113 wxString GetShortHelp();
114 wxString GetLongHelp();
115 bool Enable(bool enable);
c6ebc32a 116 void Toggle();
9b3d3bc4
RD
117 bool SetToggle(bool toggle);
118 bool SetShortHelp(const wxString& help);
119 bool SetLongHelp(const wxString& help);
c6ebc32a
RD
120 void SetNormalBitmap(const wxBitmap& bmp);
121 void SetDisabledBitmap(const wxBitmap& bmp);
122 void SetLabel(const wxString& label);
9b3d3bc4
RD
123 void Detach();
124 void Attach(wxToolBarBase *tbar);
125
126 //wxObject *GetClientData();
127 %addmethods {
128 // convert the ClientData back to a PyObject
129 PyObject* GetClientData() {
130 wxPyUserData* udata = (wxPyUserData*)self->GetClientData();
131 if (udata) {
132 Py_INCREF(udata->m_obj);
133 return udata->m_obj;
134 } else {
135 Py_INCREF(Py_None);
136 return Py_None;
137 }
138 }
139
140 void SetClientData(PyObject* clientData) {
141 self->SetClientData(new wxPyUserData(clientData));
142 }
143 }
c6ebc32a
RD
144
145 %pragma(python) addtoclass="
146 GetBitmap1 = GetNormalBitmap
147 GetBitmap2 = GetDisabledBitmap
148 SetBitmap1 = SetNormalBitmap
149 SetBitmap2 = SetDisabledBitmap
150 "
9b3d3bc4
RD
151};
152
153
154
155class wxToolBarBase : public wxControl {
156public:
157
158 // This is an Abstract Base Class
159
160 %addmethods {
161 // wrap ClientData in a class that knows about PyObjects
162 wxToolBarToolBase *AddTool(int id,
163 const wxBitmap& bitmap,
164 const wxBitmap& pushedBitmap = wxNullBitmap,
c368d904 165 int isToggle = FALSE,
9b3d3bc4 166 PyObject *clientData = NULL,
23bed520
RD
167 const wxString& shortHelpString = wxEmptyString,
168 const wxString& longHelpString = wxEmptyString) {
9b3d3bc4
RD
169 wxPyUserData* udata = NULL;
170 if (clientData)
171 udata = new wxPyUserData(clientData);
c368d904 172 return self->AddTool(id, bitmap, pushedBitmap, (bool)isToggle,
9b3d3bc4
RD
173 udata, shortHelpString, longHelpString);
174 }
175
176 // This one is easier to use...
177 wxToolBarToolBase *AddSimpleTool(int id,
178 const wxBitmap& bitmap,
23bed520
RD
179 const wxString& shortHelpString = wxEmptyString,
180 const wxString& longHelpString = wxEmptyString,
c368d904
RD
181 int isToggle = FALSE) {
182 return self->AddTool(id, bitmap, wxNullBitmap, isToggle, NULL,
9b3d3bc4
RD
183 shortHelpString, longHelpString);
184 }
185
186
187 // wrap ClientData in a class that knows about PyObjects
188 wxToolBarToolBase *InsertTool(size_t pos,
189 int id,
190 const wxBitmap& bitmap,
191 const wxBitmap& pushedBitmap = wxNullBitmap,
c368d904 192 int isToggle = FALSE,
9b3d3bc4 193 PyObject *clientData = NULL,
23bed520
RD
194 const wxString& shortHelpString = wxEmptyString,
195 const wxString& longHelpString = wxEmptyString) {
9b3d3bc4
RD
196 wxPyUserData* udata = NULL;
197 if (clientData)
198 udata = new wxPyUserData(clientData);
c368d904 199 return self->InsertTool(pos, id, bitmap, pushedBitmap, (bool)isToggle,
9b3d3bc4
RD
200 udata, shortHelpString, longHelpString);
201 }
202
203 // This one is easier to use...
204 wxToolBarToolBase *InsertSimpleTool(size_t pos,
205 int id,
206 const wxBitmap& bitmap,
23bed520
RD
207 const wxString& shortHelpString = wxEmptyString,
208 const wxString& longHelpString = wxEmptyString,
c368d904
RD
209 int isToggle = FALSE) {
210 return self->InsertTool(pos, id, bitmap, wxNullBitmap, isToggle, NULL,
9b3d3bc4
RD
211 shortHelpString, longHelpString);
212 }
213 }
214
215
216 wxToolBarToolBase *AddControl(wxControl *control);
217 wxToolBarToolBase *InsertControl(size_t pos, wxControl *control);
218
219 wxToolBarToolBase *AddSeparator();
220 wxToolBarToolBase *InsertSeparator(size_t pos);
221
222 wxToolBarToolBase *RemoveTool(int id);
223
224 bool DeleteToolByPos(size_t pos);
225 bool DeleteTool(int id);
226 void ClearTools();
227 bool Realize();
228
229 void EnableTool(int id, bool enable);
230 void ToggleTool(int id, bool toggle);
231 void SetToggle(int id, bool toggle);
232
233
234 %addmethods {
235 // convert the ClientData back to a PyObject
c6ebc32a
RD
236 PyObject* GetToolClientData(int id) {
237 wxPyUserData* udata = (wxPyUserData*)self->GetToolClientData(id);
9b3d3bc4
RD
238 if (udata) {
239 Py_INCREF(udata->m_obj);
240 return udata->m_obj;
241 } else {
242 Py_INCREF(Py_None);
243 return Py_None;
244 }
245 }
246
c6ebc32a
RD
247 void SetToolClientData(int id, PyObject* clientData) {
248 self->SetToolClientData(id, new wxPyUserData(clientData));
9b3d3bc4
RD
249 }
250 }
251
252
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);
259
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();
83b18bab 265 wxSize GetMargins();
9b3d3bc4
RD
266 int GetToolPacking();
267 int GetToolSeparation();
268
269 void SetRows(int nRows);
270 void SetMaxRowsCols(int rows, int cols);
271 int GetMaxRows();
272 int GetMaxCols();
273
274 void SetToolBitmapSize(const wxSize& size);
275 wxSize GetToolBitmapSize();
276 wxSize GetToolSize();
277
c6ebc32a
RD
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);
281
282 // return TRUE if this is a vertical toolbar, otherwise FALSE
283 bool IsVertical();
9b3d3bc4
RD
284};
285
286
287
288
289class wxToolBar : public wxToolBarBase {
290public:
291 wxToolBar(wxWindow *parent,
292 wxWindowID id,
b68dc582
RD
293 const wxPoint& pos = wxDefaultPosition,
294 const wxSize& size = wxDefaultSize,
9b3d3bc4 295 long style = wxNO_BORDER | wxTB_HORIZONTAL,
8e425133 296 const char* name = wxToolBarNameStr);
09f3d4e6
RD
297 %name(wxPreToolBar)wxToolBar();
298
299 bool Create(wxWindow *parent,
300 wxWindowID id,
301 const wxPoint& pos = wxDefaultPosition,
302 const wxSize& size = wxDefaultSize,
303 long style = wxNO_BORDER | wxTB_HORIZONTAL,
304 const char* name = wxToolBarNameStr);
9b3d3bc4 305
0122b7e3 306 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 307 %pragma(python) addtomethod = "wxPreToolBar:val._setOORInfo(val)"
9b3d3bc4
RD
308
309 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
310};
311
312
313
314
315class wxToolBarSimple : public wxToolBarBase {
316public:
317 wxToolBarSimple(wxWindow *parent,
318 wxWindowID id,
b68dc582
RD
319 const wxPoint& pos = wxDefaultPosition,
320 const wxSize& size = wxDefaultSize,
9b3d3bc4 321 long style = wxNO_BORDER | wxTB_HORIZONTAL,
8e425133 322 const char* name = wxToolBarNameStr);
09f3d4e6
RD
323 %name(wxPreToolBarSimple)wxToolBarSimple();
324
325 bool Create(wxWindow *parent,
326 wxWindowID id,
327 const wxPoint& pos = wxDefaultPosition,
328 const wxSize& size = wxDefaultSize,
329 long style = wxNO_BORDER | wxTB_HORIZONTAL,
330 const char* name = wxToolBarNameStr);
9b3d3bc4 331
0122b7e3 332 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 333 %pragma(python) addtomethod = "wxPreToolBarSimple:val._setOORInfo(val)"
9b3d3bc4
RD
334
335 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
336};
337
338//---------------------------------------------------------------------------
9c039d08
RD
339//---------------------------------------------------------------------------
340