]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_spin.i
Tweaking names (Thanks Jeff!)
[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 %{
19 DECLARE_DEF_STRING(SPIN_BUTTON_NAME);
20 wxChar* wxSpinCtrlNameStr = _T("wxSpinCtrl");
21 DECLARE_DEF_STRING(SpinCtrlNameStr);
22 %}
23
24 //---------------------------------------------------------------------------
25 %newgroup
26
27
28 enum {
29 wxSP_HORIZONTAL,
30 wxSP_VERTICAL,
31 wxSP_ARROW_KEYS,
32 wxSP_WRAP
33 };
34
35
36 // The wxSpinButton is like a small scrollbar than is often placed next
37 // to a text control.
38 //
39 // Styles:
40 // wxSP_HORIZONTAL: horizontal spin button
41 // wxSP_VERTICAL: vertical spin button (the default)
42 // wxSP_ARROW_KEYS: arrow keys increment/decrement value
43 // wxSP_WRAP: value wraps at either end
44 class wxSpinButton : public wxControl
45 {
46 public:
47 %addtofunc wxSpinButton "self._setOORInfo(self)"
48 %addtofunc wxSpinButton() ""
49
50 wxSpinButton(wxWindow* parent, wxWindowID id = -1,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxSP_HORIZONTAL,
54 const wxString& name = wxPySPIN_BUTTON_NAME);
55 %name(PreSpinButton)wxSpinButton();
56
57 bool Create(wxWindow* parent, wxWindowID id = -1,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 long style = wxSP_HORIZONTAL,
61 const wxString& name = wxPySPIN_BUTTON_NAME);
62
63 virtual int GetValue() const;
64 virtual int GetMin() const;
65 virtual int GetMax() const;
66
67 virtual void SetValue(int val);
68 virtual void SetMin(int minVal);
69 virtual void SetMax(int maxVal);
70 virtual void SetRange(int minVal, int maxVal);
71
72 // is this spin button vertically oriented?
73 bool IsVertical() const;
74 };
75
76
77 //---------------------------------------------------------------------------
78
79
80 // a spin ctrl is a text control with a spin button which is usually used to
81 // prompt the user for a numeric input
82
83 class wxSpinCtrl : public wxControl
84 {
85 public:
86 %addtofunc wxSpinCtrl "self._setOORInfo(self)"
87 %addtofunc wxSpinCtrl() ""
88
89 wxSpinCtrl(wxWindow *parent,
90 wxWindowID id = -1,
91 const wxString& value = wxPyEmptyString,
92 const wxPoint& pos = wxDefaultPosition,
93 const wxSize& size = wxDefaultSize,
94 long style = wxSP_ARROW_KEYS,
95 int min = 0, int max = 100, int initial = 0,
96 const wxString& name = wxPySpinCtrlNameStr);
97 %name(PreSpinCtrl)wxSpinCtrl();
98
99 bool Create(wxWindow *parent,
100 wxWindowID id = -1,
101 const wxString& value = wxPyEmptyString,
102 const wxPoint& pos = wxDefaultPosition,
103 const wxSize& size = wxDefaultSize,
104 long style = wxSP_ARROW_KEYS,
105 int min = 0, int max = 100, int initial = 0,
106 const wxString& name = wxPySpinCtrlNameStr);
107
108 virtual int GetValue() const;
109 virtual void SetValue( int value );
110 %name(SetValueString) void SetValue(const wxString& text);
111
112 virtual void SetRange( int minVal, int maxVal );
113 virtual int GetMin() const;
114 virtual int GetMax() const;
115 #ifdef __WXGTK__
116 %extend {
117 void SetSelection(long from, long to) {
118 }
119 }
120 #else
121 void SetSelection(long from, long to);
122 #endif
123 };
124
125
126 %constant wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED;
127
128
129 %pythoncode {
130 EVT_SPINCTRL = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1)
131 }
132
133
134 //---------------------------------------------------------------------------