summaryrefslogtreecommitdiff
path: root/lib/include/turnsmm/turn-order.hpp
blob: 5b8deb926f56f2b2e41d55db71dd587bc29491a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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