Simon Rozman 30f289123f Update Copyright and build year
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-01-07 11:20:53 +01:00

89 lines
1.8 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
Copyright © 2016 GÉANT
*/
#pragma once
#include "../common.h"
#include "../private/tlwgeom.h"
#include <codeanalysis\warnings.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/persist.h>
#include <wx/persist/toplevel.h>
#include <wx/persist/window.h>
#include <wx/toplevel.h>
#pragma warning(pop)
/// \addtogroup wxExtend
/// @{
///
/// Supports saving/restoring wxTopLevelWindow state
///
class wxPersistentTLWEx :
public wxPersistentWindow<wxTopLevelWindow>,
private wxTopLevelWindow::GeometrySerializer
{
public:
///
/// Constructs a persistent dialog object
///
wxPersistentTLWEx(wxTopLevelWindow *mgr) : wxPersistentWindow<wxTopLevelWindow>(mgr)
{
}
///
/// \returns `wxT(wxPERSIST_TLW_KIND)`
///
virtual wxString GetKind() const wxOVERRIDE
{
return wxT(wxPERSIST_TLW_KIND);
}
///
/// Saves dialog state
///
virtual void Save() const wxOVERRIDE
{
const wxTopLevelWindow * const wnd = Get();
wxTLWGeometryEx geom;
if (geom.GetFrom(wnd))
geom.Save(*this);
}
///
/// Restores dialog state
///
virtual bool Restore() wxOVERRIDE
{
wxTopLevelWindow * const wnd = Get();
wxTLWGeometryEx geom;
if (!geom.Restore(*this))
return false;
return geom.ApplyTo(wnd);
}
private:
wxDECLARE_NO_COPY_CLASS(wxPersistentTLWEx);
private:
virtual bool SaveField(const wxString& name, int value) const wxOVERRIDE
{
return SaveValue(name, value);
}
virtual bool RestoreField(const wxString& name, int* value) wxOVERRIDE
{
return RestoreValue(name, value);
}
};
/// @}