wxWidgets: interface/wx/persist.h File Reference

| Version: 3.1.7

Loading...
Searching...
No Matches
Classes | Functions
persist.h File Reference

## Classes
class | wxPersistenceManager
| Provides support for automatically saving and restoring object properties to persistent storage. More...
class | wxPersistentObject
| Base class for persistent object adapters. More...

## Functions
template<class T>
wxPersistentObject * | wxCreatePersistentObject (T *obj)
| Function used to create the correct persistent adapter for the given type of objects.
template<class T>
bool | wxPersistentRegisterAndRestore (T *obj, const wxString &name=wxString())
| A shorter synonym for wxPersistenceManager::RegisterAndRestore().

## Function Documentation

## ◆ wxCreatePersistentObject()

template<class T>

wxPersistentObject * wxCreatePersistentObject | ( | T * | obj | ) |

Function used to create the correct persistent adapter for the given type of objects.

To be precise, there is no such template function definition but there are overloads of wxCreatePersistentObject() taking different object types for all wxWidgets classes supporting persistence. And you may also define your own overloads to integrate your custom classes with wxWidgets persistence framework.

See also
  Defining Custom Persistent Windows

Include file:

    #include <wx/persist.h>

## ◆ wxPersistentRegisterAndRestore()

template<class T>

bool wxPersistentRegisterAndRestore | ( | T * | obj,
|  | const wxString & | name = wxString() )

A shorter synonym for wxPersistenceManager::RegisterAndRestore().

This function simply calls wxPersistenceManager::RegisterAndRestore() but using it results in slightly shorter code as it calls wxPersistenceManager::Get() internally. As an additional convenience, this function can also set the window name.

Parameters

  obj | wxWindow-derived object to register with persistence manager and to try to restore the settings for.
  name | If not empty, obj name is changed to the provided value before registering it.

Returns
  true if the settings were restored or false otherwise (this will always be the case when the program runs for the first time, for example).

Since
  2.9.0, name is new in 2.9.1.

Include file:

    #include <wx/persist.h>