diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-04-28 12:11:23 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-04-28 12:11:23 +0200 |
| commit | 6378909a3d85f7f65b5ba5c116d950f96342fed4 (patch) | |
| tree | aae227e4f97348346ea02884fca476778ad660d7 /adw/include/adwaitamm | |
| parent | 0b4f979c001835b20ff75a848eee83f59c1397c0 (diff) | |
| download | turns-6378909a3d85f7f65b5ba5c116d950f96342fed4.tar.xz turns-6378909a3d85f7f65b5ba5c116d950f96342fed4.zip | |
adw: implement ComboRow
Diffstat (limited to 'adw/include/adwaitamm')
| -rw-r--r-- | adw/include/adwaitamm/comborow.hpp | 116 | ||||
| -rw-r--r-- | adw/include/adwaitamm/private/comborow_p.hpp | 35 |
2 files changed, 151 insertions, 0 deletions
diff --git a/adw/include/adwaitamm/comborow.hpp b/adw/include/adwaitamm/comborow.hpp new file mode 100644 index 0000000..416c693 --- /dev/null +++ b/adw/include/adwaitamm/comborow.hpp @@ -0,0 +1,116 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef LIBADWAITAMM_COMBO_ROW_HPP +#define LIBADWAITAMM_COMBO_ROW_HPP + +#include "adwaitamm/actionrow.hpp" +#include "adwaitamm/helpers/gobj_mixin.hpp" + +#include <glibmm/object.h> +#include <glibmm/propertyproxy.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <giomm/listmodel.h> + +#include <gtkmm/expression.h> +#include <gtkmm/listitemfactory.h> +#include <gtkmm/stringfilter.h> + +#include <glib-object.h> + +#define _ADWAITA_INSIDE +#include <adw-combo-row.h> +#undef _ADWAITA_INSIDE + +using AdwComboRow = struct _AdwComboRow; + +namespace Adwaita +{ + struct ComboRow : ActionRow, + helpers::gobj_mixin<ComboRow, AdwComboRow> + { + using BaseObjectType = AdwComboRow; + using BaseClassType = AdwComboRowClass; + using CppObjectType = struct ComboRow; + using CppClassType = struct ComboRow_Class; + + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; + +#pragma mark - Special Member Functions + explicit ComboRow(); + ComboRow(ComboRow const & other) = delete; + ComboRow(ComboRow && other) noexcept = default; + + auto operator=(ComboRow const & other) noexcept -> ComboRow & = delete; + auto operator=(ComboRow && other) noexcept -> ComboRow & = default; + +#pragma mark - GObject Support + auto static get_type() -> GType; + auto static get_base_type() -> GType; + +#pragma mark - Getters + auto get_enable_search() const -> bool; + auto get_expression() const -> Glib::RefPtr<Gtk::Expression<Glib::ustring>>; + auto get_factory() const -> Glib::RefPtr<Gtk::ListItemFactory>; + auto get_header_factory() const -> Glib::RefPtr<Gtk::ListItemFactory>; + auto get_list_factory() const -> Glib::RefPtr<Gtk::ListItemFactory>; + auto get_model() const -> Glib::RefPtr<Gio::ListModel>; + auto get_search_match_mode() const -> Gtk::StringFilter::MatchMode; + auto get_selected() const -> unsigned int; + auto get_selected_item() const -> Glib::RefPtr<Glib::Object>; + auto get_use_subtitle() const -> bool; + +#pragma mark - Setters + auto set_enable_search(bool value) -> void; + auto set_expression(Glib::RefPtr<Gtk::Expression<Glib::ustring>> const & value) -> void; + auto set_factory(Glib::RefPtr<Gtk::ListItemFactory> const & value) -> void; + auto set_header_factory(Glib::RefPtr<Gtk::ListItemFactory> const & value) -> void; + auto set_list_factory(Glib::RefPtr<Gtk::ListItemFactory> const & value) -> void; + auto set_model(Glib::RefPtr<Gio::ListModel> const & value) -> void; + auto set_search_match_mode(Gtk::StringFilter::MatchMode value) -> void; + auto set_selected(unsigned int value) -> void; + auto set_use_subtitle(bool value) -> void; + +#pragma mark - Properties + auto property_enable_search() -> Glib::PropertyProxy<bool>; + auto property_enable_search() const -> Glib::PropertyProxy_ReadOnly<bool>; + auto property_expression() -> Glib::PropertyProxy<Glib::RefPtr<Gtk::Expression<Glib::ustring>>>; + auto property_expression() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gtk::Expression<Glib::ustring>>>; + auto property_factory() -> Glib::PropertyProxy<Glib::RefPtr<Gtk::ListItemFactory>>; + auto property_factory() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gtk::ListItemFactory>>; + auto property_header_factory() -> Glib::PropertyProxy<Glib::RefPtr<Gtk::ListItemFactory>>; + auto property_header_factory() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gtk::ListItemFactory>>; + auto property_list_factory() -> Glib::PropertyProxy<Glib::RefPtr<Gtk::ListItemFactory>>; + auto property_list_factory() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gtk::ListItemFactory>>; + auto property_model() -> Glib::PropertyProxy<Glib::RefPtr<Gio::ListModel>>; + auto property_model() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gio::ListModel>>; + auto property_search_match_mode() -> Glib::PropertyProxy<Gtk::StringFilter::MatchMode>; + auto property_search_match_mode() const -> Glib::PropertyProxy_ReadOnly<Gtk::StringFilter::MatchMode>; + auto property_selected() -> Glib::PropertyProxy<unsigned int>; + auto property_selected() const -> Glib::PropertyProxy_ReadOnly<unsigned int>; + auto property_selected_item() -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Glib::Object>>; + auto property_use_subtitle() -> Glib::PropertyProxy<bool>; + auto property_use_subtitle() const -> Glib::PropertyProxy_ReadOnly<bool>; + + protected: + friend ComboRow_Class; + +#pragma mark - Internal Constructors + explicit ComboRow(Glib::ConstructParams const & params); + explicit ComboRow(BaseObjectType * gobj); + }; + +} // namespace Adwaita + +namespace Glib +{ + auto wrap(AdwComboRow * object, bool copy = false) -> Adwaita::ComboRow *; +} // namespace Glib + +#endif
\ No newline at end of file diff --git a/adw/include/adwaitamm/private/comborow_p.hpp b/adw/include/adwaitamm/private/comborow_p.hpp new file mode 100644 index 0000000..e8c3683 --- /dev/null +++ b/adw/include/adwaitamm/private/comborow_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_COMBO_ROW_P_HPP +#define LIBADWAITAMM_PRIVATE_COMBO_ROW_P_HPP + +#include "adwaitamm/private/actionrow_p.hpp" + +#include <glibmm/class.h> +#include <glibmm/objectbase.h> + +#define _ADWAITA_INSIDE +#include <adw-combo-row.h> +#undef _ADWAITA_INSIDE + +namespace Adwaita +{ + struct ComboRow_Class : Glib::Class + { + using BaseClassParent = AdwActionRowClass; + using BaseClassType = AdwComboRowClass; + using BaseObjectType = AdwComboRow; + using CppClassParent = ActionRow_Class; + using CppObjectType = struct ComboRow; + + 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 |
