summaryrefslogtreecommitdiff
path: root/gui/include/participant_row.hpp
blob: dd0eeeaa284b70d1da2e6040515ca9e6ddde4089 (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
/*
 * SPDX-FileCopyrightText: 2025 Felix Morgner <felix.morgner@gmail.com>
 * SPDX-License-Identifier: LGPL-2.1-only
 */

#ifndef TURNS_GUI_PARTICIPANT_ROW_HPP
#define TURNS_GUI_PARTICIPANT_ROW_HPP

#include "template_widget.hpp"

#include <turnsmm/participant.hpp>

#include <glibmm/property.h>
#include <glibmm/propertyproxy.h>
#include <glibmm/refptr.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <gtkmm/listboxrow.h>
#include <gtkmm/togglebutton.h>

#include <array>

namespace Turns::gui
{
  struct ParticipantRow : template_widget<ParticipantRow, Gtk::ListBoxRow>
  {
    auto constexpr inline static children = std::array{
        "delete",
        "edit",
        "subtitle",
        "title",
        "toggle_defeated",
    };

    ParticipantRow();
    explicit ParticipantRow(Glib::RefPtr<Turns::Participant> participant);

    auto delete_enabled() -> Glib::PropertyProxy<bool>;
    auto edit_enabled() -> Glib::PropertyProxy<bool>;

  private:
    auto handle_delete() -> void;
    auto handle_edit() -> void;

    Gtk::Button * m_delete;
    Gtk::Button * m_edit;
    Gtk::Label * m_subtitle;
    Gtk::Label * m_title;
    Gtk::ToggleButton * m_toggle_defeated;

    Glib::Property<bool> m_delete_enabled;
    Glib::Property<bool> m_edit_enabled;
  };
}  // namespace Turns::gui

#endif