Habileté labels in struct
This commit is contained in:
parent
d909c627e0
commit
a6b6e0d5bf
2 changed files with 20 additions and 6 deletions
|
|
@ -169,10 +169,15 @@ namespace gui_to_app {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
debug_button = app_builder->get_widget<Gtk::Button>("debug_button");
|
debug_button = app_builder->get_widget<Gtk::Button>("debug_button");
|
||||||
hab_labels.base = app_builder->get_widget<Gtk::Label>("habilete_label_base");
|
hab_labels = CaracInterface<Gtk::Label>{
|
||||||
hab_labels.carac = app_builder->get_widget<Gtk::Label>("habilete_label_carac");
|
{
|
||||||
hab_labels.mat = app_builder->get_widget<Gtk::Label>("habilete_label_materiel");
|
"habilete_label_base",
|
||||||
hab_labels.total = app_builder->get_widget<Gtk::Label>("habilete_label_total");
|
"habilete_label_carac",
|
||||||
|
"habilete_label_materiel",
|
||||||
|
"habilete_label_total"
|
||||||
|
},
|
||||||
|
app_builder
|
||||||
|
};
|
||||||
|
|
||||||
debug_button->signal_clicked().connect(sigc::mem_fun(*this, &AppWin2Back::debug_button_clicked), false);
|
debug_button->signal_clicked().connect(sigc::mem_fun(*this, &AppWin2Back::debug_button_clicked), false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <glibmm/refptr.h>
|
#include <glibmm/refptr.h>
|
||||||
#include <gtkmm/application.h>
|
#include <gtkmm/application.h>
|
||||||
|
#include <gtkmm/builder.h>
|
||||||
#include <gtkmm/checkbutton.h>
|
#include <gtkmm/checkbutton.h>
|
||||||
|
|
||||||
#include <billy_objects.hpp>
|
#include <billy_objects.hpp>
|
||||||
|
|
@ -15,18 +16,26 @@ namespace learn_gtkmm4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Gtk {
|
namespace Gtk {
|
||||||
class Builder;
|
|
||||||
class Label;
|
class Label;
|
||||||
class Button;
|
class Button;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace gui_to_app {
|
namespace gui_to_app {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct CaracInterface {
|
struct CaracInterface final {
|
||||||
T *base{ nullptr };
|
T *base{ nullptr };
|
||||||
T *carac{ nullptr };
|
T *carac{ nullptr };
|
||||||
T *mat{ nullptr };
|
T *mat{ nullptr };
|
||||||
T *total{ nullptr };
|
T *total{ nullptr };
|
||||||
|
|
||||||
|
CaracInterface() = default;
|
||||||
|
|
||||||
|
explicit CaracInterface(const std::array<std::string_view, 4> &list,
|
||||||
|
const Glib::RefPtr<Gtk::Builder> &builder) :
|
||||||
|
base(builder->get_widget<T>(list[0].data())),
|
||||||
|
carac(builder->get_widget<T>(list[1].data())),
|
||||||
|
mat(builder->get_widget<T>(list[2].data())),
|
||||||
|
total(builder->get_widget<T>(list[3].data())) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AppWin2Back final : public Gtk::Application {
|
class AppWin2Back final : public Gtk::Application {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue