summaryrefslogtreecommitdiff
path: root/gui/include/preferences.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/include/preferences.hpp')
-rw-r--r--gui/include/preferences.hpp58
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