]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/stattool.i
fixed compilation in Unicode build
[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
137b5242
RD
36//----------------------------------------------------------------------
37
38%{
39 // Put some wx default wxChar* values into wxStrings.
40 DECLARE_DEF_STRING(StatusLineNameStr);
41 DECLARE_DEF_STRING(ToolBarNameStr);
42 static const wxString wxPyEmptyString(wxT(""));
43%}
44
9c039d08
RD
45//---------------------------------------------------------------------------
46
47class wxStatusBar : public wxWindow {
48public:
99f7d340 49 wxStatusBar(wxWindow* parent, wxWindowID id = -1,
9c039d08 50 long style = wxST_SIZEGRIP,
137b5242 51 const wxString& name = wxPyStatusLineNameStr);
09f3d4e6
RD
52 %name(wxPreStatusBar)wxStatusBar();
53
54 bool Create(wxWindow* parent, wxWindowID id,
55 long style = wxST_SIZEGRIP,
137b5242 56 const wxString& name = wxPyStatusLineNameStr);
9c039d08 57
0122b7e3 58 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 59 %pragma(python) addtomethod = "wxPreStatusBar:val._setOORInfo(val)"
9c039d08
RD
60
61 %addmethods {
62 %new wxRect* GetFieldRect(long item) {
63 wxRect* rect= new wxRect;
64 self->GetFieldRect(item, *rect);
65 return rect;
66 }
67 }
68 int GetFieldsCount(void);
69 wxString GetStatusText(int ir = 0);
26b9cf27
RD
70 int GetBorderX();
71 int GetBorderY();
72
9c039d08
RD
73 void SetFieldsCount(int number = 1);
74 void SetStatusText(const wxString& text, int i = 0);
eec92d76 75 void SetStatusWidths(int LCOUNT, int* choices);
26b9cf27 76 void SetMinHeight(int height);
9c039d08
RD
77};
78
79
80//---------------------------------------------------------------------------
81
9b3d3bc4
RD
82class wxToolBarBase;
83
84enum wxToolBarToolStyle
85{
86 wxTOOL_STYLE_BUTTON = 1,
87 wxTOOL_STYLE_SEPARATOR = 2,
88 wxTOOL_STYLE_CONTROL
89};
90
91
92
9416aa89 93class wxToolBarToolBase : public wxObject {
9b3d3bc4
RD
94public:
95// wxToolBarToolBase(wxToolBarBase *tbar = (wxToolBarBase *)NULL,
96// int id = wxID_SEPARATOR,
b96c7a38
RD
97// const wxString& label = wxEmptyString,
98// const wxBitmap& bmpNormal = wxNullBitmap,
99// const wxBitmap& bmpDisabled = wxNullBitmap,
100// wxItemKind kind = wxITEM_NORMAL,
9b3d3bc4 101// wxObject *clientData = (wxObject *) NULL,
b96c7a38
RD
102// const wxString& shortHelpString = wxEmptyString,
103// const wxString& longHelpString = wxEmptyString)
9b3d3bc4
RD
104// ~wxToolBarToolBase();
105
106 %addmethods { void Destroy() { delete self; } }
107
108 int GetId();
109 wxControl *GetControl();
110 wxToolBarBase *GetToolBar();
111 int IsButton();
112 int IsControl();
113 int IsSeparator();
114 int GetStyle();
b96c7a38 115 wxItemKind GetKind();
9b3d3bc4
RD
116 bool IsEnabled();
117 bool IsToggled();
118 bool CanBeToggled();
c6ebc32a
RD
119 const wxBitmap& GetNormalBitmap();
120 const wxBitmap& GetDisabledBitmap();
c5943253 121 wxBitmap GetBitmap();
c6ebc32a 122 wxString GetLabel();
9b3d3bc4
RD
123 wxString GetShortHelp();
124 wxString GetLongHelp();
125 bool Enable(bool enable);
c6ebc32a 126 void Toggle();
9b3d3bc4
RD
127 bool SetToggle(bool toggle);
128 bool SetShortHelp(const wxString& help);
129 bool SetLongHelp(const wxString& help);
c6ebc32a
RD
130 void SetNormalBitmap(const wxBitmap& bmp);
131 void SetDisabledBitmap(const wxBitmap& bmp);
132 void SetLabel(const wxString& label);
9b3d3bc4
RD
133 void Detach();
134 void Attach(wxToolBarBase *tbar);
135
136 //wxObject *GetClientData();
137 %addmethods {
138 // convert the ClientData back to a PyObject
139 PyObject* GetClientData() {
140 wxPyUserData* udata = (wxPyUserData*)self->GetClientData();
141 if (udata) {
142 Py_INCREF(udata->m_obj);
143 return udata->m_obj;
144 } else {
145 Py_INCREF(Py_None);
146 return Py_None;
147 }
148 }
149
150 void SetClientData(PyObject* clientData) {
151 self->SetClientData(new wxPyUserData(clientData));
152 }
153 }
c6ebc32a
RD
154
155 %pragma(python) addtoclass="
156 GetBitmap1 = GetNormalBitmap
157 GetBitmap2 = GetDisabledBitmap
158 SetBitmap1 = SetNormalBitmap
159 SetBitmap2 = SetDisabledBitmap
160 "
9b3d3bc4
RD
161};
162
163
164
165class wxToolBarBase : public wxControl {
166public:
167
168 // This is an Abstract Base Class
169
170 %addmethods {
b96c7a38
RD
171
172 // the full AddTool() function
173 //
174 // If bmpDisabled is wxNullBitmap, a shadowed version of the normal bitmap
175 // is created and used as the disabled image.
9b3d3bc4 176 wxToolBarToolBase *AddTool(int id,
b96c7a38 177 const wxString& label,
9b3d3bc4 178 const wxBitmap& bitmap,
b96c7a38
RD
179 const wxBitmap& bmpDisabled,
180 wxItemKind kind = wxITEM_NORMAL,
181 const wxString& shortHelp = wxPyEmptyString,
182 const wxString& longHelp = wxPyEmptyString,
183 PyObject *clientData = NULL)
184 {
9b3d3bc4
RD
185 wxPyUserData* udata = NULL;
186 if (clientData)
187 udata = new wxPyUserData(clientData);
b96c7a38
RD
188 return self->AddTool(id, label, bitmap, bmpDisabled, kind,
189 shortHelp, longHelp, udata);
9b3d3bc4
RD
190 }
191
b96c7a38 192 // The most common version of AddTool
9b3d3bc4 193 wxToolBarToolBase *AddSimpleTool(int id,
b96c7a38 194 const wxString& label,
9b3d3bc4 195 const wxBitmap& bitmap,
b96c7a38
RD
196 const wxString& shortHelp = wxPyEmptyString,
197 const wxString& longHelp = wxPyEmptyString,
198 wxItemKind kind = wxITEM_NORMAL)
199 {
200 return self->AddTool(id, label, bitmap, wxNullBitmap, kind,
201 shortHelp, longHelp, NULL);
202 }
203
204 // add a check tool, i.e. a tool which can be toggled
205 wxToolBarToolBase *AddCheckTool(int id,
206 const wxString& label,
207 const wxBitmap& bitmap,
208 const wxBitmap& bmpDisabled = wxNullBitmap,
c12de7f8
RD
209 const wxString& shortHelp = wxPyEmptyString,
210 const wxString& longHelp = wxPyEmptyString,
b96c7a38
RD
211 PyObject *clientData = NULL)
212 {
213 wxPyUserData* udata = NULL;
214 if (clientData)
215 udata = new wxPyUserData(clientData);
216 return self->AddCheckTool(id, label, bitmap, bmpDisabled,
217 shortHelp, longHelp, udata);
9b3d3bc4
RD
218 }
219
b96c7a38
RD
220 // add a radio tool, i.e. a tool which can be toggled and releases any
221 // other toggled radio tools in the same group when it happens
222 wxToolBarToolBase *AddRadioTool(int id,
223 const wxString& label,
224 const wxBitmap& bitmap,
225 const wxBitmap& bmpDisabled = wxNullBitmap,
c12de7f8
RD
226 const wxString& shortHelp = wxPyEmptyString,
227 const wxString& longHelp = wxPyEmptyString,
b96c7a38
RD
228 PyObject *clientData = NULL)
229 {
230 wxPyUserData* udata = NULL;
231 if (clientData)
232 udata = new wxPyUserData(clientData);
233 return self->AddRadioTool(id, label, bitmap, bmpDisabled,
234 shortHelp, longHelp, udata);
235 }
9b3d3bc4 236
b96c7a38
RD
237 // insert the new tool at the given position, if pos == GetToolsCount(), it
238 // is equivalent to AddTool()
9b3d3bc4
RD
239 wxToolBarToolBase *InsertTool(size_t pos,
240 int id,
b96c7a38 241 const wxString& label,
9b3d3bc4 242 const wxBitmap& bitmap,
b96c7a38
RD
243 const wxBitmap& bmpDisabled = wxNullBitmap,
244 wxItemKind kind = wxITEM_NORMAL,
c12de7f8
RD
245 const wxString& shortHelp = wxPyEmptyString,
246 const wxString& longHelp = wxPyEmptyString,
b96c7a38
RD
247 PyObject *clientData = NULL)
248 {
9b3d3bc4
RD
249 wxPyUserData* udata = NULL;
250 if (clientData)
251 udata = new wxPyUserData(clientData);
b96c7a38
RD
252 return self->InsertTool(pos, id, label, bitmap, bmpDisabled, kind,
253 shortHelp, longHelp, udata);
9b3d3bc4
RD
254 }
255
b96c7a38 256 // A simpler InsertTool
9b3d3bc4 257 wxToolBarToolBase *InsertSimpleTool(size_t pos,
b96c7a38
RD
258 int id,
259 const wxString& label,
260 const wxBitmap& bitmap,
261 wxItemKind kind = wxITEM_NORMAL,
c12de7f8
RD
262 const wxString& shortHelp = wxPyEmptyString,
263 const wxString& longHelp = wxPyEmptyString)
b96c7a38
RD
264 {
265 return self->InsertTool(pos, id, label, bitmap, wxNullBitmap, kind,
266 shortHelp, longHelp);
9b3d3bc4
RD
267 }
268 }
269
270
271 wxToolBarToolBase *AddControl(wxControl *control);
272 wxToolBarToolBase *InsertControl(size_t pos, wxControl *control);
273
274 wxToolBarToolBase *AddSeparator();
275 wxToolBarToolBase *InsertSeparator(size_t pos);
276
277 wxToolBarToolBase *RemoveTool(int id);
278
279 bool DeleteToolByPos(size_t pos);
280 bool DeleteTool(int id);
281 void ClearTools();
282 bool Realize();
283
284 void EnableTool(int id, bool enable);
285 void ToggleTool(int id, bool toggle);
286 void SetToggle(int id, bool toggle);
287
288
289 %addmethods {
290 // convert the ClientData back to a PyObject
c6ebc32a
RD
291 PyObject* GetToolClientData(int id) {
292 wxPyUserData* udata = (wxPyUserData*)self->GetToolClientData(id);
9b3d3bc4
RD
293 if (udata) {
294 Py_INCREF(udata->m_obj);
295 return udata->m_obj;
296 } else {
297 Py_INCREF(Py_None);
298 return Py_None;
299 }
300 }
301
c6ebc32a
RD
302 void SetToolClientData(int id, PyObject* clientData) {
303 self->SetToolClientData(id, new wxPyUserData(clientData));
9b3d3bc4
RD
304 }
305 }
306
307
308 bool GetToolState(int id);
309 bool GetToolEnabled(int id);
310 void SetToolShortHelp(int id, const wxString& helpString);
311 wxString GetToolShortHelp(int id);
312 void SetToolLongHelp(int id, const wxString& helpString);
313 wxString GetToolLongHelp(int id);
314
315 %name(SetMarginsXY) void SetMargins(int x, int y);
316 void SetMargins(const wxSize& size);
317 void SetToolPacking(int packing);
318 void SetToolSeparation(int separation);
319 wxSize GetToolMargins();
83b18bab 320 wxSize GetMargins();
9b3d3bc4
RD
321 int GetToolPacking();
322 int GetToolSeparation();
323
324 void SetRows(int nRows);
325 void SetMaxRowsCols(int rows, int cols);
326 int GetMaxRows();
327 int GetMaxCols();
328
329 void SetToolBitmapSize(const wxSize& size);
330 wxSize GetToolBitmapSize();
331 wxSize GetToolSize();
332
c6ebc32a
RD
333 // returns a (non separator) tool containing the point (x, y) or NULL if
334 // there is no tool at this point (corrdinates are client)
335 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
336
337 // return TRUE if this is a vertical toolbar, otherwise FALSE
338 bool IsVertical();
9b3d3bc4
RD
339};
340
341
342
343
344class wxToolBar : public wxToolBarBase {
345public:
346 wxToolBar(wxWindow *parent,
347 wxWindowID id,
b68dc582
RD
348 const wxPoint& pos = wxDefaultPosition,
349 const wxSize& size = wxDefaultSize,
9b3d3bc4 350 long style = wxNO_BORDER | wxTB_HORIZONTAL,
137b5242 351 const wxString& name = wxPyToolBarNameStr);
09f3d4e6
RD
352 %name(wxPreToolBar)wxToolBar();
353
354 bool Create(wxWindow *parent,
355 wxWindowID id,
356 const wxPoint& pos = wxDefaultPosition,
357 const wxSize& size = wxDefaultSize,
358 long style = wxNO_BORDER | wxTB_HORIZONTAL,
137b5242 359 const wxString& name = wxPyToolBarNameStr);
9b3d3bc4 360
0122b7e3 361 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 362 %pragma(python) addtomethod = "wxPreToolBar:val._setOORInfo(val)"
9b3d3bc4
RD
363
364 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
365};
366
367
368
369
370class wxToolBarSimple : public wxToolBarBase {
371public:
372 wxToolBarSimple(wxWindow *parent,
373 wxWindowID id,
b68dc582
RD
374 const wxPoint& pos = wxDefaultPosition,
375 const wxSize& size = wxDefaultSize,
9b3d3bc4 376 long style = wxNO_BORDER | wxTB_HORIZONTAL,
137b5242 377 const wxString& name = wxPyToolBarNameStr);
09f3d4e6
RD
378 %name(wxPreToolBarSimple)wxToolBarSimple();
379
380 bool Create(wxWindow *parent,
381 wxWindowID id,
382 const wxPoint& pos = wxDefaultPosition,
383 const wxSize& size = wxDefaultSize,
384 long style = wxNO_BORDER | wxTB_HORIZONTAL,
137b5242 385 const wxString& name = wxPyToolBarNameStr);
9b3d3bc4 386
0122b7e3 387 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 388 %pragma(python) addtomethod = "wxPreToolBarSimple:val._setOORInfo(val)"
9b3d3bc4
RD
389
390 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
391};
392
393//---------------------------------------------------------------------------
9c039d08
RD
394//---------------------------------------------------------------------------
395