diff --git a/libs/ui/include/psemek/ui/spinbox.hpp b/libs/ui/include/psemek/ui/spinbox.hpp index da4c0e89..b5d345be 100644 --- a/libs/ui/include/psemek/ui/spinbox.hpp +++ b/libs/ui/include/psemek/ui/spinbox.hpp @@ -26,7 +26,7 @@ namespace psemek::ui using on_value_changed_callback = std::function; - virtual void on_value_changed(on_value_changed_callback callback); + virtual void on_value_changed(on_value_changed_callback callback, bool notify = true); virtual struct label * label() { return nullptr; } diff --git a/libs/ui/source/spinbox.cpp b/libs/ui/source/spinbox.cpp index 97c8e5c2..11065f62 100644 --- a/libs/ui/source/spinbox.cpp +++ b/libs/ui/source/spinbox.cpp @@ -43,10 +43,11 @@ namespace psemek::ui set_value(value_ - 1); } - void spinbox::on_value_changed(on_value_changed_callback callback) + void spinbox::on_value_changed(on_value_changed_callback callback, bool notify) { on_value_changed_ = std::move(callback); - post_value_changed(); + if (notify) + post_value_changed(); } void spinbox::post_value_changed()