summaryrefslogtreecommitdiff
path: root/adw/src/comborow.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2025-04-28 12:11:23 +0200
committerFelix Morgner <felix.morgner@gmail.com>2025-04-28 12:11:23 +0200
commit6378909a3d85f7f65b5ba5c116d950f96342fed4 (patch)
treeaae227e4f97348346ea02884fca476778ad660d7 /adw/src/comborow.cpp
parent0b4f979c001835b20ff75a848eee83f59c1397c0 (diff)
downloadturns-6378909a3d85f7f65b5ba5c116d950f96342fed4.tar.xz
turns-6378909a3d85f7f65b5ba5c116d950f96342fed4.zip
adw: implement ComboRow
Diffstat (limited to 'adw/src/comborow.cpp')
-rw-r--r--adw/src/comborow.cpp273
1 files changed, 273 insertions, 0 deletions
diff --git a/adw/src/comborow.cpp b/adw/src/comborow.cpp
new file mode 100644
index 0000000..27e97fe
--- /dev/null
+++ b/adw/src/comborow.cpp
@@ -0,0 +1,273 @@
+/**
+ * @author Felix Morgner (felix.morgner@gmail.com)
+ * @copyright Copyright (c) 2025
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "adwaitamm/comborow.hpp"
+
+#include "adwaitamm/actionrow.hpp"
+#include "adwaitamm/private/comborow_p.hpp"
+
+#include <glibmm/object.h>
+#include <glibmm/objectbase.h>
+#include <glibmm/propertyproxy.h>
+#include <glibmm/refptr.h>
+#include <glibmm/ustring.h>
+#include <glibmm/wrap.h>
+
+#include <giomm/listmodel.h>
+
+#include <gtkmm/expression.h>
+#include <gtkmm/listitemfactory.h>
+#include <gtkmm/stringfilter.h>
+
+#include <glib-object.h>
+#include <gtk/gtkdropdown.h>
+
+namespace Adwaita
+{
+ namespace
+ {
+ auto constinit _class = ComboRow_Class{};
+
+ namespace property_name
+ {
+ auto constexpr enable_search = "enable_search";
+ auto constexpr expression = "expression";
+ auto constexpr factory = "factory";
+ auto constexpr header_factory = "header-factory";
+ auto constexpr list_factory = "list-factory";
+ auto constexpr model = "model";
+ auto constexpr search_match_mode = "search-match-mode";
+ auto constexpr selected = "selected";
+ auto constexpr selected_item = "selected-item";
+ auto constexpr use_subtitle = "use-subtitle";
+ } // namespace property_name
+ } // namespace
+
+ ComboRow::ComboRow()
+ : Glib::ObjectBase{nullptr}
+ , ActionRow{Glib::ConstructParams{_class.init()}}
+ {
+ }
+
+ auto ComboRow::get_type() -> GType
+ {
+ return _class.init().get_type();
+ }
+
+ auto ComboRow::get_base_type() -> GType
+ {
+ return adw_combo_row_get_type();
+ }
+
+ auto ComboRow::get_enable_search() const -> bool
+ {
+ return adw_combo_row_get_enable_search(const_cast<BaseObjectType *>(unwrap(this)));
+ }
+
+ auto ComboRow::get_expression() const -> Glib::RefPtr<Gtk::Expression<Glib::ustring>>
+ {
+ return Glib::wrap<Glib::ustring>(adw_combo_row_get_expression(const_cast<BaseObjectType *>(unwrap(this))), true);
+ }
+
+ auto ComboRow::get_factory() const -> Glib::RefPtr<Gtk::ListItemFactory>
+ {
+ return Glib::wrap(adw_combo_row_get_factory(const_cast<BaseObjectType *>(unwrap(this))), true);
+ }
+
+ auto ComboRow::get_header_factory() const -> Glib::RefPtr<Gtk::ListItemFactory>
+ {
+ return Glib::wrap(adw_combo_row_get_header_factory(const_cast<BaseObjectType *>(unwrap(this))), true);
+ }
+
+ auto ComboRow::get_list_factory() const -> Glib::RefPtr<Gtk::ListItemFactory>
+ {
+ return Glib::wrap(adw_combo_row_get_list_factory(const_cast<BaseObjectType *>(unwrap(this))), true);
+ }
+
+ auto ComboRow::get_model() const -> Glib::RefPtr<Gio::ListModel>
+ {
+ return Glib::wrap(adw_combo_row_get_model(const_cast<BaseObjectType *>(unwrap(this))), true);
+ }
+
+ auto ComboRow::get_search_match_mode() const -> Gtk::StringFilter::MatchMode
+ {
+ return static_cast<Gtk::StringFilter::MatchMode>(adw_combo_row_get_search_match_mode(const_cast<BaseObjectType *>(unwrap(this))));
+ }
+
+ auto ComboRow::get_selected() const -> unsigned int
+ {
+ return adw_combo_row_get_selected(const_cast<BaseObjectType *>(unwrap(this)));
+ }
+
+ auto ComboRow::get_selected_item() const -> Glib::RefPtr<Glib::Object>
+ {
+ return Glib::wrap(G_OBJECT(adw_combo_row_get_selected_item(const_cast<BaseObjectType *>(unwrap(this)))));
+ }
+
+ auto ComboRow::get_use_subtitle() const -> bool
+ {
+ return adw_combo_row_get_use_subtitle(const_cast<BaseObjectType *>(unwrap(this)));
+ }
+
+ auto ComboRow::set_enable_search(bool value) -> void
+ {
+ return adw_combo_row_set_enable_search(unwrap(this), value);
+ }
+
+ auto ComboRow::set_expression(Glib::RefPtr<Gtk::Expression<Glib::ustring>> const & value) -> void
+ {
+ return adw_combo_row_set_expression(unwrap(this), value ? value->gobj() : nullptr);
+ }
+
+ auto ComboRow::set_factory(Glib::RefPtr<Gtk::ListItemFactory> const & value) -> void
+ {
+ return adw_combo_row_set_factory(unwrap(this), value ? value->gobj() : nullptr);
+ }
+
+ auto ComboRow::set_header_factory(Glib::RefPtr<Gtk::ListItemFactory> const & value) -> void
+ {
+ return adw_combo_row_set_header_factory(unwrap(this), value ? value->gobj() : nullptr);
+ }
+
+ auto ComboRow::set_list_factory(Glib::RefPtr<Gtk::ListItemFactory> const & value) -> void
+ {
+ return adw_combo_row_set_list_factory(unwrap(this), value ? value->gobj() : nullptr);
+ }
+
+ auto ComboRow::set_model(Glib::RefPtr<Gio::ListModel> const & value) -> void
+ {
+ return adw_combo_row_set_model(unwrap(this), value ? value->gobj() : nullptr);
+ }
+
+ auto ComboRow::set_search_match_mode(Gtk::StringFilter::MatchMode value) -> void
+ {
+ return adw_combo_row_set_search_match_mode(unwrap(this), static_cast<GtkStringFilterMatchMode>(value));
+ }
+
+ auto ComboRow::set_selected(unsigned int value) -> void
+ {
+ return adw_combo_row_set_selected(unwrap(this), value);
+ }
+
+ auto ComboRow::set_use_subtitle(bool value) -> void
+ {
+ return adw_combo_row_set_use_subtitle(unwrap(this), value);
+ }
+
+ auto ComboRow::property_enable_search() -> Glib::PropertyProxy<bool>
+ {
+ return {this, property_name::enable_search};
+ }
+
+ auto ComboRow::property_enable_search() const -> Glib::PropertyProxy_ReadOnly<bool>
+ {
+ return {this, property_name::enable_search};
+ }
+
+ auto ComboRow::property_expression() -> Glib::PropertyProxy<Glib::RefPtr<Gtk::Expression<Glib::ustring>>>
+ {
+ return {this, property_name::expression};
+ }
+
+ auto ComboRow::property_expression() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gtk::Expression<Glib::ustring>>>
+ {
+ return {this, property_name::expression};
+ }
+
+ auto ComboRow::property_factory() -> Glib::PropertyProxy<Glib::RefPtr<Gtk::ListItemFactory>>
+ {
+ return {this, property_name::factory};
+ }
+
+ auto ComboRow::property_factory() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gtk::ListItemFactory>>
+ {
+ return {this, property_name::factory};
+ }
+
+ auto ComboRow::property_header_factory() -> Glib::PropertyProxy<Glib::RefPtr<Gtk::ListItemFactory>>
+ {
+ return {this, property_name::header_factory};
+ }
+
+ auto ComboRow::property_header_factory() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gtk::ListItemFactory>>
+ {
+ return {this, property_name::header_factory};
+ }
+
+ auto ComboRow::property_list_factory() -> Glib::PropertyProxy<Glib::RefPtr<Gtk::ListItemFactory>>
+ {
+ return {this, property_name::list_factory};
+ }
+
+ auto ComboRow::property_list_factory() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gtk::ListItemFactory>>
+ {
+ return {this, property_name::list_factory};
+ }
+
+ auto ComboRow::property_model() -> Glib::PropertyProxy<Glib::RefPtr<Gio::ListModel>>
+ {
+ return {this, property_name::model};
+ }
+
+ auto ComboRow::property_model() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gio::ListModel>>
+ {
+ return {this, property_name::model};
+ }
+
+ auto ComboRow::property_search_match_mode() -> Glib::PropertyProxy<Gtk::StringFilter::MatchMode>
+ {
+ return {this, property_name::search_match_mode};
+ }
+
+ auto ComboRow::property_search_match_mode() const -> Glib::PropertyProxy_ReadOnly<Gtk::StringFilter::MatchMode>
+ {
+ return {this, property_name::search_match_mode};
+ }
+
+ auto ComboRow::property_selected() -> Glib::PropertyProxy<unsigned int>
+ {
+ return {this, property_name::selected};
+ }
+
+ auto ComboRow::property_selected() const -> Glib::PropertyProxy_ReadOnly<unsigned int>
+ {
+ return {this, property_name::selected};
+ }
+
+ auto ComboRow::property_selected_item() -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Glib::Object>>
+ {
+ return {this, property_name::selected_item};
+ }
+
+ auto ComboRow::property_use_subtitle() -> Glib::PropertyProxy<bool>
+ {
+ return {this, property_name::use_subtitle};
+ }
+
+ auto ComboRow::property_use_subtitle() const -> Glib::PropertyProxy_ReadOnly<bool>
+ {
+ return {this, property_name::use_subtitle};
+ }
+
+ ComboRow::ComboRow(Glib::ConstructParams const & params)
+ : ActionRow{params}
+ {
+ }
+
+ ComboRow::ComboRow(BaseObjectType * gobj)
+ : ActionRow(ADW_ACTION_ROW(gobj))
+ {
+ }
+
+} // namespace Adwaita
+
+namespace Glib
+{
+ auto wrap(AdwComboRow * object, bool copy) -> Adwaita::ComboRow *
+ {
+ return dynamic_cast<Adwaita::ComboRow *>(Glib::wrap_auto(G_OBJECT(object), copy));
+ }
+} // namespace Glib \ No newline at end of file