Class Slider#

Inheritance Relationships#

Base Type#

Class Documentation#

class Slider : public Karana::WebUI::Widget#

Widget displaying a slider + editable text box composed of two HTML range objects.

Uses a single State object to store the value, and supports customization via a constructor parameter.

Public Functions

Slider(Router &router, std::string_view text, std::function<void(double)> on_change = {}, const SliderOptions &opts = {}, const Karana::Core::ks_ptr<State> &value_state = nullptr)#

Slider constructor.

Parameters:
  • router – The connection router to use

  • text – The text displayed in the Slider

  • on_change – Called when the Slider is modified

  • opts – Options for the slider (e.g. min, max, step)

  • value_stateState for synchronizing the slider’s value

virtual ~Slider()#

Slider destructor.

void setValue(double value)#

Set the current value of the slider.

Parameters:

value – The value of the slider

void setMin(double min)#

Set the min value of the slider.

Parameters:

min – The lower bound on possible values

void setMax(double max)#

Set the max value of the slider.

Parameters:

max – The upper bound on possible values

void setStep(double step)#

Set the step size of the slider.

Parameters:

step – The step size of values on the slider

Protected Functions

virtual void _onConnect(int client_id) override#

First setup on initial connection.

Parameters:

client_id – The ID of the client connecting.