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/include/adwaitamm/entryrow.hpp | 122 +++++++++++++++++++++++++++ adw/include/adwaitamm/private/entryrow_p.hpp | 35 ++++++++ 2 files changed, 157 insertions(+) create mode 100644 adw/include/adwaitamm/entryrow.hpp create mode 100644 adw/include/adwaitamm/private/entryrow_p.hpp (limited to 'adw/include/adwaitamm') diff --git a/adw/include/adwaitamm/entryrow.hpp b/adw/include/adwaitamm/entryrow.hpp new file mode 100644 index 0000000..16f0f3b --- /dev/null +++ b/adw/include/adwaitamm/entryrow.hpp @@ -0,0 +1,122 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef LIBADWAITAMM_ENTRY_ROW_HPP +#define LIBADWAITAMM_ENTRY_ROW_HPP + +#include "adwaitamm/helpers/gobj_mixin.hpp" +#include "adwaitamm/preferencesrow.hpp" + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#define _ADWAITA_INSIDE +#include +#undef _ADWAITA_INSIDE + +namespace Adwaita +{ + struct EntryRow : PreferencesRow, + Gtk::Editable, + helpers::gobj_mixin + { + using BaseObjectType = AdwEntryRow; + using BaseClassType = AdwEntryRowClass; + using CppObjectType = struct EntryRow; + using CppClassType = struct EntryRow_Class; + + using helpers::gobj_mixin::gobj; + using helpers::gobj_mixin::gobj_copy; + +#pragma mark - Special Member Functions + explicit EntryRow(); + EntryRow(EntryRow const & other) = delete; + EntryRow(EntryRow && other) noexcept = default; + + auto operator=(EntryRow const & other) noexcept -> EntryRow & = delete; + auto operator=(EntryRow && other) noexcept -> EntryRow & = default; + +#pragma mark - GObject Support + auto static get_type() -> GType; + auto static get_base_type() -> GType; + +#pragma mark - Functions + auto add_prefix(Gtk::Widget & widget) -> void; + auto add_suffix(Gtk::Widget & widget) -> void; + auto grab_focus_without_selecting() -> bool; + auto remove(Gtk::Widget & widget) -> void; + +#pragma mark - Getters + [[nodiscard]] auto get_activates_default() const -> bool; + [[nodiscard]] auto get_attributes() const -> Pango::AttrList; + [[nodiscard]] auto get_enable_emoji_completion() const -> bool; + [[nodiscard]] auto get_input_hints() const -> Gtk::InputHints; + [[nodiscard]] auto get_input_purpose() const -> Gtk::InputPurpose; + [[nodiscard]] auto get_max_length() const -> int; + [[nodiscard]] auto get_show_apply_button() const -> bool; + [[nodiscard]] auto get_text_length() const -> unsigned int; + +#pragma mark - Setters + auto set_activates_default(bool value) -> void; + auto set_attributes(Pango::AttrList & value) -> void; + auto set_enable_emoji_completion(bool value) -> void; + auto set_input_hints(Gtk::InputHints value) -> void; + auto set_input_purpose(Gtk::InputPurpose value) -> void; + auto set_max_length(int value) -> void; + auto set_show_apply_button(bool value) -> void; + +#pragma mark - Properties + [[nodiscard]] auto property_activates_default() -> Glib::PropertyProxy; + [[nodiscard]] auto property_activates_default() const -> Glib::PropertyProxy_ReadOnly; + [[nodiscard]] auto property_attributes() -> Glib::PropertyProxy; + [[nodiscard]] auto property_attributes() const -> Glib::PropertyProxy_ReadOnly; + [[nodiscard]] auto property_enable_emoji_completion() -> Glib::PropertyProxy; + [[nodiscard]] auto property_enable_emoji_completion() const -> Glib::PropertyProxy_ReadOnly; + [[nodiscard]] auto property_input_hints() -> Glib::PropertyProxy; + [[nodiscard]] auto property_input_hints() const -> Glib::PropertyProxy_ReadOnly; + [[nodiscard]] auto property_input_purpose() -> Glib::PropertyProxy; + [[nodiscard]] auto property_input_purpose() const -> Glib::PropertyProxy_ReadOnly; + [[nodiscard]] auto property_max_length() -> Glib::PropertyProxy; + [[nodiscard]] auto property_max_length() const -> Glib::PropertyProxy_ReadOnly; + [[nodiscard]] auto property_show_apply_button() -> Glib::PropertyProxy; + [[nodiscard]] auto property_show_apply_button() const -> Glib::PropertyProxy_ReadOnly; + [[nodiscard]] auto property_text_length() -> Glib::PropertyProxy_ReadOnly; + +#pragma mark - Signals + auto signal_apply() -> Glib::SignalProxy; + auto signal_entry_activated() -> Glib::SignalProxy; + + protected: + friend EntryRow_Class; + +#pragma mark - Internal Constructors + explicit EntryRow(Glib::ConstructParams const & params); + explicit EntryRow(BaseObjectType * gobj); + }; + +} // namespace Adwaita + +namespace Glib +{ + auto wrap(AdwEntryRow * object, bool copy = false) -> Adwaita::EntryRow *; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/private/entryrow_p.hpp b/adw/include/adwaitamm/private/entryrow_p.hpp new file mode 100644 index 0000000..903776f --- /dev/null +++ b/adw/include/adwaitamm/private/entryrow_p.hpp @@ -0,0 +1,35 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef LIBADWAITAMM_PRIVATE_ENTRY_ROW_P_HPP +#define LIBADWAITAMM_PRIVATE_ENTRY_ROW_P_HPP + +#include "adwaitamm/private/preferencesrow_p.hpp" + +#include +#include + +#define _ADWAITA_INSIDE +#include +#undef _ADWAITA_INSIDE + +namespace Adwaita +{ + struct EntryRow_Class : Glib::Class + { + using BaseClassParent = AdwPreferencesRowClass; + using BaseClassType = AdwEntryRowClass; + using BaseObjectType = AdwEntryRow; + using CppClassParent = PreferencesRow_Class; + using CppObjectType = struct EntryRow; + + auto init() -> Glib::Class const &; + auto static class_init_function(void * gclass, void * data) -> void; + auto static wrap_new(GObject * object) -> Glib::ObjectBase *; + }; +} // namespace Adwaita + +#endif \ No newline at end of file -- cgit v1.2.3