]> git.saurik.com Git - wxWidgets.git/blob - include/wx/valgen.h
supporting clang 2.0 under xcode, see #12332
[wxWidgets.git] / include / wx / valgen.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: valgen.h
3 // Purpose: wxGenericValidator class
4 // Author: Kevin Smith
5 // Created: Jan 22 1999
6 // RCS-ID: $Id$
7 // Copyright: (c) 1999 Julian Smart (assigned from Kevin)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_VALGENH__
12 #define _WX_VALGENH__
13
14 #include "wx/validate.h"
15
16 #if wxUSE_VALIDATORS
17
18 class WXDLLIMPEXP_FWD_BASE wxDateTime;
19
20 // ----------------------------------------------------------------------------
21 // wxGenericValidator performs data transfer between many standard controls and
22 // variables of the type corresponding to their values.
23 //
24 // It doesn't do any validation so its name is a slight misnomer.
25 // ----------------------------------------------------------------------------
26
27 class WXDLLIMPEXP_CORE wxGenericValidator: public wxValidator
28 {
29 public:
30 // Different constructors: each of them creates a validator which can only
31 // be used with some controls, the comments before each constructor
32 // indicate which ones:
33 // wxCheckBox, wxRadioButton, wx(Bitmap)ToggleButton
34 wxGenericValidator(bool* val);
35 // wxChoice, wxGauge, wxRadioBox, wxScrollBar, wxSlider, wxSpinButton
36 wxGenericValidator(int* val);
37 wxGenericValidator(float* val);
38 wxGenericValidator(double* val);
39 // wxComboBox, wxTextCtrl, wxButton, wxStaticText (read-only)
40 wxGenericValidator(wxString* val);
41 // wxListBox, wxCheckListBox
42 wxGenericValidator(wxArrayInt* val);
43 #if wxUSE_DATETIME
44 // wxDatePickerCtrl
45 wxGenericValidator(wxDateTime* val);
46 #endif // wxUSE_DATETIME
47 wxGenericValidator(const wxGenericValidator& copyFrom);
48
49 virtual ~wxGenericValidator(){}
50
51 // Make a clone of this validator (or return NULL) - currently necessary
52 // if you're passing a reference to a validator.
53 // Another possibility is to always pass a pointer to a new validator
54 // (so the calling code can use a copy constructor of the relevant class).
55 virtual wxObject *Clone() const { return new wxGenericValidator(*this); }
56 bool Copy(const wxGenericValidator& val);
57
58 // Called when the value in the window must be validated: this is not used
59 // by this class
60 virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; }
61
62 // Called to transfer data to the window
63 virtual bool TransferToWindow();
64
65 // Called to transfer data to the window
66 virtual bool TransferFromWindow();
67
68 protected:
69 void Initialize();
70
71 bool* m_pBool;
72 int* m_pInt;
73 float* m_pFloat;
74 double* m_pDouble;
75 wxString* m_pString;
76 wxArrayInt* m_pArrayInt;
77 #if wxUSE_DATETIME
78 wxDateTime* m_pDateTime;
79 #endif // wxUSE_DATETIME
80
81 private:
82 DECLARE_CLASS(wxGenericValidator)
83 wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator);
84 };
85
86 #endif // wxUSE_VALIDATORS
87
88 #endif // _WX_VALGENH__