]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: valgen.h | |
3 | // Purpose: interface of wxGenericValidator | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxGenericValidator | |
11 | ||
12 | wxGenericValidator performs data transfer (but not validation or filtering) | |
13 | for many type of controls. | |
14 | ||
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. | |
24 | ||
25 | For more information, please see @ref overview_validator. | |
26 | ||
27 | @library{wxcore} | |
28 | @category{validator} | |
29 | ||
30 | @see @ref overview_validator, wxValidator, wxTextValidator, | |
31 | wxIntegerValidator, wxFloatingPointValidator | |
32 | */ | |
33 | class wxGenericValidator : public wxValidator | |
34 | { | |
35 | public: | |
36 | /** | |
37 | Copy constructor. | |
38 | ||
39 | @param validator | |
40 | Validator to copy. | |
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 | ||
47 | @param valPtr | |
48 | A pointer to a variable that contains the value. This variable | |
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). | |
52 | */ | |
53 | wxGenericValidator(bool* valPtr); | |
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 | */ | |
64 | wxGenericValidator(wxString* valPtr); | |
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 | */ | |
76 | wxGenericValidator(int* valPtr); | |
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 | */ | |
87 | wxGenericValidator(wxArrayInt* valPtr); | |
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 | */ | |
98 | wxGenericValidator(wxDateTime* valPtr); | |
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); | |
135 | ||
136 | /** | |
137 | Destructor. | |
138 | */ | |
139 | virtual ~wxGenericValidator(); | |
140 | ||
141 | /** | |
142 | Clones the generic validator using the copy constructor. | |
143 | */ | |
144 | virtual wxObject* Clone() const; | |
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 | }; | |
156 |