diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-08-17 13:52:39 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-08-17 13:52:39 +0200 |
| commit | 7b7374b220b51f73b76823762666d9e8b82dccf4 (patch) | |
| tree | 78b63ad583a802c7fb7325caff60797e2bb5fb65 /ui/include/turns | |
| parent | a98edafdaa4bb504d7253d4a67901d2a36eefabf (diff) | |
| download | turns-7b7374b220b51f73b76823762666d9e8b82dccf4.tar.xz turns-7b7374b220b51f73b76823762666d9e8b82dccf4.zip | |
ui: add color reset buttons
Implements: #7
Diffstat (limited to 'ui/include/turns')
| -rw-r--r-- | ui/include/turns/ui/widgets/preferences.hpp | 29 |
1 files changed, 18 insertions, 11 deletions
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 <glibmm/refptr.h> +#include <glibmm/ustring.h> #include <giomm/settings.h> +#include <gtkmm/button.h> #include <gtkmm/colordialogbutton.h> #include <array> @@ -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<Gio::Settings> settings = {}); private: - Glib::RefPtr<Gio::Settings> 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<Gio::Settings> 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 |
