]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/spinctrl.h
Moved wxPGChoices m_choices member from various property classes to base wxPGProperty...
[wxWidgets.git] / interface / wx / spinctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: spinctrl.h
3 // Purpose: interface of wxSpinCtrl
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxSpinCtrl
11
12 wxSpinCtrl combines wxTextCtrl and
13 wxSpinButton in one control.
14
15 @beginStyleTable
16 @style{wxSP_ARROW_KEYS}
17 The user can use arrow keys to change the value.
18 @style{wxSP_WRAP}
19 The value wraps at the minimum and maximum.
20 @style{wxTE_PROCESS_ENTER}
21 Indicates that the control should generate wxEVT_COMMAND_TEXT_ENTER
22 events. Using this style will prevent the user from using the Enter key
23 for dialog navigation (e.g. activating the default button in the
24 dialog) under MSW.
25 @endStyleTable
26
27 @library{wxcore}
28 @category{ctrl}
29 <!-- @appearance{spinctrl.png} -->
30
31 @see wxSpinButton, wxSpinCtrlDouble, wxControl
32 */
33 class wxSpinCtrl : public wxControl
34 {
35 public:
36 /**
37 Default constructor.
38 */
39 wxSpinCtrl();
40
41 /**
42 Constructor, creating and showing a spin control.
43
44 @param parent
45 Parent window. Must not be @NULL.
46 @param value
47 Default value (as text).
48 @param id
49 Window identifier. The value wxID_ANY indicates a default value.
50 @param pos
51 Window position. If wxDefaultPosition is specified then a default
52 position is chosen.
53 @param size
54 Window size. If wxDefaultSize is specified then a default size
55 is chosen.
56 @param style
57 Window style. See wxSpinButton.
58 @param min
59 Minimal value.
60 @param max
61 Maximal value.
62 @param initial
63 Initial value.
64 @param name
65 Window name.
66
67 @see Create()
68 */
69 wxSpinCtrl(wxWindow* parent, wxWindowID id = -1,
70 const wxString& value = wxEmptyString,
71 const wxPoint& pos = wxDefaultPosition,
72 const wxSize& size = wxDefaultSize,
73 long style = wxSP_ARROW_KEYS,
74 int min = 0, int max = 100,
75 int initial = 0, const wxString& name = _T("wxSpinCtrl"));
76
77 /**
78 Creation function called by the spin control constructor.
79 See wxSpinCtrl() for details.
80 */
81 bool Create(wxWindow* parent, wxWindowID id = -1,
82 const wxString& value = wxEmptyString,
83 const wxPoint& pos = wxDefaultPosition,
84 const wxSize& size = wxDefaultSize,
85 long style = wxSP_ARROW_KEYS,
86 int min = 0, int max = 100,
87 int initial = 0, const wxString& name = _T("wxSpinCtrl"));
88
89 /**
90 Gets maximal allowable value.
91 */
92 int GetMax() const;
93
94 /**
95 Gets minimal allowable value.
96 */
97 int GetMin() const;
98
99 /**
100 Gets the value of the spin control.
101 */
102 int GetValue() const;
103
104 /**
105 Sets range of allowable values.
106 */
107 void SetRange(int minVal, int maxVal);
108
109 /**
110 Select the text in the text part of the control between positions
111 @a from (inclusive) and @a to (exclusive). This is similar to
112 wxTextCtrl::SetSelection.
113 @note this is currently only implemented for Windows and generic versions
114 of the control.
115 */
116 void SetSelection(long from, long to);
117
118 /**
119 Sets the value of the spin control. Use the variant using int instead.
120 */
121 void SetValue(const wxString& text);
122
123 /**
124 Sets the value of the spin control.
125 */
126 void SetValue(int value);
127 };
128