1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface defs for wxSpinButton and wxSpinCtrl
7 // Created: 10-June-1998
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
18 MAKE_CONST_WXSTRING(SPIN_BUTTON_NAME);
19 MAKE_CONST_WXSTRING2(SpinCtrlNameStr, _T("wxSpinCtrl"));
21 //---------------------------------------------------------------------------
33 // The wxSpinButton is like a small scrollbar than is often placed next
37 // wxSP_HORIZONTAL: horizontal spin button
38 // wxSP_VERTICAL: vertical spin button (the default)
39 // wxSP_ARROW_KEYS: arrow keys increment/decrement value
40 // wxSP_WRAP: value wraps at either end
41 MustHaveApp(wxSpinButton);
42 class wxSpinButton : public wxControl
45 %pythonAppend wxSpinButton "self._setOORInfo(self)"
46 %pythonAppend wxSpinButton() ""
48 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 long style = wxSP_HORIZONTAL,
52 const wxString& name = wxPySPIN_BUTTON_NAME);
53 %RenameCtor(PreSpinButton, wxSpinButton());
55 bool Create(wxWindow* parent, wxWindowID id = -1,
56 const wxPoint& pos = wxDefaultPosition,
57 const wxSize& size = wxDefaultSize,
58 long style = wxSP_HORIZONTAL,
59 const wxString& name = wxPySPIN_BUTTON_NAME);
61 virtual int GetValue() const;
62 virtual int GetMin() const;
63 virtual int GetMax() const;
65 virtual void SetValue(int val);
66 virtual void SetMin(int minVal);
67 virtual void SetMax(int maxVal);
68 virtual void SetRange(int minVal, int maxVal);
70 // is this spin button vertically oriented?
71 bool IsVertical() const;
73 static wxVisualAttributes
74 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
76 %property(Max, GetMax, SetMax, doc="See `GetMax` and `SetMax`");
77 %property(Min, GetMin, SetMin, doc="See `GetMin` and `SetMin`");
78 %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
82 //---------------------------------------------------------------------------
85 // a spin ctrl is a text control with a spin button which is usually used to
86 // prompt the user for a numeric input
88 MustHaveApp(wxSpinCtrl);
90 class wxSpinCtrl : public wxControl
93 %pythonAppend wxSpinCtrl "self._setOORInfo(self)"
94 %pythonAppend wxSpinCtrl() ""
96 wxSpinCtrl(wxWindow *parent,
98 const wxString& value = wxPyEmptyString,
99 const wxPoint& pos = wxDefaultPosition,
100 const wxSize& size = wxDefaultSize,
101 long style = wxSP_ARROW_KEYS,
102 int min = 0, int max = 100, int initial = 0,
103 const wxString& name = wxPySpinCtrlNameStr);
104 %RenameCtor(PreSpinCtrl, wxSpinCtrl());
106 bool Create(wxWindow *parent,
108 const wxString& value = wxPyEmptyString,
109 const wxPoint& pos = wxDefaultPosition,
110 const wxSize& size = wxDefaultSize,
111 long style = wxSP_ARROW_KEYS,
112 int min = 0, int max = 100, int initial = 0,
113 const wxString& name = wxPySpinCtrlNameStr);
115 virtual int GetValue() const;
116 virtual void SetValue( int value );
117 %Rename(SetValueString, void, SetValue(const wxString& text));
119 virtual void SetRange( int minVal, int maxVal );
120 virtual int GetMin() const;
121 virtual int GetMax() const;
122 void SetSelection(long from, long to);
124 static wxVisualAttributes
125 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
127 %property(Max, GetMax, doc="See `GetMax`");
128 %property(Min, GetMin, doc="See `GetMin`");
129 %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
133 //---------------------------------------------------------------------------
135 class wxSpinEvent : public wxNotifyEvent
138 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
140 // get the current value of the control
141 int GetPosition() const;
142 void SetPosition(int pos);
144 %property(Position, GetPosition, SetPosition, doc="See `GetPosition` and `SetPosition`");
148 %constant wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED;
152 EVT_SPIN_UP = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEUP, 1)
153 EVT_SPIN_DOWN = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEDOWN, 1)
154 EVT_SPIN = wx.PyEventBinder( wx.wxEVT_SCROLL_THUMBTRACK, 1)
155 EVT_SPINCTRL = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1)
159 //---------------------------------------------------------------------------