The value engine shared by Pulp's continuous controls. More...
#include <algorithm>#include <cmath>#include <cstdint>#include <functional>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| class | pulp::view::SliderCore |
Namespaces | |
| namespace | pulp |
| namespace | pulp::view |
| Hover-cursor tracking for platform window hosts. | |
Enumerations | |
| enum class | pulp::view::Notify { pulp::view::none , pulp::view::sync , pulp::view::async } |
| Whether a value write notifies listeners, and when. More... | |
Functions | |
| void | pulp::view::flush_async_notifications () |
| Deferred Notify::async callbacks, oldest first. | |
| void | pulp::view::queue_async_notification (std::function< void()> fn) |
| Queue a callback for the next flush. | |
The value engine shared by Pulp's continuous controls.
A knob, a fader and a numeric field all need the same six things and none of them are about pixels:
SliderCore owns exactly that and nothing else: no bounds, no canvas, no event handling. A widget composes one and asks it to map pointer motion to value and value to travel proportion.
The response curve maps between them: proportion = normalized^skew, where normalized is the value's linear position in the range. skew == 1 is linear. skew < 1 pushes proportion UP for a given value, so the low end of the range occupies more travel — the law a frequency or time control wants. set_skew_from_midpoint(v) picks the skew that puts value v at half travel.
Every mutator takes a Notify:
The distinction is not cosmetic: a control whose setter ALWAYS notifies cannot be synced from its own listener without a manual re-entrancy guard at every call site.