2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: valgen.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxGenericValidator
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 13:29:13 +00:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxGenericValidator
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-04-22 06:01:48 +00:00
|
|
|
wxGenericValidator performs data transfer (but not validation or filtering)
|
2009-02-04 12:41:43 +00:00
|
|
|
for many type of controls.
|
2008-04-22 06:01:48 +00:00
|
|
|
|
2009-02-04 12:41:43 +00:00
|
|
|
wxGenericValidator supports:
|
|
|
|
- wxButton, wxRadioButton, wxToggleButton, wxBitmapToggleButton, wxSpinButton
|
|
|
|
- wxCheckBox, wxRadioBox, wxComboBox, wxListBox, wxCheckListBox
|
|
|
|
- wxGauge, wxSlider, wxScrollBar, wxChoice, wxStaticText
|
|
|
|
- wxSpinCtrl, wxTextCtrl
|
|
|
|
|
|
|
|
It checks the type of the window and uses an appropriate type for it.
|
|
|
|
For example, wxButton and wxTextCtrl transfer data to and from a
|
|
|
|
wxString variable; wxListBox uses a wxArrayInt; wxCheckBox uses a boolean.
|
2008-04-22 06:01:48 +00:00
|
|
|
|
|
|
|
For more information, please see @ref overview_validator.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{validator}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2011-01-19 10:48:28 +00:00
|
|
|
@see @ref overview_validator, wxValidator, wxTextValidator,
|
|
|
|
wxIntegerValidator, wxFloatingPointValidator
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxGenericValidator : public wxValidator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-04-22 06:01:48 +00:00
|
|
|
Copy constructor.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param validator
|
2008-03-09 12:33:59 +00:00
|
|
|
Validator to copy.
|
2008-04-22 06:01:48 +00:00
|
|
|
*/
|
|
|
|
wxGenericValidator(const wxGenericValidator& validator);
|
|
|
|
/**
|
|
|
|
Constructor taking a bool pointer. This will be used for wxCheckBox,
|
|
|
|
wxRadioButton, wxToggleButton and wxBitmapToggleButton.
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param valPtr
|
2008-03-09 12:33:59 +00:00
|
|
|
A pointer to a variable that contains the value. This variable
|
2008-04-22 06:01:48 +00:00
|
|
|
should have a lifetime equal to or longer than the validator
|
|
|
|
lifetime (which is usually determined by the lifetime of the
|
|
|
|
window).
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxGenericValidator(bool* valPtr);
|
2008-04-22 06:01:48 +00:00
|
|
|
/**
|
|
|
|
Constructor taking a wxString pointer. This will be used for wxButton,
|
|
|
|
wxComboBox, wxStaticText, wxTextCtrl.
|
|
|
|
|
|
|
|
@param valPtr
|
|
|
|
A pointer to a variable that contains the value. This variable
|
|
|
|
should have a lifetime equal to or longer than the validator
|
|
|
|
lifetime (which is usually determined by the lifetime of the
|
|
|
|
window).
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxGenericValidator(wxString* valPtr);
|
2008-04-22 06:01:48 +00:00
|
|
|
/**
|
|
|
|
Constructor taking an integer pointer. This will be used for wxChoice,
|
|
|
|
wxGauge, wxScrollBar, wxRadioBox, wxSlider, wxSpinButton and
|
|
|
|
wxSpinCtrl.
|
|
|
|
|
|
|
|
@param valPtr
|
|
|
|
A pointer to a variable that contains the value. This variable
|
|
|
|
should have a lifetime equal to or longer than the validator
|
|
|
|
lifetime (which is usually determined by the lifetime of the
|
|
|
|
window).
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxGenericValidator(int* valPtr);
|
2008-04-22 06:01:48 +00:00
|
|
|
/**
|
|
|
|
Constructor taking a wxArrayInt pointer. This will be used for
|
|
|
|
wxListBox, wxCheckListBox.
|
|
|
|
|
|
|
|
@param valPtr
|
|
|
|
A pointer to a variable that contains the value. This variable
|
|
|
|
should have a lifetime equal to or longer than the validator
|
|
|
|
lifetime (which is usually determined by the lifetime of the
|
|
|
|
window).
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxGenericValidator(wxArrayInt* valPtr);
|
2008-04-22 06:01:48 +00:00
|
|
|
/**
|
|
|
|
Constructor taking a wxDateTime pointer. This will be used for
|
|
|
|
wxDatePickerCtrl.
|
|
|
|
|
|
|
|
@param valPtr
|
|
|
|
A pointer to a variable that contains the value. This variable
|
|
|
|
should have a lifetime equal to or longer than the validator
|
|
|
|
lifetime (which is usually determined by the lifetime of the
|
|
|
|
window).
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxGenericValidator(wxDateTime* valPtr);
|
2011-07-09 23:37:28 +00:00
|
|
|
/**
|
|
|
|
Constructor taking a wxFileName pointer. This will be used for
|
|
|
|
wxTextCtrl.
|
|
|
|
|
|
|
|
@param valPtr
|
|
|
|
A pointer to a variable that contains the value. This variable
|
|
|
|
should have a lifetime equal to or longer than the validator
|
|
|
|
lifetime (which is usually determined by the lifetime of the
|
|
|
|
window).
|
|
|
|
@since 2.9.3
|
|
|
|
*/
|
|
|
|
wxGenericValidator(wxFileName* valPtr);
|
|
|
|
/**
|
|
|
|
Constructor taking a float pointer. This will be used for
|
|
|
|
wxTextCtrl.
|
|
|
|
|
|
|
|
@param valPtr
|
|
|
|
A pointer to a variable that contains the value. This variable
|
|
|
|
should have a lifetime equal to or longer than the validator
|
|
|
|
lifetime (which is usually determined by the lifetime of the
|
|
|
|
window).
|
|
|
|
@since 2.9.3
|
|
|
|
*/
|
|
|
|
wxGenericValidator(float* valPtr);
|
|
|
|
/**
|
|
|
|
Constructor taking a double pointer. This will be used for
|
|
|
|
wxTextCtrl.
|
|
|
|
|
|
|
|
@param valPtr
|
|
|
|
A pointer to a variable that contains the value. This variable
|
|
|
|
should have a lifetime equal to or longer than the validator
|
|
|
|
lifetime (which is usually determined by the lifetime of the
|
|
|
|
window).
|
|
|
|
@since 2.9.3
|
|
|
|
*/
|
|
|
|
wxGenericValidator(double* valPtr);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual ~wxGenericValidator();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Clones the generic validator using the copy constructor.
|
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
virtual wxObject* Clone() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Transfers the value from the window to the appropriate data type.
|
|
|
|
*/
|
|
|
|
virtual bool TransferFromWindow();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Transfers the value to the window.
|
|
|
|
*/
|
|
|
|
virtual bool TransferToWindow();
|
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|