Adding debug button for objects in sheet
This commit is contained in:
parent
e8933c5029
commit
92db466083
3 changed files with 23 additions and 0 deletions
|
|
@ -4,7 +4,9 @@
|
||||||
#include <billy_objects.hpp>
|
#include <billy_objects.hpp>
|
||||||
|
|
||||||
#include <glibmm/miscutils.h>
|
#include <glibmm/miscutils.h>
|
||||||
|
#include <gtkmm/button.h>
|
||||||
#include <gtkmm/label.h>
|
#include <gtkmm/label.h>
|
||||||
|
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
@ -162,10 +164,13 @@ namespace gui_to_app {
|
||||||
if (switches_procedure()) {
|
if (switches_procedure()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
debug_button = app_builder->get_widget<Gtk::Button>("debug_button");
|
||||||
hab_base = app_builder->get_widget<Gtk::Label>("habilete_label_base");
|
hab_base = app_builder->get_widget<Gtk::Label>("habilete_label_base");
|
||||||
hab_carac = app_builder->get_widget<Gtk::Label>("habilete_label_carac");
|
hab_carac = app_builder->get_widget<Gtk::Label>("habilete_label_carac");
|
||||||
hab_mat = app_builder->get_widget<Gtk::Label>("habilete_label_materiel");
|
hab_mat = app_builder->get_widget<Gtk::Label>("habilete_label_materiel");
|
||||||
hab_total = app_builder->get_widget<Gtk::Label>("habilete_label_total");
|
hab_total = app_builder->get_widget<Gtk::Label>("habilete_label_total");
|
||||||
|
|
||||||
|
debug_button->signal_clicked().connect(sigc::mem_fun(*this, &AppWin2Back::debug_button_clicked), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppWin2Back::on_quit() noexcept {
|
void AppWin2Back::on_quit() noexcept {
|
||||||
|
|
@ -181,6 +186,13 @@ namespace gui_to_app {
|
||||||
return flag ? gestionnaire.insert_object(sheet, obj) : !gestionnaire.erase_object(sheet, obj);
|
return flag ? gestionnaire.insert_object(sheet, obj) : !gestionnaire.erase_object(sheet, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppWin2Back::debug_button_clicked() const noexcept {
|
||||||
|
spdlog::info("Display objects");
|
||||||
|
for (const auto &obj: sheet.get_objects() | views::values) {
|
||||||
|
spdlog::info("Object: {}", obj->to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool AppWin2Back::insert_obj(const character::billyEnums &obj) noexcept {
|
bool AppWin2Back::insert_obj(const character::billyEnums &obj) noexcept {
|
||||||
return gestionnaire.insert_object(sheet, obj);
|
return gestionnaire.insert_object(sheet, obj);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ namespace learn_gtkmm4 {
|
||||||
namespace Gtk {
|
namespace Gtk {
|
||||||
class Builder;
|
class Builder;
|
||||||
class Label;
|
class Label;
|
||||||
|
class Button;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace gui_to_app {
|
namespace gui_to_app {
|
||||||
|
|
@ -59,6 +60,8 @@ namespace gui_to_app {
|
||||||
|
|
||||||
bool switch_signal_handler(bool flag, const character::billyEnums &obj) noexcept;
|
bool switch_signal_handler(bool flag, const character::billyEnums &obj) noexcept;
|
||||||
|
|
||||||
|
void debug_button_clicked() const noexcept;
|
||||||
|
|
||||||
bool insert_obj(const character::billyEnums &obj) noexcept;
|
bool insert_obj(const character::billyEnums &obj) noexcept;
|
||||||
|
|
||||||
bool erase_obj(const character::billyEnums &obj) noexcept;
|
bool erase_obj(const character::billyEnums &obj) noexcept;
|
||||||
|
|
@ -85,6 +88,8 @@ namespace gui_to_app {
|
||||||
Gtk::Label *hab_mat{ nullptr };
|
Gtk::Label *hab_mat{ nullptr };
|
||||||
Gtk::Label *hab_total{ nullptr };
|
Gtk::Label *hab_total{ nullptr };
|
||||||
|
|
||||||
|
Gtk::Button *debug_button{ nullptr };
|
||||||
|
|
||||||
std::array<SwitchSignalHelper, 12> signal_handlers{
|
std::array<SwitchSignalHelper, 12> signal_handlers{
|
||||||
SwitchSignalHelper{ .app = *this, .obj = character::weapons::Sword },
|
SwitchSignalHelper{ .app = *this, .obj = character::weapons::Sword },
|
||||||
SwitchSignalHelper{ .app = *this, .obj = character::weapons::Lance },
|
SwitchSignalHelper{ .app = *this, .obj = character::weapons::Lance },
|
||||||
|
|
|
||||||
|
|
@ -719,6 +719,12 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="debug_button">
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="label">Print Sheet</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue