45 std::tie(std::ignore, success) =
members_.emplace(value,
w);
48 ERR_GUI_G <<
"Group member with value already exists.";
90 return dynamic_cast<W&
>(*
members_.at(value));
99 if(
member.second->get_value_bool()) {
124 const auto callback = [func,
this](
widget&
widget) ->
void {
133 throw std::runtime_error(
"Group value change callback invoked for non-member widget");
152 bool do_reselect =
true;
155 const bool res = predicate(
member.first);
161 if(
w.get_value_bool()) {
165 w.set_value_bool(
false);
176 if(
member->get_active()) {
203 member.second->set_value(
false);
void connect_signal(const F &func, const queue_position position=back_child)
Adds a callback to the appropriate queue based on event type.
void group_operator()
The default actions to take when clicking on one of the widgets in the group.
void remove_member(const T &value)
Removes a member from the group map.
group_map & members()
Group member getters.
void add_member(selectable_item *w, const T &value)
Adds a widget/value pair to the group map.
void clear()
Clears the entire group of members.
std::map< T, selectable_item * > group_map
const group_map & members() const
std::vector< styled_widget * > order_vector
void set_member_states(const T &value)
Sets the toggle values for all widgets besides the one associated with the specified value to false.
W & member(const T &value)
void set_callback_on_value_change(std::function< void(widget &, const T)> func)
Sets a common callback function for all members.
void set_members_enabled(std::function< bool(const T &)> predicate)
Wrapper for enabling or disabling member widgets.
T get_active_member_value() const
Returns the value paired with the currently actively toggled member of the group.
order_vector member_order_
Since iterating over std::map is specified by operator< for it's key values, we can't guarantee the o...
group_map members_
Container map for group members, organized by member value, associated widget.
Small abstract helper class.
void set_value_bool(bool value, bool fire_event=false)
bool get_value_bool() const
Define the common log macros for the gui toolkit.
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.