wxWidgets: wxPersistentWindow< T > Class Template Reference

| Version: 3.1.5

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
wxPersistentWindow< T > Class Template Reference

`#include </cygdrive/c/Users/Hamis/Cygwin-packaging/wxWidgets3.1/wxWidgets3.1-3.1.5-4.x86_64/src/wxWidgets-3.1.5/interface/wx/persist/window.h>`

Inheritance diagram for wxPersistentWindow< T >:
[legend]

## Detailed Description

template<class T>
class wxPersistentWindow< T >

Base class for persistent windows.

Compared to wxPersistentObject this class does three things:

- Most importantly, wxPersistentWindow catches wxWindowDestroyEvent generated when the window is destroyed and saves its properties automatically when it happens.
- It implements GetName() using wxWindow::GetName() so that the derived classes don't need to do it.
- It adds a convenient wxPersistentWindow::Get() accessor returning the window object of the correct type.

## Public Types
typedef T | WindowType
| The type of the associated window.

## Public Member Functions
| wxPersistentWindow (WindowType *win)
| Constructor for a persistent window object.
WindowType * | Get () const
virtual wxString | GetName () const
| Implements the base class pure virtual method using wxWindow::GetName().
Public Member Functions inherited from wxPersistentObject
| wxPersistentObject (void *obj)
| Constructor takes the object which we're associated with.
virtual | ~wxPersistentObject ()
| Trivial but virtual destructor.
virtual void | Save () const =0
| Save the object properties.
virtual bool | Restore ()=0
| Restore the object properties.
virtual wxString | GetKind () const =0
| Returns the string uniquely identifying the objects supported by this adapter.
void * | GetObject () const
| Return the associated object.

## Additional Inherited Members
template<typename T>
bool | SaveValue (const wxString &name, T value) const
| Save the specified value using the given name.
template<typename T>
bool | RestoreValue (const wxString &name, T *value)
| Restore a value saved by SaveValue().

## Member Typedef Documentation

## ◆ WindowType

template<class T>

typedef T wxPersistentWindow< T >::WindowType

The type of the associated window.

## Constructor & Destructor Documentation

## ◆ wxPersistentWindow()

template<class T>

wxPersistentWindow< T >::wxPersistentWindow | ( | WindowType * | win | ) |

Constructor for a persistent window object.

The constructor uses wxEvtHandler::Bind() to catch wxWindowDestroyEvent generated when the window is destroyed and call wxPersistenceManager::SaveAndUnregister() when this happens. This ensures that the window properties are saved and that this object itself is deleted when the window is.

## Member Function Documentation

## ◆ Get()

template<class T>

WindowType * wxPersistentWindow< T >::Get | ( |  | ) | const
| inline

## ◆ GetName()

template<class T>

virtual wxString wxPersistentWindow< T >::GetName | ( |  | ) | const
| virtual

Implements the base class pure virtual method using wxWindow::GetName().

Notice that window names are usually not unique while this function must return a unique (at least among the objects of this type) string. Because of this you need to specify a non-default window name in its constructor when creating it or explicitly call wxWindow::SetName() before saving or restoring persistent properties.

Implements wxPersistentObject.