]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/stattool.i
Regenerated file lists so features.h would be installed
[wxWidgets.git] / wxPython / src / stattool.i
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
33 %pragma(python) code = "import wx"
34
35
36 //---------------------------------------------------------------------------
37
38 class wxStatusBar : public wxWindow {
39 public:
40 wxStatusBar(wxWindow* parent, wxWindowID id = -1,
41 long style = wxST_SIZEGRIP,
42 char* name = "statusBar");
43 %name(wxPreStatusBar)wxStatusBar();
44
45 bool Create(wxWindow* parent, wxWindowID id,
46 long style = wxST_SIZEGRIP,
47 char* name = "statusBar");
48
49 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
50 %pragma(python) addtomethod = "wxPreStatusBar:val._setOORInfo(val)"
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);
61 int GetBorderX();
62 int GetBorderY();
63
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);
68 };
69
70
71 //---------------------------------------------------------------------------
72
73 class wxToolBarBase;
74
75 enum wxToolBarToolStyle
76 {
77 wxTOOL_STYLE_BUTTON = 1,
78 wxTOOL_STYLE_SEPARATOR = 2,
79 wxTOOL_STYLE_CONTROL
80 };
81
82
83
84 class wxToolBarToolBase : public wxObject {
85 public:
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();
109 const wxBitmap& GetNormalBitmap();
110 const wxBitmap& GetDisabledBitmap();
111 wxBitmap GetBitmap();
112 wxString GetLabel();
113 wxString GetShortHelp();
114 wxString GetLongHelp();
115 bool Enable(bool enable);
116 void Toggle();
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);
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 }
144
145 %pragma(python) addtoclass="
146 GetBitmap1 = GetNormalBitmap
147 GetBitmap2 = GetDisabledBitmap
148 SetBitmap1 = SetNormalBitmap
149 SetBitmap2 = SetDisabledBitmap
150 "
151 };
152
153
154
155 class wxToolBarBase : public wxControl {
156 public:
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,
165 int isToggle = FALSE,
166 PyObject *clientData = NULL,
167 const wxString& shortHelpString = wxEmptyString,
168 const wxString& longHelpString = wxEmptyString) {
169 wxPyUserData* udata = NULL;
170 if (clientData)
171 udata = new wxPyUserData(clientData);
172 return self->AddTool(id, bitmap, pushedBitmap, (bool)isToggle,
173 udata, shortHelpString, longHelpString);
174 }
175
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);
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,
192 int isToggle = FALSE,
193 PyObject *clientData = NULL,
194 const wxString& shortHelpString = wxEmptyString,
195 const wxString& longHelpString = wxEmptyString) {
196 wxPyUserData* udata = NULL;
197 if (clientData)
198 udata = new wxPyUserData(clientData);
199 return self->InsertTool(pos, id, bitmap, pushedBitmap, (bool)isToggle,
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,
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);
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
236 PyObject* GetToolClientData(int id) {
237 wxPyUserData* udata = (wxPyUserData*)self->GetToolClientData(id);
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
247 void SetToolClientData(int id, PyObject* clientData) {
248 self->SetToolClientData(id, new wxPyUserData(clientData));
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();
265 wxSize GetMargins();
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
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();
284 };
285
286
287
288
289 class wxToolBar : public wxToolBarBase {
290 public:
291 wxToolBar(wxWindow *parent,
292 wxWindowID id,
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();
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);
305
306 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
307 %pragma(python) addtomethod = "wxPreToolBar:val._setOORInfo(val)"
308
309 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
310 };
311
312
313
314
315 class wxToolBarSimple : public wxToolBarBase {
316 public:
317 wxToolBarSimple(wxWindow *parent,
318 wxWindowID id,
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();
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);
331
332 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
333 %pragma(python) addtomethod = "wxPreToolBarSimple:val._setOORInfo(val)"
334
335 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
336 };
337
338 //---------------------------------------------------------------------------
339 //---------------------------------------------------------------------------
340