]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_spin.i
Updated wx.lib.calendar with many fixes and enhancements from Joerg
[wxWidgets.git] / wxPython / src / _spin.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _spin.i
3 // Purpose: SWIG interface defs for wxSpinButton and wxSpinCtrl
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 10-June-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17
18 MAKE_CONST_WXSTRING(SPIN_BUTTON_NAME);
19 MAKE_CONST_WXSTRING2(SpinCtrlNameStr, _T("wxSpinCtrl"));
20
21 //---------------------------------------------------------------------------
22 %newgroup
23
24
25 enum {
26 wxSP_HORIZONTAL,
27 wxSP_VERTICAL,
28 wxSP_ARROW_KEYS,
29 wxSP_WRAP
30 };
31
32
33 // The wxSpinButton is like a small scrollbar than is often placed next
34 // to a text control.
35 //
36 // Styles:
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 class wxSpinButton : public wxControl
42 {
43 public:
44 %pythonAppend wxSpinButton "self._setOORInfo(self)"
45 %pythonAppend wxSpinButton() ""
46
47 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = wxSP_HORIZONTAL,
51 const wxString& name = wxPySPIN_BUTTON_NAME);
52 %name(PreSpinButton)wxSpinButton();
53
54 bool Create(wxWindow* parent, wxWindowID id = -1,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 long style = wxSP_HORIZONTAL,
58 const wxString& name = wxPySPIN_BUTTON_NAME);
59
60 virtual int GetValue() const;
61 virtual int GetMin() const;
62 virtual int GetMax() const;
63
64 virtual void SetValue(int val);
65 virtual void SetMin(int minVal);
66 virtual void SetMax(int maxVal);
67 virtual void SetRange(int minVal, int maxVal);
68
69 // is this spin button vertically oriented?
70 bool IsVertical() const;
71 };
72
73
74 //---------------------------------------------------------------------------
75
76
77 // a spin ctrl is a text control with a spin button which is usually used to
78 // prompt the user for a numeric input
79
80 class wxSpinCtrl : public wxControl
81 {
82 public:
83 %pythonAppend wxSpinCtrl "self._setOORInfo(self)"
84 %pythonAppend wxSpinCtrl() ""
85
86 wxSpinCtrl(wxWindow *parent,
87 wxWindowID id = -1,
88 const wxString& value = wxPyEmptyString,
89 const wxPoint& pos = wxDefaultPosition,
90 const wxSize& size = wxDefaultSize,
91 long style = wxSP_ARROW_KEYS,
92 int min = 0, int max = 100, int initial = 0,
93 const wxString& name = wxPySpinCtrlNameStr);
94 %name(PreSpinCtrl)wxSpinCtrl();
95
96 bool Create(wxWindow *parent,
97 wxWindowID id = -1,
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
105 virtual int GetValue() const;
106 virtual void SetValue( int value );
107 %name(SetValueString) void SetValue(const wxString& text);
108
109 virtual void SetRange( int minVal, int maxVal );
110 virtual int GetMin() const;
111 virtual int GetMax() const;
112 void SetSelection(long from, long to);
113 };
114
115
116 //---------------------------------------------------------------------------
117
118 class wxSpinEvent : public wxNotifyEvent
119 {
120 public:
121 wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
122
123 // get the current value of the control
124 int GetPosition() const;
125 void SetPosition(int pos);
126 };
127
128
129 %constant wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED;
130
131
132 %pythoncode {
133 EVT_SPIN_UP = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEUP, 1)
134 EVT_SPIN_DOWN = wx.PyEventBinder( wx.wxEVT_SCROLL_LINEDOWN, 1)
135 EVT_SPIN = wx.PyEventBinder( wx.wxEVT_SCROLL_THUMBTRACK, 1)
136 EVT_SPINCTRL = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1)
137 }
138
139
140 //---------------------------------------------------------------------------