1999-02-07 17:11:44 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-20 00:14:35 +00:00
|
|
|
// Name: wx/valgen.h
|
1999-02-07 17:11:44 +00:00
|
|
|
// Purpose: wxGenericValidator class
|
|
|
|
// Author: Kevin Smith
|
|
|
|
// Created: Jan 22 1999
|
2005-05-04 18:57:50 +00:00
|
|
|
// Copyright: (c) 1999 Julian Smart (assigned from Kevin)
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-02-07 17:11:44 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_VALGENH__
|
|
|
|
#define _WX_VALGENH__
|
|
|
|
|
|
|
|
#include "wx/validate.h"
|
|
|
|
|
1999-06-15 20:21:59 +00:00
|
|
|
#if wxUSE_VALIDATORS
|
|
|
|
|
2008-01-20 22:40:14 +00:00
|
|
|
class WXDLLIMPEXP_FWD_BASE wxDateTime;
|
2011-07-09 23:37:28 +00:00
|
|
|
class WXDLLIMPEXP_FWD_BASE wxFileName;
|
2008-01-20 22:40:14 +00:00
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// 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.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxGenericValidator: public wxValidator
|
1999-02-07 17:11:44 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-01-20 22:55:16 +00:00
|
|
|
// 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);
|
2008-01-20 22:40:14 +00:00
|
|
|
#if wxUSE_DATETIME
|
2008-01-20 22:55:16 +00:00
|
|
|
// wxDatePickerCtrl
|
|
|
|
wxGenericValidator(wxDateTime* val);
|
2008-01-20 22:40:14 +00:00
|
|
|
#endif // wxUSE_DATETIME
|
2011-07-09 23:37:28 +00:00
|
|
|
// wxTextCtrl
|
|
|
|
wxGenericValidator(wxFileName* val);
|
|
|
|
// wxTextCtrl
|
|
|
|
wxGenericValidator(float* val);
|
|
|
|
// wxTextCtrl
|
|
|
|
wxGenericValidator(double* val);
|
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
wxGenericValidator(const wxGenericValidator& copyFrom);
|
1999-02-07 17:11:44 +00:00
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
virtual ~wxGenericValidator(){}
|
1999-02-07 17:11:44 +00:00
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
// 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).
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual wxObject *Clone() const wxOVERRIDE { return new wxGenericValidator(*this); }
|
2008-01-20 22:55:16 +00:00
|
|
|
bool Copy(const wxGenericValidator& val);
|
1999-02-07 17:11:44 +00:00
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
// Called when the value in the window must be validated: this is not used
|
|
|
|
// by this class
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual bool Validate(wxWindow * WXUNUSED(parent)) wxOVERRIDE { return true; }
|
1999-02-07 17:11:44 +00:00
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
// Called to transfer data to the window
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual bool TransferToWindow() wxOVERRIDE;
|
1999-02-07 17:11:44 +00:00
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
// Called to transfer data to the window
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual bool TransferFromWindow() wxOVERRIDE;
|
1999-02-07 17:11:44 +00:00
|
|
|
|
|
|
|
protected:
|
2008-01-20 22:55:16 +00:00
|
|
|
void Initialize();
|
1999-02-07 17:11:44 +00:00
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
bool* m_pBool;
|
|
|
|
int* m_pInt;
|
|
|
|
wxString* m_pString;
|
|
|
|
wxArrayInt* m_pArrayInt;
|
2008-01-20 22:40:14 +00:00
|
|
|
#if wxUSE_DATETIME
|
2008-01-20 22:55:16 +00:00
|
|
|
wxDateTime* m_pDateTime;
|
2008-01-20 22:40:14 +00:00
|
|
|
#endif // wxUSE_DATETIME
|
2011-07-09 23:37:28 +00:00
|
|
|
wxFileName* m_pFileName;
|
|
|
|
float* m_pFloat;
|
|
|
|
double* m_pDouble;
|
2003-01-02 23:38:11 +00:00
|
|
|
|
|
|
|
private:
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_CLASS(wxGenericValidator);
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator);
|
1999-02-07 17:11:44 +00:00
|
|
|
};
|
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
#endif // wxUSE_VALIDATORS
|
1999-06-15 20:21:59 +00:00
|
|
|
|
2008-01-20 22:55:16 +00:00
|
|
|
#endif // _WX_VALGENH__
|