/** * @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 #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 signal_info { auto const static activated = Glib::SignalProxyInfo{ "activated", reinterpret_cast(&Glib::SignalProxyNormal::slot0_void_callback), reinterpret_cast(&Glib::SignalProxyNormal::slot0_void_callback), }; } // namespace signal_info } // namespace ActionRow::ActionRow() : Glib::ObjectBase{nullptr} , PreferencesRow{Glib::ConstructParams{_class.init()}} { } auto ActionRow::get_type() -> GType { return _class.init().get_type(); } auto ActionRow::get_base_type() -> GType { return adw_action_row_get_type(); } auto ActionRow::activate() -> void { return adw_action_row_activate(unwrap(this)); } auto ActionRow::add_prefix(Gtk::Widget & widget) -> void { return adw_action_row_add_prefix(unwrap(this), unwrap(&widget)); } auto ActionRow::add_suffix(Gtk::Widget & widget) -> void { return adw_action_row_add_suffix(unwrap(this), unwrap(&widget)); } auto ActionRow::remove(Gtk::Widget & widget) -> void { return adw_action_row_remove(unwrap(this), unwrap(&widget)); } auto ActionRow::get_activatable_widget() const noexcept -> Gtk::Widget * { return Glib::wrap(adw_action_row_get_activatable_widget(const_cast(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(unwrap(this))); #pragma GCC diagnostic pop } auto ActionRow::get_subtitle() const -> Glib::ustring { return adw_action_row_get_subtitle(const_cast(unwrap(this))); } auto ActionRow::get_subtitle_lines() const noexcept -> int { return adw_action_row_get_subtitle_lines(const_cast(unwrap(this))); } auto ActionRow::get_subtitle_selectable() const noexcept -> bool { return adw_action_row_get_subtitle_selectable(const_cast(unwrap(this))); } auto ActionRow::get_title_lines() const noexcept -> int { return adw_action_row_get_title_lines(const_cast(unwrap(this))); } auto ActionRow::set_activatable_widget(Gtk::Widget & widget) noexcept -> void { adw_action_row_set_activatable_widget(unwrap(this), 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(unwrap(this), name.c_str()); #pragma GCC diagnostic pop } auto ActionRow::set_subtitle(Glib::ustring const & subtitle) -> void { adw_action_row_set_subtitle(unwrap(this), subtitle.c_str()); } auto ActionRow::set_subtitle_lines(int subtitle_lines) noexcept -> void { adw_action_row_set_subtitle_lines(unwrap(this), subtitle_lines); } auto ActionRow::set_subtitle_selectable(bool subtitle_selectable) noexcept -> void { adw_action_row_set_subtitle_selectable(unwrap(this), static_cast(subtitle_selectable)); } auto ActionRow::set_title_lines(int title_lines) noexcept -> void { adw_action_row_set_title_lines(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); } auto ActionRow::signal_activated() -> Glib::SignalProxy { return Glib::SignalProxy{this, &signal_info::activated}; } auto ActionRow::activate_vfunc() -> void { auto base_object = static_cast(g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_))); if (base_object && base_object->activate) { (base_object->activate)(unwrap(this)); } } ActionRow::ActionRow(Glib::ConstructParams const & params) : PreferencesRow{params} { } ActionRow::ActionRow(BaseObjectType * gobj) : PreferencesRow(ADW_PREFERENCES_ROW(gobj)) { } } // namespace Adwaita namespace Glib { auto wrap(AdwActionRow * object, bool copy) -> Adwaita::ActionRow * { return dynamic_cast(Glib::wrap_auto(G_OBJECT(object), copy)); } } // namespace Glib