]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: valgen.h | |
e54c96f1 | 3 | // Purpose: interface of wxGenericValidator |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | /** | |
9 | @class wxGenericValidator | |
7c913512 | 10 | |
fbec75d0 | 11 | wxGenericValidator performs data transfer (but not validation or filtering) |
52f2299c | 12 | for many type of controls. |
fbec75d0 | 13 | |
52f2299c FM |
14 | wxGenericValidator supports: |
15 | - wxButton, wxRadioButton, wxToggleButton, wxBitmapToggleButton, wxSpinButton | |
16 | - wxCheckBox, wxRadioBox, wxComboBox, wxListBox, wxCheckListBox | |
17 | - wxGauge, wxSlider, wxScrollBar, wxChoice, wxStaticText | |
18 | - wxSpinCtrl, wxTextCtrl | |
19 | ||
20 | It checks the type of the window and uses an appropriate type for it. | |
21 | For example, wxButton and wxTextCtrl transfer data to and from a | |
22 | wxString variable; wxListBox uses a wxArrayInt; wxCheckBox uses a boolean. | |
fbec75d0 BP |
23 | |
24 | For more information, please see @ref overview_validator. | |
7c913512 | 25 | |
23324ae1 FM |
26 | @library{wxcore} |
27 | @category{validator} | |
7c913512 | 28 | |
a54cf371 VZ |
29 | @see @ref overview_validator, wxValidator, wxTextValidator, |
30 | wxIntegerValidator, wxFloatingPointValidator | |
23324ae1 FM |
31 | */ |
32 | class wxGenericValidator : public wxValidator | |
33 | { | |
34 | public: | |
23324ae1 | 35 | /** |
fbec75d0 | 36 | Copy constructor. |
3c4f71cc | 37 | |
7c913512 | 38 | @param validator |
4cc4bfaf | 39 | Validator to copy. |
fbec75d0 BP |
40 | */ |
41 | wxGenericValidator(const wxGenericValidator& validator); | |
42 | /** | |
43 | Constructor taking a bool pointer. This will be used for wxCheckBox, | |
44 | wxRadioButton, wxToggleButton and wxBitmapToggleButton. | |
45 | ||
7c913512 | 46 | @param valPtr |
4cc4bfaf | 47 | A pointer to a variable that contains the value. This variable |
fbec75d0 BP |
48 | should have a lifetime equal to or longer than the validator |
49 | lifetime (which is usually determined by the lifetime of the | |
50 | window). | |
23324ae1 | 51 | */ |
7c913512 | 52 | wxGenericValidator(bool* valPtr); |
fbec75d0 BP |
53 | /** |
54 | Constructor taking a wxString pointer. This will be used for wxButton, | |
55 | wxComboBox, wxStaticText, wxTextCtrl. | |
56 | ||
57 | @param valPtr | |
58 | A pointer to a variable that contains the value. This variable | |
59 | should have a lifetime equal to or longer than the validator | |
60 | lifetime (which is usually determined by the lifetime of the | |
61 | window). | |
62 | */ | |
7c913512 | 63 | wxGenericValidator(wxString* valPtr); |
fbec75d0 BP |
64 | /** |
65 | Constructor taking an integer pointer. This will be used for wxChoice, | |
66 | wxGauge, wxScrollBar, wxRadioBox, wxSlider, wxSpinButton and | |
67 | wxSpinCtrl. | |
68 | ||
69 | @param valPtr | |
70 | A pointer to a variable that contains the value. This variable | |
71 | should have a lifetime equal to or longer than the validator | |
72 | lifetime (which is usually determined by the lifetime of the | |
73 | window). | |
74 | */ | |
7c913512 | 75 | wxGenericValidator(int* valPtr); |
fbec75d0 BP |
76 | /** |
77 | Constructor taking a wxArrayInt pointer. This will be used for | |
78 | wxListBox, wxCheckListBox. | |
79 | ||
80 | @param valPtr | |
81 | A pointer to a variable that contains the value. This variable | |
82 | should have a lifetime equal to or longer than the validator | |
83 | lifetime (which is usually determined by the lifetime of the | |
84 | window). | |
85 | */ | |
7c913512 | 86 | wxGenericValidator(wxArrayInt* valPtr); |
fbec75d0 BP |
87 | /** |
88 | Constructor taking a wxDateTime pointer. This will be used for | |
89 | wxDatePickerCtrl. | |
90 | ||
91 | @param valPtr | |
92 | A pointer to a variable that contains the value. This variable | |
93 | should have a lifetime equal to or longer than the validator | |
94 | lifetime (which is usually determined by the lifetime of the | |
95 | window). | |
96 | */ | |
7c913512 | 97 | wxGenericValidator(wxDateTime* valPtr); |
e96be167 VZ |
98 | /** |
99 | Constructor taking a wxFileName pointer. This will be used for | |
100 | wxTextCtrl. | |
101 | ||
102 | @param valPtr | |
103 | A pointer to a variable that contains the value. This variable | |
104 | should have a lifetime equal to or longer than the validator | |
105 | lifetime (which is usually determined by the lifetime of the | |
106 | window). | |
107 | @since 2.9.3 | |
108 | */ | |
109 | wxGenericValidator(wxFileName* valPtr); | |
110 | /** | |
111 | Constructor taking a float pointer. This will be used for | |
112 | wxTextCtrl. | |
113 | ||
114 | @param valPtr | |
115 | A pointer to a variable that contains the value. This variable | |
116 | should have a lifetime equal to or longer than the validator | |
117 | lifetime (which is usually determined by the lifetime of the | |
118 | window). | |
119 | @since 2.9.3 | |
120 | */ | |
121 | wxGenericValidator(float* valPtr); | |
122 | /** | |
123 | Constructor taking a double pointer. This will be used for | |
124 | wxTextCtrl. | |
125 | ||
126 | @param valPtr | |
127 | A pointer to a variable that contains the value. This variable | |
128 | should have a lifetime equal to or longer than the validator | |
129 | lifetime (which is usually determined by the lifetime of the | |
130 | window). | |
131 | @since 2.9.3 | |
132 | */ | |
133 | wxGenericValidator(double* valPtr); | |
23324ae1 FM |
134 | |
135 | /** | |
136 | Destructor. | |
137 | */ | |
adaaa686 | 138 | virtual ~wxGenericValidator(); |
23324ae1 FM |
139 | |
140 | /** | |
141 | Clones the generic validator using the copy constructor. | |
142 | */ | |
43c48e1e | 143 | virtual wxObject* Clone() const; |
23324ae1 FM |
144 | |
145 | /** | |
146 | Transfers the value from the window to the appropriate data type. | |
147 | */ | |
148 | virtual bool TransferFromWindow(); | |
149 | ||
150 | /** | |
151 | Transfers the value to the window. | |
152 | */ | |
153 | virtual bool TransferToWindow(); | |
154 | }; | |
e54c96f1 | 155 |