1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Control (widget) classes for wxPython
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
17 #include <wx/slider.h>
20 #include <wx/spinbutt.h>
24 //----------------------------------------------------------------------
27 %include my_typemaps.i
29 // Import some definitions of other classes, etc.
36 //----------------------------------------------------------------------
39 wxValidator wxPyDefaultValidator; // Non-const default because of SWIG
42 //----------------------------------------------------------------------
44 class wxControl : public wxWindow {
46 void Command(wxCommandEvent& event);
48 void SetLabel(const wxString& label);
51 //----------------------------------------------------------------------
53 class wxButton : public wxControl {
55 wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
56 const wxPoint& pos = wxPyDefaultPosition,
57 const wxSize& size = wxPyDefaultSize,
59 const wxValidator& validator = wxPyDefaultValidator,
60 char* name = "button");
64 //----------------------------------------------------------------------
66 class wxBitmapButton : public wxButton {
68 wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
69 const wxPoint& pos = wxPyDefaultPosition,
70 const wxSize& size = wxPyDefaultSize,
71 long style = wxBU_AUTODRAW,
72 const wxValidator& validator = wxPyDefaultValidator,
73 char* name = "button");
75 wxBitmap& GetBitmapLabel();
77 wxBitmap& GetBitmapDisabled();
78 wxBitmap& GetBitmapFocus();
79 wxBitmap& GetBitmapSelected();
80 void SetBitmapDisabled(const wxBitmap& bitmap);
81 void SetBitmapFocus(const wxBitmap& bitmap);
82 void SetBitmapSelected(const wxBitmap& bitmap);
84 void SetBitmapLabel(const wxBitmap& bitmap);
88 //----------------------------------------------------------------------
90 class wxCheckBox : public wxControl {
92 wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
93 const wxPoint& pos = wxPyDefaultPosition,
94 const wxSize& size = wxPyDefaultSize,
96 const wxValidator& val = wxPyDefaultValidator,
97 char* name = "checkBox");
100 void SetValue(const bool state);
103 //----------------------------------------------------------------------
105 class wxChoice : public wxControl {
107 wxChoice(wxWindow *parent, wxWindowID id,
108 const wxPoint& pos = wxPyDefaultPosition,
109 const wxSize& size = wxPyDefaultSize,
110 int LCOUNT=0, wxString* LIST=NULL,
112 const wxValidator& validator = wxPyDefaultValidator,
113 char* name = "choice");
115 void Append(const wxString& item);
117 int FindString(const wxString& string);
120 wxString GetString(const int n);
121 wxString GetStringSelection();
123 void SetColumns(const int n = 1);
124 void SetSelection(const int n);
125 void SetStringSelection(const wxString& string);
128 //----------------------------------------------------------------------
130 class wxComboBox : public wxControl {
132 wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
133 const wxPoint& pos = wxPyDefaultPosition,
134 const wxSize& size = wxPyDefaultSize,
135 int LCOUNT=0, wxString* LIST=NULL,
137 const wxValidator& validator = wxPyDefaultValidator,
138 char* name = "comboBox");
140 void Append(const wxString& item);
141 // TODO: void Append(const wxString& item, char* clientData);
146 // NotMember??: void Deselect(int n);
147 int FindString(const wxString& string);
148 // TODO: char* GetClientData(const int n);
149 long GetInsertionPoint();
150 long GetLastPosition();
152 wxString GetString(int n);
153 wxString GetStringSelection();
157 void Replace(long from, long to, const wxString& text);
158 void Remove(long from, long to);
159 // TODO: void SetClientData(const int n, char* data);
160 void SetInsertionPoint(long pos);
161 void SetInsertionPointEnd();
162 void SetSelection(int n, bool select = TRUE);
163 %name(SetMark)void SetSelection(long from, long to);
164 void SetValue(const wxString& text);
167 //----------------------------------------------------------------------
169 class wxGauge : public wxControl {
171 wxGauge(wxWindow* parent, wxWindowID id, int range,
172 const wxPoint& pos = wxPyDefaultPosition,
173 const wxSize& size = wxPyDefaultSize,
174 long style = wxGA_HORIZONTAL,
175 const wxValidator& validator = wxPyDefaultValidator,
176 char* name = "gauge");
180 int GetShadowWidth();
182 void SetBezelFace(int width);
183 void SetRange(int range);
184 void SetShadowWidth(int width);
185 void SetValue(int pos);
188 //----------------------------------------------------------------------
190 class wxStaticBox : public wxControl {
192 wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label,
193 const wxPoint& pos = wxPyDefaultPosition,
194 const wxSize& size = wxPyDefaultSize,
196 char* name = "staticBox");
200 //----------------------------------------------------------------------
202 class wxStaticText : public wxControl {
204 wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
205 const wxPoint& pos = wxPyDefaultPosition,
206 const wxSize& size = wxPyDefaultSize,
208 char* name = "staticText");
211 void SetLabel(const wxString& label);
214 //----------------------------------------------------------------------
216 class wxListBox : public wxControl {
218 wxListBox(wxWindow* parent, wxWindowID id,
219 const wxPoint& pos = wxPyDefaultPosition,
220 const wxSize& size = wxPyDefaultSize,
221 int LCOUNT, wxString* LIST = NULL,
223 const wxValidator& validator = wxPyDefaultValidator,
224 char* name = "listBox");
226 void Append(const wxString& item);
227 // TODO: void Append(const wxString& item, char* clientData);
230 void Deselect(int n);
231 int FindString(const wxString& string);
232 // TODO: char* GetClientData(const int n);
234 // TODO: int GetSelections(int **selections);
235 wxString GetString(int n);
236 wxString GetStringSelection();
238 bool Selected(const int n);
239 void Set(int LCOUNT, wxString* LIST);
240 // TODO: void SetClientData(const int n, char* data);
241 void SetFirstItem(int n);
242 %name(SetFirstItemStr)void SetFirstItem(const wxString& string);
243 void SetSelection(int n, bool select = TRUE);
244 void SetString(int n, const wxString& string);
245 void SetStringSelection(const wxString& string, bool select = TRUE);
249 //----------------------------------------------------------------------
251 class wxTextCtrl : public wxControl {
253 wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "",
254 const wxPoint& pos = wxPyDefaultPosition,
255 const wxSize& size = wxPyDefaultSize,
257 const wxValidator& validator = wxPyDefaultValidator,
258 char* name = "text");
264 long GetInsertionPoint();
265 long GetLastPosition();
267 int GetLineLength(long lineNo);
268 wxString GetLineText(long lineNo);
269 int GetNumberOfLines();
273 bool LoadFile(const wxString& filename);
276 void PositionToXY(long pos, long *OUTPUT, long *OUTPUT);
278 void Remove(long from, long to);
279 void Replace(long from, long to, const wxString& value);
280 bool SaveFile(const wxString& filename);
281 void SetEditable(bool editable);
282 void SetInsertionPoint(long pos);
283 void SetInsertionPointEnd();
284 void SetSelection(long from, long to);
285 void SetValue(const wxString& value);
286 void ShowPosition(long pos);
287 void WriteText(const wxString& text);
289 long XYToPosition(long x, long y);
293 //----------------------------------------------------------------------
295 class wxScrollBar : public wxControl {
297 wxScrollBar(wxWindow* parent, wxWindowID id = -1,
298 const wxPoint& pos = wxPyDefaultPosition,
299 const wxSize& size = wxPyDefaultSize,
300 long style = wxSB_HORIZONTAL,
301 const wxValidator& validator = wxPyDefaultValidator,
302 char* name = "scrollBar");
308 void SetPosition(int viewStart);
309 void SetScrollbar(int position, int thumbSize,
310 int range, int pageSize,
311 bool refresh = TRUE);
314 //----------------------------------------------------------------------
317 class wxSpinButton : public wxControl {
319 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
320 const wxPoint& pos = wxPyDefaultPosition,
321 const wxSize& size = wxPyDefaultSize,
322 long style = wxSP_HORIZONTAL,
323 char* name = "spinButton");
328 void SetRange(int min, int max);
329 void SetValue(int value);
333 //----------------------------------------------------------------------
335 class wxStaticBitmap : public wxControl {
337 wxStaticBitmap(wxWindow* parent, wxWindowID id,
338 const wxBitmap& bitmap,
339 const wxPoint& pos = wxPyDefaultPosition,
340 const wxSize& size = wxPyDefaultSize,
342 char* name = "staticBitmap");
344 wxBitmap& GetBitmap();
345 void SetBitmap(const wxBitmap& bitmap);
348 //----------------------------------------------------------------------
350 class wxRadioBox : public wxControl {
352 wxRadioBox(wxWindow* parent, wxWindowID id,
353 const wxString& label,
354 const wxPoint& point = wxPyDefaultPosition,
355 const wxSize& size = wxPyDefaultSize,
356 int LCOUNT = 0, wxString* LIST = NULL,
357 int majorDimension = 0,
358 long style = wxRA_HORIZONTAL,
359 const wxValidator& validator = wxPyDefaultValidator,
360 char* name = "radioBox");
362 %name(EnableBox)void Enable(bool enable);
363 void Enable(int n, bool enable);
364 int FindString(const wxString& string);
365 %name(GetBoxLabel)wxString GetLabel();
366 wxString GetLabel(int n);
368 wxString GetString(int n);
369 wxString GetStringSelection();
371 %name(SetBoxLabel)void SetLabel(const wxString& label);
372 void SetLabel(int n, const wxString& label);
373 void SetSelection(int n);
374 void SetStringSelection(const wxString& string);
375 void Show(bool show);
376 %name(ShowItem)void Show(int item, bool show);
379 //----------------------------------------------------------------------
381 class wxRadioButton : public wxControl {
383 wxRadioButton(wxWindow* parent, wxWindowID id,
384 const wxString& label,
385 const wxPoint& pos = wxPyDefaultPosition,
386 const wxSize& size = wxPyDefaultSize,
388 const wxValidator& validator = wxPyDefaultValidator,
389 char* name = "radioButton");
392 void SetValue(bool value);
395 //----------------------------------------------------------------------
397 class wxSlider : public wxControl {
399 wxSlider(wxWindow* parent, wxWindowID id,
400 int value, int minValue, int maxValue,
401 const wxPoint& point = wxPyDefaultPosition,
402 const wxSize& size = wxPyDefaultSize,
403 long style = wxSL_HORIZONTAL,
404 const wxValidator& validator = wxPyDefaultValidator,
405 char* name = "slider");
415 int GetThumbLength();
418 void SetRange(int minValue, int maxValue);
419 void SetTickFreq(int n, int pos);
420 void SetLineSize(int lineSize);
421 void SetPageSize(int pageSize);
422 void SetSelection(int startPos, int endPos);
423 void SetThumbLength(int len);
424 void SetTick(int tickPos);
425 void SetValue(int value);
429 //----------------------------------------------------------------------
432 /////////////////////////////////////////////////////////////////////////////
435 // Revision 1.3 1998/08/18 19:48:14 RD
436 // more wxGTK compatibility things.
438 // It builds now but there are serious runtime problems...
440 // Revision 1.2 1998/08/15 07:36:28 RD
441 // - Moved the header in the .i files out of the code that gets put into
442 // the .cpp files. It caused CVS conflicts because of the RCS ID being
443 // different each time.
445 // - A few minor fixes.
447 // Revision 1.1 1998/08/09 08:25:49 RD