summaryrefslogtreecommitdiff
path: root/adw/src/actionrow.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2024-08-17 11:41:43 +0200
committerFelix Morgner <felix.morgner@gmail.com>2024-08-17 11:41:43 +0200
commitfb917713e55147c6b0de514924c4867d9e8d5894 (patch)
tree5668c2772759a5b4d01cbca15cc03ce36199cbed /adw/src/actionrow.cpp
parent46c93e74067de844b35c1249122fcf878a0db924 (diff)
downloadturns-fb917713e55147c6b0de514924c4867d9e8d5894.tar.xz
turns-fb917713e55147c6b0de514924c4867d9e8d5894.zip
ui: add participant shading color preferences
Diffstat (limited to 'adw/src/actionrow.cpp')
-rw-r--r--adw/src/actionrow.cpp142
1 files changed, 142 insertions, 0 deletions
diff --git a/adw/src/actionrow.cpp b/adw/src/actionrow.cpp
new file mode 100644
index 0000000..f45f7a3
--- /dev/null
+++ b/adw/src/actionrow.cpp
@@ -0,0 +1,142 @@
+#include "turns/adw/actionrow.hpp"
+
+#include "turns/adw/preferencesrow.hpp"
+
+#include <glibmm/class.h>
+#include <glibmm/object.h>
+#include <glibmm/objectbase.h>
+#include <glibmm/refptr.h>
+#include <glibmm/ustring.h>
+#include <glibmm/utility.h>
+#include <glibmm/wrap.h>
+
+#include <gtkmm/init.h>
+#include <gtkmm/listboxrow.h>
+#include <gtkmm/private/widget_p.h>
+
+#include <adwaita.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+namespace turns::adw
+{
+ namespace
+ {
+ auto constinit _class = ActionRow::Class{};
+ } // namespace
+
+ auto ActionRow::Class::init() -> Glib::Class const &
+ {
+ if (!gtype_)
+ {
+ class_init_func_ = &ActionRow::Class::class_init_function;
+ register_derived_type(adw_action_row_get_type());
+ }
+ return *this;
+ }
+
+ auto ActionRow::Class::class_init_function(void * gclass, void * data) -> void
+ {
+ auto const klass = static_cast<AdwActionRowClass *>(gclass);
+ PreferencesRow::Class::class_init_function(klass, data);
+ }
+
+ auto ActionRow::Class::wrap_new(GObject * object) -> Glib::ObjectBase *
+ {
+ return new ActionRow(ADW_ACTION_ROW(object));
+ }
+
+ auto ActionRow::get_type() -> GType
+ {
+ return _class.init().get_type();
+ }
+
+ auto ActionRow::get_base_type() -> GType
+ {
+ return adw_action_row_get_type();
+ }
+
+ ActionRow::ActionRow()
+ : Glib::ObjectBase{nullptr}
+ , adw::PreferencesRow{Glib::ConstructParams{_class.init()}}
+ {
+ }
+
+ auto ActionRow::add_prefix(Gtk::Widget & widget) -> ActionRow &
+ {
+ adw_action_row_add_prefix(Glib::unwrap(this), Glib::unwrap(&widget));
+ return *this;
+ }
+
+ auto ActionRow::add_suffix(Gtk::Widget & widget) -> ActionRow &
+ {
+ adw_action_row_add_suffix(Glib::unwrap(this), Glib::unwrap(&widget));
+ return *this;
+ }
+
+ auto ActionRow::remove(Gtk::Widget & widget) -> ActionRow &
+ {
+ adw_action_row_remove(Glib::unwrap(this), Glib::unwrap(&widget));
+ return *this;
+ }
+
+ auto ActionRow::set_activatable_widget(Gtk::Widget & widget) noexcept -> CppObjectType &
+ {
+ adw_action_row_set_activatable_widget(Glib::unwrap(this), Glib::unwrap(&widget));
+ return *this;
+ }
+
+ auto ActionRow::set_icon_name(Glib::ustring const & name) -> CppObjectType &
+ {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ adw_action_row_set_icon_name(Glib::unwrap(this), name.c_str());
+#pragma GCC diagnostic pop
+ return *this;
+ }
+
+ auto ActionRow::set_subtitle(Glib::ustring const & subtitle) -> CppObjectType &
+ {
+ adw_action_row_set_subtitle(Glib::unwrap(this), subtitle.c_str());
+ return *this;
+ }
+
+ auto ActionRow::set_subtitle_lines(int subtitle_lines) noexcept -> CppObjectType &
+ {
+ adw_action_row_set_subtitle_lines(Glib::unwrap(this), subtitle_lines);
+ return *this;
+ }
+
+ auto ActionRow::set_subtitle_selectable(bool subtitle_selectable) noexcept -> CppObjectType &
+ {
+ adw_action_row_set_subtitle_selectable(Glib::unwrap(this), subtitle_selectable);
+ return *this;
+ }
+
+ auto ActionRow::set_title_lines(int title_lines) noexcept -> CppObjectType &
+ {
+ adw_action_row_set_title_lines(Glib::unwrap(this), title_lines);
+ return *this;
+ }
+
+ ActionRow::ActionRow(Glib::ConstructParams const & params)
+ : adw::PreferencesRow{params}
+ {
+ }
+
+ ActionRow::ActionRow(BaseObjectType * gobj)
+ : Glib::ObjectBase{nullptr}
+ , adw::PreferencesRow(ADW_PREFERENCES_ROW(gobj))
+ {
+ }
+
+} // namespace turns::adw
+
+namespace Glib
+{
+ auto wrap(AdwActionRow * object, bool copy) -> Glib::RefPtr<turns::adw::ActionRow>
+ {
+ return Glib::make_refptr_for_instance<turns::adw::ActionRow>(
+ dynamic_cast<turns::adw::ActionRow *>(Glib::wrap_auto(G_OBJECT(object), copy)));
+ }
+} // namespace Glib \ No newline at end of file