looper/backends/ui/gtk/options_window.hpp

41 lines
1.2 KiB
C++
Raw Permalink Normal View History

#pragma once
#include <gtkmm.h>
#include <any>
#include <typeindex>
#include <set>
#include <options.hpp>
class UIBackendColumns : public Glib::Object {
public:
Glib::ustring backendId;
Glib::ustring backendName;
static Glib::RefPtr<UIBackendColumns> create(const Glib::ustring &id, const Glib::ustring &name);
protected:
UIBackendColumns(const Glib::ustring &id, const Glib::ustring &name);
};
class OptionsWindow : public Gtk::Window {
int mainBoxRow = 0;
Gtk::Box rootBox;
Gtk::Box btnBox;
Gtk::Button okBtn;
Gtk::Button cancelBtn;
Gtk::Button saveBtn;
Gtk::Button revertBtn;
Gtk::Label needsRestartLabel;
Gtk::Grid mainBox;
std::vector<Gtk::Widget*> optionWidgets;
std::set<std::string> modifiableOptions;
sigc::signal<void(std::string)> optionChanged;
bool savedOptionRequiresRestart = false;
void revert();
void save();
void add_option(Glib::ustring title, Gtk::Widget *widget, std::string key);
public:
2024-03-26 18:39:02 -07:00
sigc::signal<void()> optionsSaved;
template<class T>
void change_option(std::string key, T value) {
Looper::Options::set_option<T>(key, value);
optionChanged.emit(key);
}
OptionsWindow();
~OptionsWindow();
};