Version: 3.3.1
wxPersistentCheckBox Class Reference

#include <wx/persist/checkbox.h>

+ Inheritance diagram for wxPersistentCheckBox:

Detailed Description

Persistence adapter for wxCheckBox controls.

This adapter saves and restores the state of a wxCheckBox control,

Example of using it:

auto* checkbox = new wxCheckBox(this, wxID_ANY, "&Remember me");
A checkbox is a labelled box which by default is either on (checkmark is visible) or off (no checkmar...
Definition: checkbox.h:75
@ wxID_ANY
Any id: means that we don't care about the id, whether when installing an event handler or when creat...
Definition: defs.h:591
bool wxPersistentRegisterAndRestore(T *obj, const wxString &name=wxString())
A shorter synonym for wxPersistenceManager::RegisterAndRestore().

If the checkbox is checked, it will be checked again after the application restart.

Since
3.3.1

Public Member Functions

 wxPersistentCheckBox (wxCheckBox *checkbox)
 Constructor. More...
 
virtual void Save () const
 Save the current checkbox state. More...
 
virtual bool Restore ()
 Restore the previously saved checkbox state. More...
 
- Public Member Functions inherited from wxPersistentWindow< wxCheckBox >
 wxPersistentWindow (WindowType *win)
 Constructor for a persistent window object. More...
 
WindowTypeGet () const
 
virtual wxString GetName () const
 Implements the base class pure virtual method using wxWindow::GetName(). More...
 
- Public Member Functions inherited from wxPersistentObject
 wxPersistentObject (void *obj)
 Constructor takes the object which we're associated with. More...
 
virtual ~wxPersistentObject ()
 Trivial but virtual destructor. More...
 
void * GetObject () const
 Return the associated object. More...
 
virtual wxString GetKind () const =0
 Returns the string uniquely identifying the objects supported by this adapter. More...
 

Additional Inherited Members

- Public Types inherited from wxPersistentWindow< wxCheckBox >
typedef wxCheckBox WindowType
 The type of the associated window. More...
 
- Protected Member Functions inherited from wxPersistentObject
template<typename T >
bool SaveValue (const wxString &name, T value) const
 Save the specified value using the given name. More...
 
template<typename T >
bool RestoreValue (const wxString &name, T *value)
 Restore a value saved by SaveValue(). More...
 

Constructor & Destructor Documentation

◆ wxPersistentCheckBox()

wxPersistentCheckBox::wxPersistentCheckBox ( wxCheckBox checkbox)
explicit

Constructor.

Note that 3-state checkboxes are also supported.

Parameters
checkboxThe associated checkbox.

Member Function Documentation

◆ Restore()

virtual bool wxPersistentCheckBox::Restore ( )
virtual

Restore the previously saved checkbox state.

If the saved index is valid, i.e. is wxCHK_UNCHECKED, wxCHK_CHECKED or wxCHK_UNDETERMINED if checkbox supports 3rd state, the checkbox state is set to the previously saved value (otherwise it is ignored).

Implements wxPersistentObject.

◆ Save()

virtual void wxPersistentCheckBox::Save ( ) const
virtual

Save the current checkbox state.

The state is saved as an integer value corresponding to the numeric value returned by wxCheckBox::Get3StateValue(). For unchecked and checked checkboxes this value is 0 and 1 respectively, as is customary.

Implements wxPersistentObject.