]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/stattool.i
Compilation fixes
[wxWidgets.git] / utils / 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
RD
34
35//---------------------------------------------------------------------------
36
37class wxStatusBar : public wxWindow {
38public:
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");
44
b8b8dda7 45 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08
RD
46
47 %addmethods {
48 %new wxRect* GetFieldRect(long item) {
49 wxRect* rect= new wxRect;
50 self->GetFieldRect(item, *rect);
51 return rect;
52 }
53 }
54 int GetFieldsCount(void);
55 wxString GetStatusText(int ir = 0);
26b9cf27
RD
56 int GetBorderX();
57 int GetBorderY();
58
59// void DrawField(wxDC& dc, int i);
60// void DrawFieldText(wxDC& dc, int i);
61// void InitColours(void);
9c039d08 62
9c039d08
RD
63 void SetFieldsCount(int number = 1);
64 void SetStatusText(const wxString& text, int i = 0);
eec92d76 65 void SetStatusWidths(int LCOUNT, int* choices);
26b9cf27 66 void SetMinHeight(int height);
9c039d08
RD
67};
68
69
70//---------------------------------------------------------------------------
71
9b3d3bc4
RD
72class wxToolBarBase;
73
74enum wxToolBarToolStyle
75{
76 wxTOOL_STYLE_BUTTON = 1,
77 wxTOOL_STYLE_SEPARATOR = 2,
78 wxTOOL_STYLE_CONTROL
79};
80
81
82
83class wxToolBarToolBase {
84public:
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();
95
96 %addmethods { void Destroy() { delete self; } }
97
98 int GetId();
99 wxControl *GetControl();
100 wxToolBarBase *GetToolBar();
101 int IsButton();
102 int IsControl();
103 int IsSeparator();
104 int GetStyle();
105 bool IsEnabled();
106 bool IsToggled();
107 bool CanBeToggled();
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);
120 void Detach();
121 void Attach(wxToolBarBase *tbar);
122
123 //wxObject *GetClientData();
124 %addmethods {
125 // convert the ClientData back to a PyObject
126 PyObject* GetClientData() {
127 wxPyUserData* udata = (wxPyUserData*)self->GetClientData();
128 if (udata) {
129 Py_INCREF(udata->m_obj);
130 return udata->m_obj;
131 } else {
132 Py_INCREF(Py_None);
133 return Py_None;
134 }
135 }
136
137 void SetClientData(PyObject* clientData) {
138 self->SetClientData(new wxPyUserData(clientData));
139 }
140 }
141};
142
143
144
145class wxToolBarBase : public wxControl {
146public:
147
148 // This is an Abstract Base Class
149
150 %addmethods {
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 toggle = FALSE,
156 PyObject *clientData = NULL,
157 const wxString& shortHelpString = wxPyEmptyStr,
158 const wxString& longHelpString = wxPyEmptyStr) {
159 wxPyUserData* udata = NULL;
160 if (clientData)
161 udata = new wxPyUserData(clientData);
162 return self->AddTool(id, bitmap, pushedBitmap, (bool)toggle,
163 udata, shortHelpString, longHelpString);
164 }
165
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 toggle = FALSE) {
172 return self->AddTool(id, bitmap, wxNullBitmap, toggle, NULL,
173 shortHelpString, longHelpString);
174 }
175
176
177 // wrap ClientData in a class that knows about PyObjects
178 wxToolBarToolBase *InsertTool(size_t pos,
179 int id,
180 const wxBitmap& bitmap,
181 const wxBitmap& pushedBitmap = wxNullBitmap,
182 int toggle = FALSE,
183 PyObject *clientData = NULL,
184 const wxString& shortHelpString = wxPyEmptyStr,
185 const wxString& longHelpString = wxPyEmptyStr) {
186 wxPyUserData* udata = NULL;
187 if (clientData)
188 udata = new wxPyUserData(clientData);
189 return self->InsertTool(pos, id, bitmap, pushedBitmap, (bool)toggle,
190 udata, shortHelpString, longHelpString);
191 }
192
193 // This one is easier to use...
194 wxToolBarToolBase *InsertSimpleTool(size_t pos,
195 int id,
196 const wxBitmap& bitmap,
197 const wxString& shortHelpString = wxPyEmptyStr,
198 const wxString& longHelpString = wxPyEmptyStr,
199 int toggle = FALSE) {
200 return self->InsertTool(pos, id, bitmap, wxNullBitmap, toggle, NULL,
201 shortHelpString, longHelpString);
202 }
203 }
204
205
206 wxToolBarToolBase *AddControl(wxControl *control);
207 wxToolBarToolBase *InsertControl(size_t pos, wxControl *control);
208
209 wxToolBarToolBase *AddSeparator();
210 wxToolBarToolBase *InsertSeparator(size_t pos);
211
212 wxToolBarToolBase *RemoveTool(int id);
213
214 bool DeleteToolByPos(size_t pos);
215 bool DeleteTool(int id);
216 void ClearTools();
217 bool Realize();
218
219 void EnableTool(int id, bool enable);
220 void ToggleTool(int id, bool toggle);
221 void SetToggle(int id, bool toggle);
222
223
224 %addmethods {
225 // convert the ClientData back to a PyObject
226 PyObject* GetToolClientData(int index) {
227 wxPyUserData* udata = (wxPyUserData*)self->GetToolClientData(index);
228 if (udata) {
229 Py_INCREF(udata->m_obj);
230 return udata->m_obj;
231 } else {
232 Py_INCREF(Py_None);
233 return Py_None;
234 }
235 }
236
237 void SetToolClientData(int index, PyObject* clientData) {
238 self->SetToolClientData(index, new wxPyUserData(clientData));
239 }
240 }
241
242
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);
249
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();
257
258 void SetRows(int nRows);
259 void SetMaxRowsCols(int rows, int cols);
260 int GetMaxRows();
261 int GetMaxCols();
262
263 void SetToolBitmapSize(const wxSize& size);
264 wxSize GetToolBitmapSize();
265 wxSize GetToolSize();
266
267};
268
269
270
271
272class wxToolBar : public wxToolBarBase {
273public:
274 wxToolBar(wxWindow *parent,
275 wxWindowID id,
276 const wxPoint& pos = wxPyDefaultPosition,
277 const wxSize& size = wxPyDefaultSize,
278 long style = wxNO_BORDER | wxTB_HORIZONTAL,
8e425133 279 const char* name = wxToolBarNameStr);
9b3d3bc4
RD
280
281 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
282
283 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
284};
285
286
287
288
289class wxToolBarSimple : public wxToolBarBase {
290public:
291 wxToolBarSimple(wxWindow *parent,
292 wxWindowID id,
293 const wxPoint& pos = wxPyDefaultPosition,
294 const wxSize& size = wxPyDefaultSize,
295 long style = wxNO_BORDER | wxTB_HORIZONTAL,
8e425133 296 const char* name = wxToolBarNameStr);
9b3d3bc4
RD
297
298 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
299
300 wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y);
301};
302
303//---------------------------------------------------------------------------
304
305
306
307#ifdef THE_OLD_ONE
308
9c039d08
RD
309class wxToolBarTool {
310public:
311 wxToolBarTool();
312 ~wxToolBarTool();
9b3d3bc4
RD
313 void SetSize( long w, long h )
314 long GetWidth ();
315 long GetHeight ();
6999b0d8 316 wxControl *GetControl();
9c039d08
RD
317
318public:
319 int m_toolStyle;
320 wxObject * m_clientData;
321 int m_index;
322 long m_x;
323 long m_y;
324 long m_width;
325 long m_height;
326 bool m_toggleState;
327 bool m_isToggle;
328 bool m_deleteSecondBitmap;
329 bool m_enabled;
330 wxBitmap m_bitmap1;
331 wxBitmap m_bitmap2;
332 bool m_isMenuCommand;
333 wxString m_shortHelpString;
334 wxString m_longHelpString;
335};
336
337
338
b26e2dc4
RD
339// class wxToolBarBase : public wxControl {
340// public:
341
342class wxToolBar : public wxControl {
9c039d08 343public:
b26e2dc4
RD
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");
349
b8b8dda7 350 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08
RD
351
352
6999b0d8 353 bool AddControl(wxControl * control);
08127323 354 void AddSeparator();
6999b0d8 355 void ClearTools();
9c039d08
RD
356
357 // Ignoge the clientData for now...
358 %addmethods {
359 wxToolBarTool* AddTool(int toolIndex,
360 const wxBitmap& bitmap1,
361 const wxBitmap& bitmap2 = wxNullBitmap,
362 int isToggle = FALSE,
363 long xPos = -1,
364 long yPos = -1,
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);
371 }
08127323
RD
372
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,
378 FALSE, -1, -1, NULL,
379 shortHelpString, longHelpString);
380 }
9c039d08
RD
381 }
382
08127323 383
6999b0d8 384 void EnableTool(int toolIndex, bool enable);
5bff6bb8 385#ifdef __WXMSW__
6999b0d8 386 wxToolBarTool* FindToolForPosition(long x, long y);
9c039d08
RD
387 wxSize GetToolSize();
388 wxSize GetToolBitmapSize();
4f22cf8d 389 void SetToolBitmapSize(const wxSize& size);
9c039d08 390 wxSize GetMaxSize();
5bff6bb8
RD
391#endif
392 wxSize GetToolMargins();
9c039d08
RD
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);
400
9c039d08
RD
401
402 bool Realize();
08127323 403
9c039d08 404 void SetToolLongHelp(int toolIndex, const wxString& helpString);
9c039d08 405 void SetToolShortHelp(int toolIndex, const wxString& helpString);
b26e2dc4
RD
406 void SetMargins(const wxSize& size);
407 void SetToolPacking(int packing);
9c039d08
RD
408 void SetToolSeparation(int separation);
409 void ToggleTool(int toolIndex, const bool toggle);
6999b0d8 410 void SetToggle(int toolIndex, bool toggle);
6999b0d8
RD
411 void SetMaxRowsCols(int rows, int cols);
412 int GetMaxRows();
413 int GetMaxCols();
9c039d08
RD
414};
415
9b3d3bc4
RD
416
417#endif
418
9c039d08
RD
419//---------------------------------------------------------------------------
420