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