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