Slider

A slider bar for selecting numerical value.

Header#include "nativeui/slider.h"
Namespacenamespace nu
Typeclass (RefCounted)
InheritsView

The default range is between 0 and 100.

Constructors

Slider()

Create a new Slider view.

Class properties

const char* kClassName

The class name of this view.

Methods

void SetValue(float value)

Set the value.

Parameters

float GetValue() const

Return the value.

Return

float

void SetStep(float step)

Set the step value of the slider.

Parameters

float GetStep() const

Return the step value of the slider.

Return

float

void SetRange(float min, float max)

Set the range of the slider.

Parameters

std::tuple<float, float> GetRange() const

Return the range of the slider.

Return

std::tuple<float, float>

Events

void on_value_change(Slider* self)

Emitted when user is changing the slider.

Parameters

Preventable

No.

void on_sliding_complete(Slider* self)

Emitted when user releases the slider.

Note that this event only emits when user was dragging the slider with mouse or trackpad, it does not emit when user was moving the slider with keyboard.

Parameters

Preventable

No.