]>
Commit | Line | Data |
---|---|---|
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 | @wxheader{spinctrl.h} | |
12 | ||
13 | wxSpinCtrl combines wxTextCtrl and | |
14 | wxSpinButton in one control. | |
15 | ||
16 | @beginStyleTable | |
17 | @style{wxSP_ARROW_KEYS}: | |
18 | The user can use arrow keys to change the value. | |
19 | @style{wxSP_WRAP}: | |
20 | The value wraps at the minimum and maximum. | |
21 | @endStyleTable | |
22 | ||
23 | @library{wxcore} | |
24 | @category{ctrl} | |
25 | @appearance{spinctrl.png} | |
26 | ||
27 | @see @ref overview_eventhandlingoverview, wxSpinButton, wxControl | |
28 | */ | |
29 | class wxSpinCtrl : public wxControl | |
30 | { | |
31 | public: | |
32 | //@{ | |
33 | /** | |
34 | ) | |
35 | Constructor, creating and showing a spin control. | |
36 | ||
37 | @param parent | |
38 | Parent window. Must not be @NULL. | |
39 | @param value | |
40 | Default value. | |
41 | @param id | |
42 | Window identifier. The value wxID_ANY indicates a default value. | |
43 | @param pos | |
44 | Window position. If wxDefaultPosition is specified then a default | |
45 | position is chosen. | |
46 | @param size | |
47 | Window size. If wxDefaultSize is specified then a default size | |
48 | is chosen. | |
49 | @param style | |
50 | Window style. See wxSpinButton. | |
51 | @param min | |
52 | Minimal value. | |
53 | @param max | |
54 | Maximal value. | |
55 | @param initial | |
56 | Initial value. | |
57 | @param name | |
58 | Window name. | |
59 | ||
60 | @see Create() | |
61 | */ | |
62 | wxSpinCtrl(); | |
63 | wxSpinCtrl(wxWindow* parent, wxWindowID id = -1, | |
64 | const wxString& value = wxEmptyString, | |
65 | const wxPoint& pos = wxDefaultPosition, | |
66 | const wxSize& size = wxDefaultSize, | |
67 | long style = wxSP_ARROW_KEYS, | |
68 | int min = 0, int max = 100, | |
69 | int initial = 0); | |
70 | //@} | |
71 | ||
72 | /** | |
73 | ) | |
74 | Creation function called by the spin control constructor. | |
75 | See wxSpinCtrl() for details. | |
76 | */ | |
77 | bool Create(wxWindow* parent, wxWindowID id = -1, | |
78 | const wxString& value = wxEmptyString, | |
79 | const wxPoint& pos = wxDefaultPosition, | |
80 | const wxSize& size = wxDefaultSize, | |
81 | long style = wxSP_ARROW_KEYS, | |
82 | int min = 0, int max = 100, | |
83 | int initial = 0); | |
84 | ||
85 | /** | |
86 | Gets maximal allowable value. | |
87 | */ | |
88 | int GetMax() const; | |
89 | ||
90 | /** | |
91 | Gets minimal allowable value. | |
92 | */ | |
93 | int GetMin() const; | |
94 | ||
95 | /** | |
96 | Gets the value of the spin control. | |
97 | */ | |
98 | int GetValue() const; | |
99 | ||
100 | /** | |
101 | Sets range of allowable values. | |
102 | */ | |
103 | void SetRange(int minVal, int maxVal); | |
104 | ||
105 | /** | |
106 | Select the text in the text part of the control between positions | |
107 | @a from (inclusive) and @a to (exclusive). This is similar to | |
108 | wxTextCtrl::SetSelection. | |
109 | @b NB: this is currently only implemented for Windows and generic versions | |
110 | of the control. | |
111 | */ | |
112 | void SetSelection(long from, long to); | |
113 | ||
114 | //@{ | |
115 | /** | |
116 | Sets the value of the spin control. | |
117 | */ | |
118 | void SetValue(const wxString& text); | |
119 | void SetValue(int value); | |
120 | //@} | |
121 | }; | |
122 |