From 4466f721192844fe542d02aced2c8b3860e1433c Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sun, 8 Jun 2025 22:03:14 +0200 Subject: gui: make TurnOrderView default constructible --- gui/include/turn_order_view.hpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'gui/include') diff --git a/gui/include/turn_order_view.hpp b/gui/include/turn_order_view.hpp index eaa8501..603c6c5 100644 --- a/gui/include/turn_order_view.hpp +++ b/gui/include/turn_order_view.hpp @@ -11,6 +11,8 @@ #include #include +#include +#include #include #include #include @@ -23,21 +25,27 @@ namespace Turns::gui { struct TurnOrderView : template_widget { - using model_type = TurnOrder; - auto constexpr inline static children = std::array{ "progress", "view", }; - explicit TurnOrderView(Glib::RefPtr model = {}); + TurnOrderView(); + explicit TurnOrderView(Glib::RefPtr const & turn_order); + + [[nodiscard]] auto get_turn_order() const -> Glib::RefPtr; + + auto set_turn_order(Glib::RefPtr const & turn_order) -> void; + + auto property_turn_order() -> Glib::PropertyProxy>; + auto property_turn_order() const -> Glib::PropertyProxy_ReadOnly>; private: auto handle_create_row(Glib::RefPtr const item) -> Gtk::Widget *; - Glib::RefPtr m_model; - Gtk::ProgressBar * m_progress; - Gtk::ListBox * m_view; + Glib::Property> m_turn_order{*this, "turn-order", nullptr}; + Gtk::ProgressBar * m_progress{get_widget("progress")}; + Gtk::ListBox * m_view{get_widget("view")}; }; } // namespace Turns::gui -- cgit v1.2.3