93 lines
3.1 KiB
C++
93 lines
3.1 KiB
C++
#ifndef LEARNGTK4_APP_WIN_2_BACK_HPP
|
|
#define LEARNGTK4_APP_WIN_2_BACK_HPP
|
|
|
|
#include <array>
|
|
|
|
#include <glibmm/refptr.h>
|
|
#include <gtkmm/application.h>
|
|
|
|
#include <billy_objects.hpp>
|
|
#include <character_sheet.hpp>
|
|
#include <gtkmm/switch.h>
|
|
|
|
namespace learn_gtkmm4 {
|
|
class HelloWorld;
|
|
}
|
|
|
|
namespace Gtk {
|
|
class Builder;
|
|
class Switch;
|
|
}
|
|
|
|
namespace gui_to_app {
|
|
class AppWin2Back final : public Gtk::Application {
|
|
public:
|
|
~AppWin2Back() noexcept final = default;
|
|
|
|
static Glib::RefPtr<AppWin2Back> create();
|
|
|
|
protected:
|
|
AppWin2Back();
|
|
|
|
void on_startup() final;
|
|
|
|
void on_activate() final;
|
|
|
|
private:
|
|
struct SwitchSignalHelper {
|
|
AppWin2Back &app;
|
|
const character::billyEnums obj;
|
|
Gtk::Switch *switch_{ nullptr };
|
|
|
|
[[nodiscard]] bool signal_handler(const bool flag) const noexcept {
|
|
switch_->set_state(app.switch_signal_handler(flag, obj));
|
|
return true;
|
|
}
|
|
};
|
|
|
|
friend struct SwitchSignalHelper;
|
|
|
|
void on_quit() noexcept;
|
|
|
|
bool switch_signal_handler(bool flag, const character::billyEnums &obj) noexcept;
|
|
|
|
Glib::RefPtr<Gtk::Builder> app_builder;
|
|
learn_gtkmm4::HelloWorld *main_window{ nullptr };
|
|
Gtk::Switch *sword_switch{ nullptr };
|
|
Gtk::Switch *lance_switch{ nullptr };
|
|
Gtk::Switch *morgen_switch{ nullptr };
|
|
Gtk::Switch *bow_switch{ nullptr };
|
|
|
|
Gtk::Switch *chainmail_switch{ nullptr };
|
|
Gtk::Switch *cookpot_switch{ nullptr };
|
|
Gtk::Switch *pamphlet_switch{ nullptr };
|
|
Gtk::Switch *medkit_switch{ nullptr };
|
|
|
|
Gtk::Switch *fourche_switch{ nullptr };
|
|
Gtk::Switch *dagger_switch{ nullptr };
|
|
Gtk::Switch *rock_kit_switch{ nullptr };
|
|
Gtk::Switch *sack_switch{ nullptr };
|
|
|
|
std::array<SwitchSignalHelper, 12> signal_handlers{
|
|
SwitchSignalHelper{ .app = *this, .obj = character::weapons::Sword },
|
|
SwitchSignalHelper{ .app = *this, .obj = character::weapons::Lance },
|
|
SwitchSignalHelper{ .app = *this, .obj = character::weapons::Morgenstern },
|
|
SwitchSignalHelper{ .app = *this, .obj = character::weapons::Bow },
|
|
|
|
SwitchSignalHelper{ .app = *this, .obj = character::equipments::Chainmail },
|
|
SwitchSignalHelper{ .app = *this, .obj = character::equipments::CookingPot },
|
|
SwitchSignalHelper{ .app = *this, .obj = character::equipments::PamphletTourist },
|
|
SwitchSignalHelper{ .app = *this, .obj = character::equipments::MedicKit },
|
|
|
|
SwitchSignalHelper{ .app = *this, .obj = character::tools::Fourche },
|
|
SwitchSignalHelper{ .app = *this, .obj = character::tools::Dagger },
|
|
SwitchSignalHelper{ .app = *this, .obj = character::tools::RockClimbingKit },
|
|
SwitchSignalHelper{ .app = *this, .obj = character::tools::SackOfGrain },
|
|
};
|
|
|
|
character::BillyObjects gestionnaire{};
|
|
character::CharacterSheet sheet{};
|
|
};
|
|
} // gui_to_app
|
|
|
|
#endif //LEARNGTK4_APP_WIN_2_BACK_HPP
|