wxExtend
Additional templates and function helpers for wxWidgets
Loading...
Searching...
No Matches
toplevel.h
1/*
2 ​​​SPDX-License-Identifier: GPL-3.0-or-later
3 Copyright © 2015-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
7#pragma once
8
9#include "../common.h"
10#include "../private/tlwgeom.h"
11
12#include <codeanalysis\warnings.h>
13#pragma warning(push)
14#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
15#include <wx/persist.h>
16#include <wx/persist/toplevel.h>
17#include <wx/persist/window.h>
18#include <wx/toplevel.h>
19#pragma warning(pop)
20
23
28 public wxPersistentWindow<wxTopLevelWindow>,
29 private wxTopLevelWindow::GeometrySerializer
30{
31public:
35 wxPersistentTLWEx(wxTopLevelWindow *mgr) : wxPersistentWindow<wxTopLevelWindow>(mgr)
36 {
37 }
38
42 virtual wxString GetKind() const wxOVERRIDE
43 {
44 return wxT(wxPERSIST_TLW_KIND);
45 }
46
50 virtual void Save() const wxOVERRIDE
51 {
52 const wxTopLevelWindow * const wnd = Get();
53
54 wxTLWGeometryEx geom;
55 if (geom.GetFrom(wnd))
56 geom.Save(*this);
57 }
58
62 virtual bool Restore() wxOVERRIDE
63 {
64 wxTopLevelWindow * const wnd = Get();
65
66 wxTLWGeometryEx geom;
67 if (!geom.Restore(*this))
68 return false;
69
70 return geom.ApplyTo(wnd);
71 }
72
73private:
74 wxDECLARE_NO_COPY_CLASS(wxPersistentTLWEx);
75
76private:
77 virtual bool SaveField(const wxString& name, int value) const wxOVERRIDE
78 {
79 return SaveValue(name, value);
80 }
81
82 virtual bool RestoreField(const wxString& name, int* value) wxOVERRIDE
83 {
84 return RestoreValue(name, value);
85 }
86};
87
Supports saving/restoring wxTopLevelWindow state.
Definition toplevel.h:30
virtual wxString GetKind() const wxOVERRIDE
Definition toplevel.h:42
wxPersistentTLWEx(wxTopLevelWindow *mgr)
Constructs a persistent dialog object.
Definition toplevel.h:35
virtual bool Restore() wxOVERRIDE
Restores dialog state.
Definition toplevel.h:62
virtual void Save() const wxOVERRIDE
Saves dialog state.
Definition toplevel.h:50