diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-05-24 11:58:39 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-05-24 11:58:39 +0200 |
| commit | 72ab1fb4c1bf363f46470816d8b914a78ac493c4 (patch) | |
| tree | 27349a1bacbab4ea698be35d2d3d9b5184b15ca1 /gui/include/preferences.hpp | |
| parent | b7f2ff4d991ae068f7834bf8e565f6261bf7fff1 (diff) | |
| download | turns-72ab1fb4c1bf363f46470816d8b914a78ac493c4.tar.xz turns-72ab1fb4c1bf363f46470816d8b914a78ac493c4.zip | |
gui: restructure file layout and apply licenses
Diffstat (limited to 'gui/include/preferences.hpp')
| -rw-r--r-- | gui/include/preferences.hpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/gui/include/preferences.hpp b/gui/include/preferences.hpp new file mode 100644 index 0000000..c5bace3 --- /dev/null +++ b/gui/include/preferences.hpp @@ -0,0 +1,58 @@ +/* + * SPDX-FileCopyrightText: 2025 Felix Morgner <felix.morgner@gmail.com> + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#ifndef TURNS_UI_PREFERENCES_HPP +#define TURNS_UI_PREFERENCES_HPP + +#include "turns/ui/template_widget.hpp" + +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <giomm/settings.h> + +#include <gtkmm/button.h> +#include <gtkmm/colordialogbutton.h> + +#include <adwaitamm/preferencespage.hpp> +#include <adwaitamm/switchrow.hpp> + +#include <array> + +namespace turns::ui +{ + struct Preferences : template_widget<Preferences, Adwaita::PreferencesPage> + { + + auto constexpr inline static children = std::array{ + "friendly_reset_button", + "hostile_reset_button", + "secret_reset_button", + "friendly_color_button", + "hostile_color_button", + "secret_color_button", + "skip_defeated", + }; + + explicit Preferences(Glib::RefPtr<Gio::Settings> settings = {}); + + private: + auto bind_reset(Glib::ustring const & key, Gtk::Button * button) -> void; + auto bind_setting(Glib::ustring const & key, Gtk::ColorDialogButton * button) -> void; + auto update_sensitive(Glib::ustring const & key, Gtk::Button * button) -> void; + + Glib::RefPtr<Gio::Settings> m_settings; + + Gtk::Button * m_friendly_reset_button{}; + Gtk::Button * m_hostile_reset_button{}; + Gtk::Button * m_secret_reset_button{}; + Gtk::ColorDialogButton * m_friendly_color_button{}; + Gtk::ColorDialogButton * m_hostile_color_button{}; + Gtk::ColorDialogButton * m_secret_color_button{}; + Adwaita::SwitchRow * m_skip_defeated{}; + }; +} // namespace turns::ui::widgets + +#endif
\ No newline at end of file |
