From 7b7374b220b51f73b76823762666d9e8b82dccf4 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 17 Aug 2024 13:52:39 +0200 Subject: ui: add color reset buttons Implements: #7 --- ui/include/turns/ui/widgets/preferences.hpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'ui/include') diff --git a/ui/include/turns/ui/widgets/preferences.hpp b/ui/include/turns/ui/widgets/preferences.hpp index 21b6eef..749d4fd 100644 --- a/ui/include/turns/ui/widgets/preferences.hpp +++ b/ui/include/turns/ui/widgets/preferences.hpp @@ -1,14 +1,15 @@ #ifndef TURNS_UI_WIDGETS_PREFERENCES_HPP #define TURNS_UI_WIDGETS_PREFERENCES_HPP -#include "turns/adw/actionrow.hpp" #include "turns/adw/preferencespage.hpp" #include "turns/ui/widgets/template_widget.hpp" #include +#include #include +#include #include #include @@ -19,23 +20,29 @@ namespace turns::ui::widgets { auto constexpr inline static children = std::array{ - "friendly", - "hostile", - "secret", + "friendly_reset_button", + "hostile_reset_button", + "secret_reset_button", + "friendly_color_button", + "hostile_color_button", + "secret_color_button", }; explicit preferences(Glib::RefPtr settings = {}); private: - Glib::RefPtr m_settings; + 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; - adw::ActionRow * m_friendly; - adw::ActionRow * m_hostile; - adw::ActionRow * m_secret; + Glib::RefPtr m_settings; - Gtk::ColorDialogButton m_friendly_button{}; - Gtk::ColorDialogButton m_hostile_button{}; - Gtk::ColorDialogButton m_secret_button{}; + 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{}; }; } // namespace turns::ui::widgets -- cgit v1.2.3