Version: 3.3.4
Loading...
Searching...
No Matches
wxTopLevelWindow::GeometryStore 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 SaveValue() and RestoreValue() 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.3.0

Private Member Functions

virtual bool SaveValue (const wxString &name, int value)=0
 Save a single field with the given value.
virtual bool SaveString (const wxString &name, const wxString &value)
 Save a single field with the given string value.
virtual bool RestoreValue (const wxString &name, int *value) const =0
 Try to restore a single field.
virtual bool RestoreString (const wxString &name, wxString *value) const
 Try to restore a single string-valued field.

Member Function Documentation

◆ RestoreString()

virtual bool wxTopLevelWindow::GeometryStore::RestoreString ( const wxString & name,
wxString * value ) const
privatevirtual

Try to restore a single string-valued field.

This function is similar to RestoreValue(), but is currently only used when using wxGTK with Wayland XDG session management protocol and so can be left unimplemented when not targeting this platform.

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

◆ RestoreValue()

virtual bool wxTopLevelWindow::GeometryStore::RestoreValue ( const wxString & name,
int * value ) const
privatepure virtual

Try to restore a single field.

Unlike for SaveValue(), 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.

◆ SaveString()

virtual bool wxTopLevelWindow::GeometryStore::SaveString ( const wxString & name,
const wxString & value )
privatevirtual

Save a single field with the given string value.

This function is similar to SaveValue(), but is currently only used when using wxGTK with Wayland XDG session management protocol and so can be left unimplemented when not targeting this platform.

Parameters
nameuniquely identifies the field but is otherwise arbitrary.
valuevalue of the field, currently always non-empty.
Returns
true if the field was saved or false if saving it failed, resulting in wxTopLevelWindow::SaveGeometry() failure.
Since
3.3.4

◆ SaveValue()

virtual bool wxTopLevelWindow::GeometryStore::SaveValue ( const wxString & name,
int value )
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.