Skip to content

Commit

Permalink
GUI2/Preferences Dialog: added more explanatory comments about bindin…
Browse files Browse the repository at this point in the history
…g lambdas

[ci skip]
  • Loading branch information
Vultraz committed Aug 23, 2017
1 parent 03c8289 commit 4be3111
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gui/dialogs/preferences_dialog.cpp
Expand Up @@ -592,6 +592,8 @@ void preferences_dialog::post_build(window& window)
toggle_box.set_visible(widget::visibility::visible);
toggle_box.set_value(get(pref_name, option["default"].to_bool()));

// We need to bind a lambda here since preferences::set is overloaded.
// A lambda alone would be more verbose because it'd need to specify all the parameters.
connect_signal_mouse_left_click(toggle_box, std::bind(
[&, pref_name]() { set(pref_name, toggle_box.get_value_bool()); }
));
Expand All @@ -617,6 +619,8 @@ void preferences_dialog::post_build(window& window)

slide.set_value(lexical_cast_default<int>(get(pref_name), option["default"].to_int()));

// We need to bind a lambda here since preferences::set is overloaded.
// A lambda alone would be more verbose because it'd need to specify all the parameters.
connect_signal_notify_modified(slide, std::bind(
[&, pref_name]() { set(pref_name, slide.get_value()); }
));
Expand Down

0 comments on commit 4be3111

Please sign in to comment.