2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: valgen.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxGenericValidator
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxGenericValidator
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-22 02:01:48 -04:00
|
|
|
wxGenericValidator performs data transfer (but not validation or filtering)
|
2009-02-04 07:41:43 -05:00
|
|
|
for many type of controls.
|
2008-04-22 02:01:48 -04:00
|
|
|
|
2009-02-04 07:41:43 -05: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 02:01:48 -04:00
|
|
|
|
|
|
|
For more information, please see @ref overview_validator.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{validator}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-22 02:01:48 -04:00
|
|
|
@see @ref overview_validator, wxValidator, wxTextValidator
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxGenericValidator : public wxValidator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-04-22 02:01:48 -04:00
|
|
|
Copy constructor.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param validator
|
2008-03-09 08:33:59 -04:00
|
|
|
Validator to copy.
|
2008-04-22 02:01:48 -04:00
|
|
|
*/
|
|
|
|
wxGenericValidator(const wxGenericValidator& validator);
|
|
|
|
/**
|
|
|
|
Constructor taking a bool pointer. This will be used for wxCheckBox,
|
|
|
|
wxRadioButton, wxToggleButton and wxBitmapToggleButton.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param valPtr
|
2008-03-09 08:33:59 -04:00
|
|
|
A pointer to a variable that contains the value. This variable
|
2008-04-22 02:01:48 -04: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 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxGenericValidator(bool* valPtr);
|
2008-04-22 02:01:48 -04: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 09:43:31 -05:00
|
|
|
wxGenericValidator(wxString* valPtr);
|
2008-04-22 02:01:48 -04: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 09:43:31 -05:00
|
|
|
wxGenericValidator(int* valPtr);
|
2008-04-22 02:01:48 -04: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 09:43:31 -05:00
|
|
|
wxGenericValidator(wxArrayInt* valPtr);
|
2008-04-22 02:01:48 -04: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 09:43:31 -05:00
|
|
|
wxGenericValidator(wxDateTime* valPtr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxGenericValidator();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Clones the generic validator using the copy constructor.
|
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual wxObject* Clone() const;
|
2008-03-08 08:52:38 -05: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 11:24:38 -04:00
|
|
|
|