diff options
Diffstat (limited to 'lib/include/turnsmm/turn-order.hpp')
| -rw-r--r-- | lib/include/turnsmm/turn-order.hpp | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/lib/include/turnsmm/turn-order.hpp b/lib/include/turnsmm/turn-order.hpp new file mode 100644 index 0000000..5b8deb9 --- /dev/null +++ b/lib/include/turnsmm/turn-order.hpp @@ -0,0 +1,89 @@ +/* + * SPDX-FileCopyrightText: 2025 Felix Morgner <felix.morgner@gmail.com> + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#ifndef TURNSMM_TURN_ORDER_HPP +#define TURNSMM_TURN_ORDER_HPP + +#include "turns-turn-order.h" +#include "turnsmm/participant.hpp" + +#include <glibmm/object.h> +#include <glibmm/propertyproxy.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> +#include <glibmm/value.h> + +#include <giomm/listmodel.h> + +#include <glib-object.h> +#include <glib.h> + +#include <cstddef> + +namespace Turns +{ + + class TurnOrder final : public Glib::Object, + public Gio::ListModel + { + public: + using BaseClassType = TurnsTurnOrderClass; + using BaseObjectType = TurnsTurnOrder; + using CppClassType = class TurnOrder_Class; + using CppObjectType = TurnOrder; + + enum struct SortMode : guint + { + Descending, + Ascending, + }; + + auto static get_base_type() -> GType; + auto static get_type() -> GType; + + TurnOrder(); + + [[nodiscard]] auto gobj() noexcept -> BaseObjectType *; + [[nodiscard]] auto gobj() const -> BaseObjectType const *; + [[nodiscard]] auto gobj_copy() noexcept -> BaseObjectType *; + + auto add(Glib::RefPtr<Participant> const & participant) noexcept -> void; + auto clear() noexcept -> void; + auto remove_at(guint position) noexcept -> void; + + [[nodiscard]] auto get_empty() const noexcept -> bool; + [[nodiscard]] auto get_participant_count() const noexcept -> std::size_t; + [[nodiscard]] auto get_running() const noexcept -> bool; + [[nodiscard]] auto get_sort_mode() const noexcept -> SortMode; + + auto set_sort_mode(SortMode value) noexcept -> void; + + [[nodiscard]] auto property_empty() const noexcept -> Glib::PropertyProxy_ReadOnly<bool>; + [[nodiscard]] auto property_participant_count() const noexcept -> Glib::PropertyProxy_ReadOnly<std::size_t>; + [[nodiscard]] auto property_running() const noexcept -> Glib::PropertyProxy_ReadOnly<bool>; + [[nodiscard]] auto property_sort_mode() noexcept -> Glib::PropertyProxy<SortMode>; + [[nodiscard]] auto property_sort_mode() const noexcept -> Glib::PropertyProxy_ReadOnly<SortMode>; + + protected: + friend TurnOrder_Class; + + explicit TurnOrder(BaseObjectType * gobj); + }; + +} // namespace Turns + +namespace Glib +{ + template<> + class Value<Turns::TurnOrder::SortMode> : public Glib ::Value_Enum<Turns::TurnOrder::SortMode> + { + public: + auto static value_type() -> GType; + }; + + auto wrap(TurnsTurnOrder * object, bool copy = false) -> Glib::RefPtr<Turns::TurnOrder>; +} // namespace Glib + +#endif
\ No newline at end of file |
