#ifndef LEARNGTK4_APP_WIN_2_BACK_HPP #define LEARNGTK4_APP_WIN_2_BACK_HPP #include #include #include #include #include #include namespace learn_gtkmm4 { class HelloWorld; } namespace Gtk { class Builder; class Label; class Button; } namespace gui_to_app { class AppWin2Back final : public Gtk::Application { public: ~AppWin2Back() noexcept final = default; static Glib::RefPtr create(); protected: AppWin2Back(); void on_startup() final; void on_activate() final; private: using selection_button = Gtk::CheckButton; using buttons_obj_container = std::unordered_set; struct SwitchSignalHelper { AppWin2Back &app; const character::billyEnums obj; selection_button *switch_{ nullptr }; bool on_stack{ false }; void signal_handler() noexcept; }; friend struct SwitchSignalHelper; /*! * * @return true: failed, false: success */ bool switches_procedure(); void on_quit() 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 erase_obj(const character::billyEnums &obj) noexcept; Glib::RefPtr app_builder; learn_gtkmm4::HelloWorld *main_window{ nullptr }; selection_button *sword_switch{ nullptr }; selection_button *lance_switch{ nullptr }; selection_button *morgen_switch{ nullptr }; selection_button *bow_switch{ nullptr }; selection_button *chainmail_switch{ nullptr }; selection_button *cookpot_switch{ nullptr }; selection_button *pamphlet_switch{ nullptr }; selection_button *medkit_switch{ nullptr }; selection_button *fourche_switch{ nullptr }; selection_button *dagger_switch{ nullptr }; selection_button *rock_kit_switch{ nullptr }; selection_button *sack_switch{ nullptr }; Gtk::Label *hab_base{ nullptr }; Gtk::Label *hab_carac{ nullptr }; Gtk::Label *hab_mat{ nullptr }; Gtk::Label *hab_total{ nullptr }; Gtk::Button *debug_button{ nullptr }; std::array 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 }, }; buttons_obj_container selection_buttons; character::BillyObjects gestionnaire{}; character::CharacterSheet sheet{}; }; } // gui_to_app #endif //LEARNGTK4_APP_WIN_2_BACK_HPP