#include <slider_core.hpp>
Public Member Functions | |
| void | set_range (double min_value, double max_value, double interval=0.0) |
| Set the real-world range and the quantization interval. | |
| double | minimum () const |
| double | maximum () const |
| double | interval () const |
| void | set_skew (double skew) |
| 1 = linear. Below 1, the low end of the range gets more travel. | |
| double | skew () const |
| void | set_skew_from_midpoint (double mid_value) |
| Choose the skew that places mid_value (real-world units) at half travel. | |
| double | value () const |
| bool | set_value (double v, Notify notify=Notify::sync) |
| Write a real-world value. | |
| double | proportion () const |
| Travel proportion in [0,1] for the current value, after the curve. | |
| bool | set_proportion (double p, Notify notify=Notify::sync) |
| Write from a travel proportion (what a drag or a painter's inverse hit-test produces). | |
| double | normalized () const |
| LINEAR position of the value in the range, in [0,1], with NO response curve applied. | |
| double | value_for_normalized (double n) const |
| bool | set_normalized (double n, Notify notify=Notify::sync) |
| double | proportion_for (double v) const |
| double | value_for_proportion (double p) const |
| double | constrain (double v) const |
| Clamp to the range and snap to the interval. | |
| void | set_default_value (double v) |
| The value the control returns to on a reset gesture (conventionally a double-click or alt-click). | |
| bool | has_default () const |
| double | default_value () const |
| bool | reset_to_default (Notify notify=Notify::sync) |
| void | set_drag_sensitivity (int pixels) |
| Pointer pixels that cross the FULL range in a plain (non-velocity) drag. | |
| int | drag_sensitivity () const |
| void | set_velocity_mode (bool on) |
| In velocity mode the value moves by pointer SPEED rather than by absolute pointer travel, so a fast flick covers the range and a slow one does not — the pointer and the control decouple. | |
| bool | velocity_mode () const |
| void | set_velocity_sensitivity (double s) |
| bool | drag_to (double delta_pixels, double proportion_at_press, bool fine, Notify notify=Notify::sync) |
| ABSOLUTE drag: delta_pixels is the pointer's total travel SINCE the gesture began (positive = increase), and proportion_at_press is the proportion the control held when it began. | |
| bool | drag_step (double delta_pixels, bool fine, Notify notify=Notify::sync) |
| VELOCITY drag: delta_pixels is the pointer's travel since the LAST tick, and the control integrates it from wherever it currently is. | |
| void | set_fine_divisor (double d) |
| double | fine_divisor () const |
| void | begin_gesture () |
| void | end_gesture () |
| bool | gesture_active () const |
Public Attributes | |
| std::function< void(double)> | on_value_change |
| std::function< void()> | on_gesture_begin |
| std::function< void()> | on_gesture_end |
|
inline |
|
inline |
Clamp to the range and snap to the interval.
|
inline |
|
inline |
|
inline |
VELOCITY drag: delta_pixels is the pointer's travel since the LAST tick, and the control integrates it from wherever it currently is.
The pointer and the control deliberately decouple — a fast flick covers more range than the same distance moved slowly, and the control never "snaps" to the pointer. Use when velocity_mode() is set.
|
inline |
ABSOLUTE drag: delta_pixels is the pointer's total travel SINCE the gesture began (positive = increase), and proportion_at_press is the proportion the control held when it began.
The pointer and the control stay locked together, so releasing and re-pressing does not drift. fine (a modifier held) divides the travel by fine_divisor().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
LINEAR position of the value in the range, in [0,1], with NO response curve applied.
This is the space a parameter store and a normalized automation lane live in; proportion() is the space a painter and a drag live in. They coincide only when the skew is 1.
|
inline |
Travel proportion in [0,1] for the current value, after the curve.
|
inline |
|
inline |
|
inline |
The value the control returns to on a reset gesture (conventionally a double-click or alt-click).
Unset by default; has_default() is false and reset_to_default() is then a no-op, so a control with no meaningful home position does not silently jump to the minimum.
|
inline |
Pointer pixels that cross the FULL range in a plain (non-velocity) drag.
Larger = finer. Default 250.
|
inline |
|
inline |
|
inline |
Write from a travel proportion (what a drag or a painter's inverse hit-test produces).
Applies the curve, then clamp + snap.
|
inline |
Set the real-world range and the quantization interval.
interval == 0 leaves the value continuous. The current value is re-clamped and re-snapped, silently — a range change is a reconfiguration, not a user edit, and firing listeners here would report a value the user never set.
|
inline |
1 = linear. Below 1, the low end of the range gets more travel.
|
inline |
Choose the skew that places mid_value (real-world units) at half travel.
|
inline |
Write a real-world value.
Clamped to the range and snapped to the interval first; listeners only fire if the STORED value actually moved, so a redundant write in a sync loop is free.
|
inline |
In velocity mode the value moves by pointer SPEED rather than by absolute pointer travel, so a fast flick covers the range and a slow one does not — the pointer and the control decouple.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| std::function<void()> pulp::view::SliderCore::on_gesture_begin |
| std::function<void()> pulp::view::SliderCore::on_gesture_end |
| std::function<void(double)> pulp::view::SliderCore::on_value_change |