Search cleanup, more binder support (#1467)

This commit is contained in:
Kyle Reed 2023-10-01 09:04:37 -07:00 committed by GitHub
parent 951890eaff
commit 78713cc2af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 225 additions and 218 deletions

View file

@ -52,6 +52,15 @@ struct NoOp {
* adequate lifetime of the referenced instances.
*/
template <typename T, typename Fn = NoOp>
void bind(Checkbox& check, T& value, Fn fn = Fn{}) {
check.set_value(value);
check.on_select = [&value, fn](Checkbox&, bool b) {
value = b;
fn(value);
};
}
template <typename T, typename Fn = NoOp>
void bind(NumberField& field, T& value, Fn fn = Fn{}) {
field.set_value(value);