From b95258f419c62f7f38ec6128568df5897e4f5696 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 4 Apr 2025 22:15:41 +0200 Subject: adw: clean up property definitions --- adw/src/actionrow.cpp | 98 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 39 deletions(-) (limited to 'adw/src/actionrow.cpp') diff --git a/adw/src/actionrow.cpp b/adw/src/actionrow.cpp index 186cff8..297cefc 100644 --- a/adw/src/actionrow.cpp +++ b/adw/src/actionrow.cpp @@ -1,6 +1,5 @@ #include "adwaitamm/actionrow.hpp" -#include "adwaitamm/helpers/properties.hpp" #include "adwaitamm/preferencesrow.hpp" #include @@ -77,22 +76,19 @@ namespace Adwaita { } - auto ActionRow::add_prefix(Gtk::Widget & widget) -> ActionRow & + auto ActionRow::add_prefix(Gtk::Widget & widget) -> void { adw_action_row_add_prefix(Glib::unwrap(this), Glib::unwrap(&widget)); - return *this; } - auto ActionRow::add_suffix(Gtk::Widget & widget) -> ActionRow & + auto ActionRow::add_suffix(Gtk::Widget & widget) -> void { adw_action_row_add_suffix(Glib::unwrap(this), Glib::unwrap(&widget)); - return *this; } - auto ActionRow::remove(Gtk::Widget & widget) -> ActionRow & + auto ActionRow::remove(Gtk::Widget & widget) -> void { adw_action_row_remove(Glib::unwrap(this), Glib::unwrap(&widget)); - return *this; } auto ActionRow::get_activatable_widget() const noexcept -> Glib::RefPtr @@ -128,73 +124,97 @@ namespace Adwaita return adw_action_row_get_title_lines(const_cast(Glib::unwrap(this))); } + auto ActionRow::set_activatable_widget(Gtk::Widget & widget) noexcept -> void + { + adw_action_row_set_activatable_widget(Glib::unwrap(this), Glib::unwrap(&widget)); + } + + auto ActionRow::set_icon_name(Glib::ustring const & name) -> void + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + adw_action_row_set_icon_name(Glib::unwrap(this), name.c_str()); +#pragma GCC diagnostic pop + } + + auto ActionRow::set_subtitle(Glib::ustring const & subtitle) -> void + { + adw_action_row_set_subtitle(Glib::unwrap(this), subtitle.c_str()); + } + + auto ActionRow::set_subtitle_lines(int subtitle_lines) noexcept -> void + { + adw_action_row_set_subtitle_lines(Glib::unwrap(this), subtitle_lines); + } + + auto ActionRow::set_subtitle_selectable(bool subtitle_selectable) noexcept -> void + { + adw_action_row_set_subtitle_selectable(Glib::unwrap(this), static_cast(subtitle_selectable)); + } + + auto ActionRow::set_title_lines(int title_lines) noexcept -> void + { + adw_action_row_set_title_lines(Glib::unwrap(this), title_lines); + } + auto ActionRow::property_activatable_widget() noexcept -> Glib::PropertyProxy { - return helpers::make_property_proxy(*this, "activatable-widget"); + return Glib::PropertyProxy(this, "activatable-widget"); } - auto ActionRow::property_icon_name() noexcept -> Glib::PropertyProxy + auto ActionRow::property_activatable_widget() const noexcept -> Glib::PropertyProxy_ReadOnly { - return helpers::make_property_proxy(*this, "icon-name"); + return Glib::PropertyProxy_ReadOnly(this, "activatable-widget"); } - auto ActionRow::property_subtitle() noexcept -> Glib::PropertyProxy + auto ActionRow::property_icon_name() noexcept -> Glib::PropertyProxy { - return helpers::make_property_proxy(*this, "subtitle"); + return Glib::PropertyProxy(this, "icon-name"); } - auto ActionRow::property_subtitle_lines() noexcept -> Glib::PropertyProxy + auto ActionRow::property_icon_name() const noexcept -> Glib::PropertyProxy_ReadOnly { - return helpers::make_property_proxy(*this, "subtitle-lines"); + return Glib::PropertyProxy_ReadOnly(this, "icon-name"); } - auto ActionRow::property_subtitle_selectable() noexcept -> Glib::PropertyProxy + auto ActionRow::property_subtitle() noexcept -> Glib::PropertyProxy { - return helpers::make_property_proxy(*this, "subtitle-selectable"); + return Glib::PropertyProxy(this, "subtitle"); } - auto ActionRow::property_title_lines() noexcept -> Glib::PropertyProxy + auto ActionRow::property_subtitle() const noexcept -> Glib::PropertyProxy_ReadOnly { - return helpers::make_property_proxy(*this, "title-lines"); + return Glib::PropertyProxy_ReadOnly(this, "subtitle"); } - auto ActionRow::set_activatable_widget(Gtk::Widget & widget) noexcept -> CppObjectType & + auto ActionRow::property_subtitle_lines() noexcept -> Glib::PropertyProxy { - adw_action_row_set_activatable_widget(Glib::unwrap(this), Glib::unwrap(&widget)); - return *this; + return Glib::PropertyProxy(this, "subtitle-lines"); } - auto ActionRow::set_icon_name(Glib::ustring const & name) -> CppObjectType & + auto ActionRow::property_subtitle_lines() const noexcept -> Glib::PropertyProxy_ReadOnly { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - adw_action_row_set_icon_name(Glib::unwrap(this), name.c_str()); -#pragma GCC diagnostic pop - return *this; + return Glib::PropertyProxy_ReadOnly(this, "subtitle-lines"); } - auto ActionRow::set_subtitle(Glib::ustring const & subtitle) -> CppObjectType & + auto ActionRow::property_subtitle_selectable() noexcept -> Glib::PropertyProxy { - adw_action_row_set_subtitle(Glib::unwrap(this), subtitle.c_str()); - return *this; + return Glib::PropertyProxy(this, "subtitle-selectable"); } - auto ActionRow::set_subtitle_lines(int subtitle_lines) noexcept -> CppObjectType & + auto ActionRow::property_subtitle_selectable() const noexcept -> Glib::PropertyProxy_ReadOnly { - adw_action_row_set_subtitle_lines(Glib::unwrap(this), subtitle_lines); - return *this; + return Glib::PropertyProxy_ReadOnly(this, "subtitle-selectable"); } - auto ActionRow::set_subtitle_selectable(bool subtitle_selectable) noexcept -> CppObjectType & + auto ActionRow::property_title_lines() noexcept -> Glib::PropertyProxy { - adw_action_row_set_subtitle_selectable(Glib::unwrap(this), static_cast(subtitle_selectable)); - return *this; + return Glib::PropertyProxy(this, "title-lines"); } - auto ActionRow::set_title_lines(int title_lines) noexcept -> CppObjectType & + auto ActionRow::property_title_lines() const noexcept -> Glib::PropertyProxy_ReadOnly { - adw_action_row_set_title_lines(Glib::unwrap(this), title_lines); - return *this; + return Glib::PropertyProxy_ReadOnly(this, "title-lines"); } } // namespace Adwaita -- cgit v1.2.3