Using switch, first draft to use switches.
This commit is contained in:
parent
2c53334e8f
commit
87d2db2243
3 changed files with 70 additions and 2 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#include "app_win_2_back.hpp"
|
||||
#include "hello_world.hpp"
|
||||
|
||||
#include <billy_objects.hpp>
|
||||
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <gtkmm/switch.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
|
@ -107,6 +109,28 @@ namespace gui_to_app {
|
|||
return;
|
||||
}
|
||||
// TODO: interaction avec la CharacterSheet
|
||||
ranges::for_each(views::zip(std::array{
|
||||
sword_switch,
|
||||
lance_switch,
|
||||
morgen_switch,
|
||||
bow_switch,
|
||||
chainmail_switch,
|
||||
cookpot_switch,
|
||||
pamphlet_switch,
|
||||
medkit_switch,
|
||||
fourche_switch,
|
||||
dagger_switch,
|
||||
rock_kit_switch,
|
||||
sack_switch,
|
||||
},
|
||||
signal_handlers),
|
||||
[](const std::tuple<Gtk::Switch *, SwitchSignalHelper &> &vals) {
|
||||
const auto &[switch_val, signal_handle] = vals;
|
||||
signal_handle.switch_ = switch_val;
|
||||
switch_val->signal_state_set().connect(
|
||||
sigc::mem_fun(signal_handle, &SwitchSignalHelper::signal_handler),
|
||||
false);
|
||||
});
|
||||
}
|
||||
|
||||
void AppWin2Back::on_quit() noexcept {
|
||||
|
|
@ -117,4 +141,8 @@ namespace gui_to_app {
|
|||
});
|
||||
quit();
|
||||
}
|
||||
|
||||
bool AppWin2Back::switch_signal_handler(const bool flag, const character::billyEnums &obj) noexcept {
|
||||
return flag ? gestionnaire.insert_object(sheet, obj) : !gestionnaire.erase_object(sheet, obj);
|
||||
}
|
||||
} // gui_to_app
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue