3 /////////////////////////////////////////////////////////////////////////////
5 // Purpose: Control (widget) classes for wxPython
11 // Copyright: (c) 1998 by Total Control Software
12 // Licence: wxWindows license
13 /////////////////////////////////////////////////////////////////////////////
17 #include <wx/slider.h>
18 #include <wx/spinbutt.h>
21 //----------------------------------------------------------------------
24 %include my_typemaps.i
26 // Import some definitions of other classes, etc.
33 //----------------------------------------------------------------------
36 wxValidator wxPyDefaultValidator; // Non-const default because of SWIG
39 //----------------------------------------------------------------------
41 class wxControl : public wxWindow {
43 void Command(wxCommandEvent& event);
45 void SetLabel(const wxString& label);
48 //----------------------------------------------------------------------
50 class wxButton : public wxControl {
52 wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
53 const wxPoint& pos = wxPyDefaultPosition,
54 const wxSize& size = wxPyDefaultSize,
56 const wxValidator& validator = wxPyDefaultValidator,
57 char* name = "button");
61 //----------------------------------------------------------------------
63 class wxBitmapButton : public wxButton {
65 wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
66 const wxPoint& pos = wxPyDefaultPosition,
67 const wxSize& size = wxPyDefaultSize,
68 long style = wxBU_AUTODRAW,
69 const wxValidator& validator = wxPyDefaultValidator,
70 char* name = "button");
72 wxBitmap& GetBitmapDisabled();
73 wxBitmap& GetBitmapFocus();
74 wxBitmap& GetBitmapLabel();
75 wxBitmap& GetBitmapSelected();
76 void SetBitmapDisabled(const wxBitmap& bitmap);
77 void SetBitmapFocus(const wxBitmap& bitmap);
78 void SetBitmapLabel(const wxBitmap& bitmap);
79 void SetBitmapSelected(const wxBitmap& bitmap);
83 //----------------------------------------------------------------------
85 class wxCheckBox : public wxControl {
87 wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
88 const wxPoint& pos = wxPyDefaultPosition,
89 const wxSize& size = wxPyDefaultSize,
91 const wxValidator& val = wxPyDefaultValidator,
92 char* name = "checkBox");
95 void SetValue(const bool state);
98 //----------------------------------------------------------------------
100 class wxChoice : public wxControl {
102 wxChoice(wxWindow *parent, wxWindowID id,
103 const wxPoint& pos = wxPyDefaultPosition,
104 const wxSize& size = wxPyDefaultSize,
105 int LCOUNT=0, wxString* LIST=NULL,
107 const wxValidator& validator = wxPyDefaultValidator,
108 char* name = "choice");
110 void Append(const wxString& item);
112 int FindString(const wxString& string);
115 wxString GetString(const int n);
116 wxString GetStringSelection();
118 void SetColumns(const int n = 1);
119 void SetSelection(const int n);
120 void SetStringSelection(const wxString& string);
123 //----------------------------------------------------------------------
125 class wxComboBox : public wxControl {
127 wxComboBox(wxWindow* parent, wxWindowID id, char* value = "",
128 const wxPoint& pos = wxPyDefaultPosition,
129 const wxSize& size = wxPyDefaultSize,
130 int LCOUNT=0, wxString* LIST=NULL,
132 const wxValidator& validator = wxPyDefaultValidator,
133 char* name = "comboBox");
135 void Append(const wxString& item);
136 // TODO: void Append(const wxString& item, char* clientData);
141 // NotMember??: void Deselect(int n);
142 int FindString(const wxString& string);
143 // TODO: char* GetClientData(const int n);
144 long GetInsertionPoint();
145 long GetLastPosition();
147 wxString GetString(int n);
148 wxString GetStringSelection();
152 void Replace(long from, long to, const wxString& text);
153 void Remove(long from, long to);
154 // TODO: void SetClientData(const int n, char* data);
155 void SetInsertionPoint(long pos);
156 void SetInsertionPointEnd();
157 void SetSelection(int n, bool select = TRUE);
158 %name(SetMark)void SetSelection(long from, long to);
159 void SetValue(const wxString& text);
162 //----------------------------------------------------------------------
164 class wxGauge : public wxControl {
166 wxGauge(wxWindow* parent, wxWindowID id, int range,
167 const wxPoint& pos = wxPyDefaultPosition,
168 const wxSize& size = wxPyDefaultSize,
169 long style = wxGA_HORIZONTAL,
170 const wxValidator& validator = wxPyDefaultValidator,
171 char* name = "gauge");
175 int GetShadowWidth();
177 void SetBezelFace(int width);
178 void SetRange(int range);
179 void SetShadowWidth(int width);
180 void SetValue(int pos);
183 //----------------------------------------------------------------------
185 class wxStaticBox : public wxControl {
187 wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label,
188 const wxPoint& pos = wxPyDefaultPosition,
189 const wxSize& size = wxPyDefaultSize,
191 char* name = "staticBox");
195 //----------------------------------------------------------------------
197 class wxStaticText : public wxControl {
199 wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
200 const wxPoint& pos = wxPyDefaultPosition,
201 const wxSize& size = wxPyDefaultSize,
203 char* name = "staticText");
206 void SetLabel(const wxString& label);
209 //----------------------------------------------------------------------
211 class wxListBox : public wxControl {
213 wxListBox(wxWindow* parent, wxWindowID id,
214 const wxPoint& pos = wxPyDefaultPosition,
215 const wxSize& size = wxPyDefaultSize,
216 int LCOUNT, wxString* LIST = NULL,
218 const wxValidator& validator = wxPyDefaultValidator,
219 char* name = "listBox");
221 void Append(const wxString& item);
222 // TODO: void Append(const wxString& item, char* clientData);
225 void Deselect(int n);
226 int FindString(const wxString& string);
227 // TODO: char* GetClientData(const int n);
229 // TODO: int GetSelections(int **selections);
230 wxString GetString(int n);
231 wxString GetStringSelection();
233 bool Selected(const int n);
234 void Set(int LCOUNT, wxString* LIST);
235 // TODO: void SetClientData(const int n, char* data);
236 void SetFirstItem(int n);
237 %name(SetFirstItemStr)void SetFirstItem(const wxString& string);
238 void SetSelection(int n, bool select = TRUE);
239 void SetString(int n, const wxString& string);
240 void SetStringSelection(const wxString& string, bool select = TRUE);
244 //----------------------------------------------------------------------
246 class wxTextCtrl : public wxControl {
248 wxTextCtrl(wxWindow* parent, wxWindowID id, char* value = "",
249 const wxPoint& pos = wxPyDefaultPosition,
250 const wxSize& size = wxPyDefaultSize,
252 const wxValidator& validator = wxPyDefaultValidator,
253 char* name = "text");
259 long GetInsertionPoint();
260 long GetLastPosition();
261 int GetLineLength(long lineNo);
262 wxString GetLineText(long lineNo);
263 int GetNumberOfLines();
266 bool LoadFile(const wxString& filename);
268 void PositionToXY(long pos, long *OUTPUT, long *OUTPUT);
269 void Remove(long from, long to);
270 void Replace(long from, long to, const wxString& value);
271 bool SaveFile(const wxString& filename);
272 void SetEditable(bool editable);
273 void SetInsertionPoint(long pos);
274 void SetInsertionPointEnd();
275 void SetSelection(long from, long to);
276 void SetValue(const wxString& value);
277 void ShowPosition(long pos);
278 void WriteText(const wxString& text);
279 long XYToPosition(long x, long y);
282 //----------------------------------------------------------------------
284 class wxScrollBar : public wxControl {
286 wxScrollBar(wxWindow* parent, wxWindowID id = -1,
287 const wxPoint& pos = wxPyDefaultPosition,
288 const wxSize& size = wxPyDefaultSize,
289 long style = wxSB_HORIZONTAL,
290 const wxValidator& validator = wxPyDefaultValidator,
291 char* name = "scrollBar");
297 void SetPosition(int viewStart);
298 void SetScrollbar(int position, int thumbSize,
299 int range, int pageSize,
300 bool refresh = TRUE);
303 //----------------------------------------------------------------------
305 class wxSpinButton : public wxControl {
307 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
308 const wxPoint& pos = wxPyDefaultPosition,
309 const wxSize& size = wxPyDefaultSize,
310 long style = wxSP_HORIZONTAL,
311 char* name = "spinButton");
316 void SetRange(int min, int max);
317 void SetValue(int value);
320 //----------------------------------------------------------------------
322 class wxStaticBitmap : public wxControl {
324 wxStaticBitmap(wxWindow* parent, wxWindowID id,
325 const wxBitmap& bitmap,
326 const wxPoint& pos = wxPyDefaultPosition,
327 const wxSize& size = wxPyDefaultSize,
329 char* name = "staticBitmap");
331 wxBitmap& GetBitmap();
332 void SetBitmap(const wxBitmap& bitmap);
335 //----------------------------------------------------------------------
337 class wxRadioBox : public wxControl {
339 wxRadioBox(wxWindow* parent, wxWindowID id,
340 const wxString& label,
341 const wxPoint& point = wxPyDefaultPosition,
342 const wxSize& size = wxPyDefaultSize,
343 int LCOUNT = 0, wxString* LIST = NULL,
344 int majorDimension = 0,
345 long style = wxRA_HORIZONTAL,
346 const wxValidator& validator = wxPyDefaultValidator,
347 char* name = "radioBox");
349 %name(EnableBox)void Enable(bool enable);
350 void Enable(int n, bool enable);
351 int FindString(const wxString& string);
352 %name(GetBoxLabel)wxString GetLabel();
353 wxString GetLabel(int n);
355 wxString GetString(int n);
356 wxString GetStringSelection();
358 %name(SetBoxLabel)void SetLabel(const wxString& label);
359 void SetLabel(int n, const wxString& label);
360 void SetSelection(int n);
361 void SetStringSelection(const wxString& string);
362 void Show(bool show);
363 %name(ShowItem)void Show(int item, bool show);
366 //----------------------------------------------------------------------
368 class wxRadioButton : public wxControl {
370 wxRadioButton(wxWindow* parent, wxWindowID id,
371 const wxString& label,
372 const wxPoint& pos = wxPyDefaultPosition,
373 const wxSize& size = wxPyDefaultSize,
375 const wxValidator& validator = wxPyDefaultValidator,
376 char* name = "radioButton");
379 void SetValue(bool value);
382 //----------------------------------------------------------------------
384 class wxSlider : public wxControl {
386 wxSlider(wxWindow* parent, wxWindowID id,
387 int value, int minValue, int maxValue,
388 const wxPoint& point = wxPyDefaultPosition,
389 const wxSize& size = wxPyDefaultSize,
390 long style = wxSL_HORIZONTAL,
391 const wxValidator& validator = wxPyDefaultValidator,
392 char* name = "slider");
402 int GetThumbLength();
405 void SetRange(int minValue, int maxValue);
406 void SetTickFreq(int n, int pos);
407 void SetLineSize(int lineSize);
408 void SetPageSize(int pageSize);
409 void SetSelection(int startPos, int endPos);
410 void SetThumbLength(int len);
411 void SetTick(int tickPos);
412 void SetValue(int value);
416 //----------------------------------------------------------------------
419 /////////////////////////////////////////////////////////////////////////////
422 // Revision 1.1 1998/08/09 08:25:49 RD