Version: 3.3.0
wxTopLevelWindow::GeometrySerializer Class Referenceabstract

#include <wx/toplevel.h>

Detailed Description

Class used with SaveGeometry() and RestoreToGeometry().

This is an abstract base class, i.e. to use it you must define a derived class implementing the pure virtual SaveField() and RestoreField() methods.

For example, if you wished to store the window geometry in a database, you could derive a class saving fields such as "width" or "height" in a table in this database and restoring them from it later.

Since
3.1.2

Private Member Functions

virtual bool SaveField (const wxString &name, int value) const =0
 Save a single field with the given value. More...
 
virtual bool RestoreField (const wxString &name, int *value)=0
 Try to restore a single field. More...
 

Member Function Documentation

◆ RestoreField()

virtual bool wxTopLevelWindow::GeometrySerializer::RestoreField ( const wxString name,
int *  value 
)
privatepure virtual

Try to restore a single field.

Unlike for SaveField(), returning false from this function may indicate that the value simply wasn't present and doesn't prevent RestoreToGeometry() from continuing with trying to restore the other values.

Parameters
nameuniquely identifies the field
valuenon-null pointer to the value to be filled by this function
Returns
true if the value was retrieved or false if it wasn't found or an error occurred.

◆ SaveField()

virtual bool wxTopLevelWindow::GeometrySerializer::SaveField ( const wxString name,
int  value 
) const
privatepure virtual

Save a single field with the given value.

Note that if this function returns false, SaveGeometry() supposes that saving the geometry failed and returns false itself, without even trying to save anything else.

Parameters
nameuniquely identifies the field but is otherwise arbitrary.
valuevalue of the field (can be positive or negative, i.e. it can't be assumed that a value like -1 is invalid).
Returns
true if the field was saved or false if saving it failed, resulting in wxTopLevelWindow::SaveGeometry() failure.