/** * @author Felix Morgner (felix.morgner@gmail.com) * @copyright Copyright (c) 2025 * SPDX-License-Identifier: LGPL-2.1-or-later */ #include "adwaitamm/actionrow.hpp" #include "adwaitamm/preferencesrow.hpp" #include "adwaitamm/private/actionrow_p.hpp" #include #include #include #include #include #include #include #include #include namespace Adwaita { namespace { auto constinit _class = ActionRow_Class{}; namespace property_name { auto constexpr activatable_widget = "activatable-widget"; auto constexpr icon_name = "icon-name"; auto constexpr subtitle = "subtitle"; auto constexpr subtitle_lines = "subtitle-lines"; auto constexpr subtitle_selectable = "subtitle-selectable"; auto constexpr title_lines = "title-lines"; } // namespace property_name } // namespace auto ActionRow::get_type() -> GType { return _class.init().get_type(); } auto ActionRow::get_base_type() -> GType { return adw_action_row_get_type(); } ActionRow::ActionRow() : Glib::ObjectBase{nullptr} , PreferencesRow{Glib::ConstructParams{_class.init()}} { } ActionRow::ActionRow(Glib::ConstructParams const & params) : PreferencesRow{params} { } ActionRow::ActionRow(BaseObjectType * gobj) : PreferencesRow(ADW_PREFERENCES_ROW(gobj)) { } auto ActionRow::add_prefix(Gtk::Widget & widget) -> void { adw_action_row_add_prefix(Glib::unwrap(this), Glib::unwrap(&widget)); } auto ActionRow::add_suffix(Gtk::Widget & widget) -> void { adw_action_row_add_suffix(Glib::unwrap(this), Glib::unwrap(&widget)); } auto ActionRow::remove(Gtk::Widget & widget) -> void { adw_action_row_remove(Glib::unwrap(this), Glib::unwrap(&widget)); } auto ActionRow::get_activatable_widget() const noexcept -> Glib::RefPtr { return Glib::make_refptr_for_instance(Glib::wrap(adw_action_row_get_activatable_widget(const_cast(Glib::unwrap(this))))); } auto ActionRow::get_icon_name() const -> Glib::ustring { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" return adw_action_row_get_icon_name(const_cast(Glib::unwrap(this))); #pragma GCC diagnostic pop } auto ActionRow::get_subtitle() const -> Glib::ustring { return adw_action_row_get_subtitle(const_cast(Glib::unwrap(this))); } auto ActionRow::get_subtitle_lines() const noexcept -> int { return adw_action_row_get_subtitle_lines(const_cast(Glib::unwrap(this))); } auto ActionRow::get_subtitle_selectable() const noexcept -> bool { return adw_action_row_get_subtitle_selectable(const_cast(Glib::unwrap(this))); } auto ActionRow::get_title_lines() const noexcept -> int { 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 Glib::PropertyProxy(this, property_name::activatable_widget); } auto ActionRow::property_activatable_widget() const noexcept -> Glib::PropertyProxy_ReadOnly { return Glib::PropertyProxy_ReadOnly(this, property_name::activatable_widget); } auto ActionRow::property_icon_name() noexcept -> Glib::PropertyProxy { return Glib::PropertyProxy(this, property_name::icon_name); } auto ActionRow::property_icon_name() const noexcept -> Glib::PropertyProxy_ReadOnly { return Glib::PropertyProxy_ReadOnly(this, property_name::icon_name); } auto ActionRow::property_subtitle() noexcept -> Glib::PropertyProxy { return Glib::PropertyProxy(this, property_name::subtitle); } auto ActionRow::property_subtitle() const noexcept -> Glib::PropertyProxy_ReadOnly { return Glib::PropertyProxy_ReadOnly(this, property_name::subtitle); } auto ActionRow::property_subtitle_lines() noexcept -> Glib::PropertyProxy { return Glib::PropertyProxy(this, property_name::subtitle_lines); } auto ActionRow::property_subtitle_lines() const noexcept -> Glib::PropertyProxy_ReadOnly { return Glib::PropertyProxy_ReadOnly(this, property_name::subtitle_lines); } auto ActionRow::property_subtitle_selectable() noexcept -> Glib::PropertyProxy { return Glib::PropertyProxy(this, property_name::subtitle_selectable); } auto ActionRow::property_subtitle_selectable() const noexcept -> Glib::PropertyProxy_ReadOnly { return Glib::PropertyProxy_ReadOnly(this, property_name::subtitle_selectable); } auto ActionRow::property_title_lines() noexcept -> Glib::PropertyProxy { return Glib::PropertyProxy(this, property_name::title_lines); } auto ActionRow::property_title_lines() const noexcept -> Glib::PropertyProxy_ReadOnly { return Glib::PropertyProxy_ReadOnly(this, property_name::title_lines); } } // namespace Adwaita namespace Glib { auto wrap(AdwActionRow * object, bool copy) -> Adwaita::ActionRow * { return dynamic_cast(Glib::wrap_auto(G_OBJECT(object), copy)); } } // namespace Glib