2020-09-21 17:17:34 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
2020-09-21 17:17:34 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-23 18:07:00 +00:00
|
|
|
// GuiSettings.h
|
|
|
|
//
|
|
|
|
// User interface template for a settings GUI.
|
2020-11-05 17:18:11 +00:00
|
|
|
// The saving of es_settings.cfg and the reload of the gamelists are triggered from here
|
|
|
|
// based on the flags set by the actual menu entries' lambda functions.
|
2020-06-23 18:07:00 +00:00
|
|
|
//
|
|
|
|
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_APP_GUIS_GUI_SETTINGS_H
|
|
|
|
#define ES_APP_GUIS_GUI_SETTINGS_H
|
|
|
|
|
2014-06-25 16:29:58 +00:00
|
|
|
#include "components/MenuComponent.h"
|
|
|
|
|
|
|
|
// This is just a really simple template for a GUI that calls some save functions when closed.
|
|
|
|
class GuiSettings : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
2020-06-23 18:07:00 +00:00
|
|
|
GuiSettings(Window* window, const char* title);
|
2020-11-05 17:18:11 +00:00
|
|
|
virtual ~GuiSettings();
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
void save();
|
|
|
|
inline void addRow(const ComponentListRow& row) { mMenu.addRow(row); };
|
|
|
|
inline void addWithLabel(const std::string& label,
|
|
|
|
const std::shared_ptr<GuiComponent>& comp) { mMenu.addWithLabel(label, comp); };
|
2020-11-05 17:18:11 +00:00
|
|
|
void addEditableTextComponent(const std::string label, std::shared_ptr<GuiComponent> ed,
|
|
|
|
std::string value, std::string defaultValue = "");
|
2020-06-23 18:07:00 +00:00
|
|
|
inline void addSaveFunc(const std::function<void()>& func) { mSaveFuncs.push_back(func); };
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2020-11-05 17:18:11 +00:00
|
|
|
void setNeedsSaving() { mNeedsSaving = true; };
|
|
|
|
void setNeedsGoToStart() { mNeedsGoToStart = true; };
|
|
|
|
void setNeedsReloading() { mNeedsReloading = true; };
|
|
|
|
void setNeedsSorting() { mNeedsSorting = true; };
|
|
|
|
void setNeedsSortingCollections() { mNeedsSortingCollections = true; };
|
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
bool input(InputConfig* config, Input input) override;
|
|
|
|
std::vector<HelpPrompt> getHelpPrompts() override;
|
|
|
|
HelpStyle getHelpStyle() override;
|
2014-06-25 16:29:58 +00:00
|
|
|
|
|
|
|
private:
|
2020-06-23 18:07:00 +00:00
|
|
|
MenuComponent mMenu;
|
2020-11-05 17:18:11 +00:00
|
|
|
std::vector<std::function<void()>> mSaveFuncs;
|
|
|
|
bool mNeedsSaving;
|
|
|
|
bool mNeedsGoToStart;
|
|
|
|
bool mNeedsReloading;
|
|
|
|
bool mNeedsSorting;
|
|
|
|
bool mNeedsSortingCollections;
|
2017-10-31 17:12:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ES_APP_GUIS_GUI_SETTINGS_H
|