]>
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); |
23324ae1 FM |
99 | |
100 | /** | |
101 | Destructor. | |
102 | */ | |
adaaa686 | 103 | virtual ~wxGenericValidator(); |
23324ae1 FM |
104 | |
105 | /** | |
106 | Clones the generic validator using the copy constructor. | |
107 | */ | |
43c48e1e | 108 | virtual wxObject* Clone() const; |
23324ae1 FM |
109 | |
110 | /** | |
111 | Transfers the value from the window to the appropriate data type. | |
112 | */ | |
113 | virtual bool TransferFromWindow(); | |
114 | ||
115 | /** | |
116 | Transfers the value to the window. | |
117 | */ | |
118 | virtual bool TransferToWindow(); | |
119 | }; | |
e54c96f1 | 120 |