]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/persist/window.h
Disable test for setting the creation time under Unix.
[wxWidgets.git] / interface / wx / persist / window.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/persist/window.h
3 // Purpose: interface of wxPersistentWindow<>
4 // Author: Vadim Zeitlin
5 // RCS-ID: $Id$
6 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 /**
11 Base class for persistent windows.
12
13 Compared to wxPersistentObject this class does three things:
14 - Most importantly, wxPersistentWindow catches wxWindowDestroyEvent
15 generated when the window is destroyed and saves its properties
16 automatically when it happens.
17 - It implements GetName() using wxWindow::GetName() so that the derived
18 classes don't need to do it.
19 - It adds a convenient wxPersistentWindow::Get() accessor returning the
20 window object of the correct type.
21 */
22 template <class T>
23 class wxPersistentWindow : public wxPersistentObject
24 {
25 public:
26 /// The type of the associated window.
27 typedef T WindowType;
28
29 /**
30 Constructor for a persistent window object.
31
32 The constructor uses wxEvtHandler::Connect() to catch
33 wxWindowDestroyEvent generated when the window is destroyed and call
34 wxPersistenceManager::SaveAndUnregister() when this happens. This
35 ensures that the window properties are saved and that this object
36 itself is deleted when the window is.
37 */
38 wxPersistentWindow(WindowType *win);
39
40 WindowType *Get() const { return static_cast<WindowType *>(GetWindow()); }
41 /**
42 Implements the base class pure virtual method using wxWindow::GetName().
43
44 Notice that window names are usually not unique while this function
45 must return a unique (at least among the objects of this type) string.
46 Because of this you need to specify a non-default window name in its
47 constructor when creating it or explicitly call wxWindow::SetName()
48 before saving or restoring persistent properties.
49 */
50 virtual wxString GetName() const;
51 };