From 84fb875123201f28a3333285b6323037b08accb4 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 16 May 2025 11:12:43 +0200 Subject: lib: implement ListModel interface for TurnOrder --- lib/src/turnsmm/participant.cpp | 10 ++++++++++ lib/src/turnsmm/participant.hpp | 4 ++++ lib/src/turnsmm/turn-order.cpp | 12 ++++++++++++ lib/src/turnsmm/turn-order.hpp | 9 ++++++++- 4 files changed, 34 insertions(+), 1 deletion(-) (limited to 'lib/src/turnsmm') diff --git a/lib/src/turnsmm/participant.cpp b/lib/src/turnsmm/participant.cpp index 5cc3db6..2c7ca08 100644 --- a/lib/src/turnsmm/participant.cpp +++ b/lib/src/turnsmm/participant.cpp @@ -48,6 +48,16 @@ namespace Turns return new Participant(TURNS_PARTICIPANT(object)); } + auto Participant::get_base_type() -> GType + { + return turns_participant_get_type(); + } + + auto Participant::get_type() -> GType + { + return _class.init().get_type(); + } + Participant::Participant() : Glib::ObjectBase{nullptr} , Glib::Object{Glib::ConstructParams{_class.init()}} diff --git a/lib/src/turnsmm/participant.hpp b/lib/src/turnsmm/participant.hpp index b41c64b..04c4fe8 100644 --- a/lib/src/turnsmm/participant.hpp +++ b/lib/src/turnsmm/participant.hpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace Turns { @@ -20,6 +21,9 @@ namespace Turns using CppClassType = class Participant_Class; using CppObjectType = Participant; + auto static get_base_type() -> GType; + auto static get_type() -> GType; + Participant(); Participant(Glib::ustring const & name, float priority, Disposition disposition); diff --git a/lib/src/turnsmm/turn-order.cpp b/lib/src/turnsmm/turn-order.cpp index 8e1914d..8ff7210 100644 --- a/lib/src/turnsmm/turn-order.cpp +++ b/lib/src/turnsmm/turn-order.cpp @@ -11,6 +11,8 @@ #include #include +#include + #include #include @@ -45,6 +47,16 @@ namespace Turns return new TurnOrder(TURNS_TURN_ORDER(object)); } + auto TurnOrder::get_base_type() -> GType + { + return turns_turn_order_get_type(); + } + + auto TurnOrder::get_type() -> GType + { + return _class.init().get_type(); + } + TurnOrder::TurnOrder() : Glib::ObjectBase{nullptr} , Glib::Object{Glib::ConstructParams{_class.init()}} diff --git a/lib/src/turnsmm/turn-order.hpp b/lib/src/turnsmm/turn-order.hpp index 25fc0b5..2dfa2ca 100644 --- a/lib/src/turnsmm/turn-order.hpp +++ b/lib/src/turnsmm/turn-order.hpp @@ -8,12 +8,16 @@ #include #include +#include +#include + #include namespace Turns { - class TurnOrder final : public Glib::Object + class TurnOrder final : public Glib::Object, + public Gio::ListModel { public: using BaseClassType = TurnsTurnOrderClass; @@ -21,6 +25,9 @@ namespace Turns using CppClassType = class TurnOrder_Class; using CppObjectType = TurnOrder; + auto static get_base_type() -> GType; + auto static get_type() -> GType; + TurnOrder(); [[nodiscard]] auto gobj() noexcept -> BaseObjectType *; -- cgit v1.2.3