X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/af49c4b8a2d3553e733e71c7dd3911881f4c1a2a..7344108e8a129a3f9b4df5ab0f98a1713db03b89:/include/wx/valgen.h diff --git a/include/wx/valgen.h b/include/wx/valgen.h index f80ced14c3..592afe4981 100644 --- a/include/wx/valgen.h +++ b/include/wx/valgen.h @@ -1,65 +1,95 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: valgen.h +// Name: wx/valgen.h // Purpose: wxGenericValidator class // Author: Kevin Smith -// Modified by: // Created: Jan 22 1999 -// RCS-ID: -// Copyright: (c) 1999 Kevin Smith +// RCS-ID: $Id$ +// Copyright: (c) 1999 Julian Smart (assigned from Kevin) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_VALGENH__ #define _WX_VALGENH__ -#if defined(__GNUG__) && !defined(__APPLE__) -#pragma interface "valgen.h" -#endif - #include "wx/validate.h" #if wxUSE_VALIDATORS -class WXDLLEXPORT wxGenericValidator: public wxValidator +class WXDLLIMPEXP_FWD_BASE wxDateTime; +class WXDLLIMPEXP_FWD_BASE wxFileName; + +// ---------------------------------------------------------------------------- +// wxGenericValidator performs data transfer between many standard controls and +// variables of the type corresponding to their values. +// +// It doesn't do any validation so its name is a slight misnomer. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxGenericValidator: public wxValidator { -DECLARE_CLASS(wxGenericValidator) public: - wxGenericValidator(bool* val); - wxGenericValidator(int* val); - wxGenericValidator(wxString* val); - wxGenericValidator(wxArrayInt* val); - wxGenericValidator(const wxGenericValidator& copyFrom); + // Different constructors: each of them creates a validator which can only + // be used with some controls, the comments before each constructor + // indicate which ones: + // wxCheckBox, wxRadioButton, wx(Bitmap)ToggleButton + wxGenericValidator(bool* val); + // wxChoice, wxGauge, wxRadioBox, wxScrollBar, wxSlider, wxSpinButton + wxGenericValidator(int* val); + // wxComboBox, wxTextCtrl, wxButton, wxStaticText (read-only) + wxGenericValidator(wxString* val); + // wxListBox, wxCheckListBox + wxGenericValidator(wxArrayInt* val); +#if wxUSE_DATETIME + // wxDatePickerCtrl + wxGenericValidator(wxDateTime* val); +#endif // wxUSE_DATETIME + // wxTextCtrl + wxGenericValidator(wxFileName* val); + // wxTextCtrl + wxGenericValidator(float* val); + // wxTextCtrl + wxGenericValidator(double* val); - ~wxGenericValidator(); + wxGenericValidator(const wxGenericValidator& copyFrom); - // Make a clone of this validator (or return NULL) - currently necessary - // if you're passing a reference to a validator. - // Another possibility is to always pass a pointer to a new validator - // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const { return new wxGenericValidator(*this); } - bool Copy(const wxGenericValidator& val); + virtual ~wxGenericValidator(){} - // Called when the value in the window must be validated. - // This function can pop up an error message. - virtual bool Validate(wxWindow * WXUNUSED(parent)) { return TRUE; } + // Make a clone of this validator (or return NULL) - currently necessary + // if you're passing a reference to a validator. + // Another possibility is to always pass a pointer to a new validator + // (so the calling code can use a copy constructor of the relevant class). + virtual wxObject *Clone() const { return new wxGenericValidator(*this); } + bool Copy(const wxGenericValidator& val); - // Called to transfer data to the window - virtual bool TransferToWindow(); + // Called when the value in the window must be validated: this is not used + // by this class + virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } - // Called to transfer data to the window - virtual bool TransferFromWindow(); + // Called to transfer data to the window + virtual bool TransferToWindow(); + + // Called to transfer data to the window + virtual bool TransferFromWindow(); protected: - void Initialize(); + void Initialize(); + + bool* m_pBool; + int* m_pInt; + wxString* m_pString; + wxArrayInt* m_pArrayInt; +#if wxUSE_DATETIME + wxDateTime* m_pDateTime; +#endif // wxUSE_DATETIME + wxFileName* m_pFileName; + float* m_pFloat; + double* m_pDouble; - bool* m_pBool; - int* m_pInt; - wxString* m_pString; - wxArrayInt* m_pArrayInt; +private: + DECLARE_CLASS(wxGenericValidator) + wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator); }; -#endif - // wxUSE_VALIDATORS +#endif // wxUSE_VALIDATORS -#endif - // _WX_VALGENH__ +#endif // _WX_VALGENH__