Class Slider

Inheritance Relationships

Base Type

Class Documentation

class Slider : public nanogui::Widget

Fractional slider widget with mouse control.

Public Functions

Slider(Widget *parent)
float value() const
void setValue(float value)
const Color &highlightColor() const
void setHighlightColor(const Color &highlightColor)
std::pair<float, float> range() const
void setRange(std::pair<float, float> range)
std::pair<float, float> highlightedRange() const
void setHighlightedRange(std::pair<float, float> highlightedRange)
std::function<void(float)> callback() const
void setCallback(const std::function<void(float)> &callback)
std::function<void(float)> finalCallback() const
void setFinalCallback(const std::function<void(float)> &callback)
virtual Vector2i preferredSize(NVGcontext *ctx) const

Compute the preferred size of the widget.

virtual bool mouseDragEvent(const Vector2i &p, const Vector2i &rel, int button, int modifiers)

Handle a mouse drag event (default implementation: do nothing)

virtual bool mouseButtonEvent(const Vector2i &p, int button, bool down, int modifiers)

Handle a mouse button event (default implementation: propagate to children)

virtual void draw(NVGcontext *ctx)

Draw the widget (and all child widgets)

virtual void save(Serializer &s) const

Save the state of the widget into the given Serializer instance.

virtual bool load(Serializer &s)

Restore the state of the widget from the given Serializer instance.

Protected Attributes

float mValue
std::function<void(float)> mCallback
std::function<void(float)> mFinalCallback
std::pair<float, float> mRange
std::pair<float, float> mHighlightedRange
Color mHighlightColor