From d7e133846015d005768e5588a6dd926fed4d3f04 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 28 Apr 2025 13:31:44 +0200 Subject: adw: implement EntryRow --- adw/src/entryrow.cpp | 282 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 adw/src/entryrow.cpp (limited to 'adw/src/entryrow.cpp') diff --git a/adw/src/entryrow.cpp b/adw/src/entryrow.cpp new file mode 100644 index 0000000..b6053fd --- /dev/null +++ b/adw/src/entryrow.cpp @@ -0,0 +1,282 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#include "adwaitamm/entryrow.hpp" + +#include "adwaitamm/preferencesrow.hpp" +#include "adwaitamm/private/entryrow_p.hpp" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace Adwaita +{ + namespace + { + auto constinit _class = EntryRow_Class{}; + + namespace property_name + { + auto constexpr activates_default = "activates-default"; + auto constexpr attributes = "attributes"; + auto constexpr enable_emoji_completion = "enable-emoji-completion"; + auto constexpr input_hints = "input-hints"; + auto constexpr input_purpose = "input-purpose"; + auto constexpr max_length = "max-length"; + auto constexpr show_apply_button = "show-apply-button"; + auto constexpr text_length = "text-length"; + } // namespace property_name + + namespace signal_info + { + auto const apply = Glib::SignalProxyInfo{ + "apply", + reinterpret_cast(&Glib::SignalProxyNormal::slot0_void_callback), + reinterpret_cast(&Glib::SignalProxyNormal::slot0_void_callback), + }; + + auto const entry_activated = Glib::SignalProxyInfo{ + "entry-activated", + reinterpret_cast(&Glib::SignalProxyNormal::slot0_void_callback), + reinterpret_cast(&Glib::SignalProxyNormal::slot0_void_callback), + }; + + } // namespace signal_info + } // namespace + + EntryRow::EntryRow() + : Glib::ObjectBase{nullptr} + , PreferencesRow{Glib::ConstructParams{_class.init()}} + { + } + + auto EntryRow::get_type() -> GType + { + return _class.init().get_type(); + } + + auto EntryRow::get_base_type() -> GType + { + return adw_entry_row_get_type(); + } + + auto EntryRow::add_prefix(Gtk::Widget & widget) -> void + { + return adw_entry_row_add_prefix(unwrap(this), unwrap(&widget)); + } + + auto EntryRow::add_suffix(Gtk::Widget & widget) -> void + { + return adw_entry_row_add_suffix(unwrap(this), unwrap(&widget)); + } + + auto EntryRow::grab_focus_without_selecting() -> bool + { + return adw_entry_row_grab_focus_without_selecting(unwrap(this)); + } + + auto EntryRow::remove(Gtk::Widget & widget) -> void + { + return adw_entry_row_remove(unwrap(this), unwrap(&widget)); + } + + auto EntryRow::get_activates_default() const -> bool + { + return adw_entry_row_get_activates_default(const_cast(unwrap(this))); + } + + auto EntryRow::get_attributes() const -> Pango::AttrList + { + return Glib::wrap(adw_entry_row_get_attributes(const_cast(unwrap(this)))); + } + + auto EntryRow::get_enable_emoji_completion() const -> bool + { + return adw_entry_row_get_enable_emoji_completion(const_cast(unwrap(this))); + } + + auto EntryRow::get_input_hints() const -> Gtk::InputHints + { + return static_cast(adw_entry_row_get_input_hints(const_cast(unwrap(this)))); + } + + auto EntryRow::get_input_purpose() const -> Gtk::InputPurpose + { + return static_cast(adw_entry_row_get_input_purpose(const_cast(unwrap(this)))); + } + + auto EntryRow::get_max_length() const -> int + { + return adw_entry_row_get_max_length(const_cast(unwrap(this))); + } + + auto EntryRow::get_show_apply_button() const -> bool + { + return adw_entry_row_get_show_apply_button(const_cast(unwrap(this))); + } + + auto EntryRow::get_text_length() const -> unsigned int + { + return adw_entry_row_get_text_length(const_cast(unwrap(this))); + } + + auto EntryRow::set_activates_default(bool value) -> void + { + return adw_entry_row_set_activates_default(unwrap(this), value); + } + + auto EntryRow::set_attributes(Pango::AttrList & value) -> void + { + return adw_entry_row_set_attributes(unwrap(this), Glib::unwrap(&value)); + } + + auto EntryRow::set_enable_emoji_completion(bool value) -> void + { + return adw_entry_row_set_enable_emoji_completion(unwrap(this), value); + } + + auto EntryRow::set_input_hints(Gtk::InputHints value) -> void + { + return adw_entry_row_set_input_hints(unwrap(this), static_cast(value)); + } + + auto EntryRow::set_input_purpose(Gtk::InputPurpose value) -> void + { + return adw_entry_row_set_input_purpose(unwrap(this), static_cast(value)); + } + + auto EntryRow::set_max_length(int value) -> void + { + return adw_entry_row_set_max_length(unwrap(this), value); + } + + auto EntryRow::set_show_apply_button(bool value) -> void + { + return adw_entry_row_set_show_apply_button(unwrap(this), value); + } + + auto EntryRow::property_activates_default() -> Glib::PropertyProxy + { + return {this, property_name::activates_default}; + } + + auto EntryRow::property_activates_default() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::activates_default}; + } + + auto EntryRow::property_attributes() -> Glib::PropertyProxy + { + return {this, property_name::attributes}; + } + + auto EntryRow::property_attributes() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::attributes}; + } + + auto EntryRow::property_enable_emoji_completion() -> Glib::PropertyProxy + { + return {this, property_name::enable_emoji_completion}; + } + + auto EntryRow::property_enable_emoji_completion() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::enable_emoji_completion}; + } + + auto EntryRow::property_input_hints() -> Glib::PropertyProxy + { + return {this, property_name::input_hints}; + } + + auto EntryRow::property_input_hints() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::input_hints}; + } + + auto EntryRow::property_input_purpose() -> Glib::PropertyProxy + { + return {this, property_name::input_purpose}; + } + + auto EntryRow::property_input_purpose() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::input_purpose}; + } + + auto EntryRow::property_max_length() -> Glib::PropertyProxy + { + return {this, property_name::max_length}; + } + + auto EntryRow::property_max_length() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::max_length}; + } + + auto EntryRow::property_show_apply_button() -> Glib::PropertyProxy + { + return {this, property_name::show_apply_button}; + } + + auto EntryRow::property_show_apply_button() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::show_apply_button}; + } + + auto EntryRow::property_text_length() -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::text_length}; + } + + auto EntryRow::signal_apply() -> Glib::SignalProxy + { + return {this, &signal_info::apply}; + } + + auto EntryRow::signal_entry_activated() -> Glib::SignalProxy + { + return {this, &signal_info::entry_activated}; + } + + EntryRow::EntryRow(Glib::ConstructParams const & params) + : PreferencesRow{params} + { + } + + EntryRow::EntryRow(BaseObjectType * gobj) + : PreferencesRow(ADW_PREFERENCES_ROW(gobj)) + { + } + +} // namespace Adwaita + +namespace Glib +{ + auto wrap(AdwEntryRow * object, bool copy) -> Adwaita::EntryRow * + { + return dynamic_cast(Glib::wrap_auto(G_OBJECT(object), copy)); + } +} // namespace Glib \ No newline at end of file -- cgit v1.2.3