]>
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 | */ | |
32 | class wxGenericValidator : public wxValidator | |
33 | { | |
34 | public: | |
35 | /** | |
36 | Copy constructor. | |
37 | ||
38 | @param validator | |
39 | Validator to copy. | |
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 | ||
46 | @param valPtr | |
47 | A pointer to a variable that contains the value. This variable | |
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). | |
51 | */ | |
52 | wxGenericValidator(bool* valPtr); | |
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 | */ | |
63 | wxGenericValidator(wxString* valPtr); | |
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 | */ | |
75 | wxGenericValidator(int* valPtr); | |
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 | */ | |
86 | wxGenericValidator(wxArrayInt* valPtr); | |
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 | */ | |
97 | wxGenericValidator(wxDateTime* valPtr); | |
98 | ||
99 | /** | |
100 | Destructor. | |
101 | */ | |
102 | virtual ~wxGenericValidator(); | |
103 | ||
104 | /** | |
105 | Clones the generic validator using the copy constructor. | |
106 | */ | |
107 | virtual wxObject* Clone() const; | |
108 | ||
109 | /** | |
110 | Transfers the value from the window to the appropriate data type. | |
111 | */ | |
112 | virtual bool TransferFromWindow(); | |
113 | ||
114 | /** | |
115 | Transfers the value to the window. | |
116 | */ | |
117 | virtual bool TransferToWindow(); | |
118 | }; | |
119 |