Files
s7/Resources/Utilities/ConfigEditorPopup.h
Saleem Edah-Tally 7d3c61c91d Use the saved config values or application values.
ConfigEditorPopup

On creating the popup, config values were always read and used. Do this if the
application does not provide its own variables. The values are still committed
to the config file in the usual way (on control destruction). The application
may restore them to its own variables during setup.
2025-07-13 16:13:56 +02:00

47 lines
1.4 KiB
C++

/*
* File: ConfigEditorPopup.h
* Author: Saleem EDAH-TALLY - nmset@yandex.com
* License: CeCILL-C
* Copyright Saleem EDAH-TALLY - © 2017
*
* Created on 4 mars 2017, 19:06
*/
#ifndef CONFIGEDITORPOPUP_H
#define CONFIGEDITORPOPUP_H
#include <wx/wx.h>
#include <wx/config.h>
#include "PopupTransientWindow.h"
#include <wx/spinctrl.h>
/**
* Edits wxConfig keys using check boxes, text and spin controls, with supplied
* paths. When a control is created, it reads the values. When it is destroyed,
* it saves back the value.
*/
class ConfigEditorPopup
{
public:
ConfigEditorPopup ( wxWindow * parent, wxConfig * config );
virtual ~ConfigEditorPopup();
PopupTransientWindow* CreatePopup();
void ShowPopup();
wxCheckBox* AddCheckBox(const wxString& label, const wxString& configPath, bool * clientVar = nullptr);
wxSpinCtrl* AddSpinCtrl ( const wxString& label, const wxString& configPath, int * clientVar = nullptr );
wxTextCtrl * AddTextCtrl ( const wxString& label, const wxString& configPath, wxString * clientVar = nullptr );
private:
wxConfig * m_config = nullptr;
wxWeakRef<wxWindow> m_owner = nullptr;
wxFlexGridSizer * m_flxsz = nullptr;
PopupTransientWindow * m_popup = nullptr;
wxPanel * m_pan = nullptr;
void OnControlDestroy ( wxWindowDestroyEvent& evt );
void OnPopupDestroy ( wxWindowDestroyEvent& evt );
};
#endif /* CONFIGEDITORPOPUP_H */