Class ColorWheel

Inheritance Relationships

Base Type

Class Documentation

class ColorWheel : public nanogui::Widget

Fancy analog widget to select a color value. This widget was contributed by Dmitriy Morozov.

Public Functions

ColorWheel(Widget *parent, const Color &color = Color(1.0f, , , ))

Adds a ColorWheel to the specified parent.

Parameters

std::function<void(const Color&)> callback() const

The callback to execute when a user changes the ColorWheel value.

void setCallback(const std::function<void(const Color&)> &callback)

Sets the callback to execute when a user changes the ColorWheel value.

Color color() const

The current Color this ColorWheel has selected.

void setColor(const Color &color)

Sets the current Color this ColorWheel has selected.

virtual Vector2i preferredSize(NVGcontext *ctx) const

The preferred size of this ColorWheel.

virtual void draw(NVGcontext *ctx)

Draws the ColorWheel.

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

Handles mouse button click events for the ColorWheel.

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

Handles mouse drag events for the ColorWheel.

virtual void save(Serializer &s) const

Saves the current state of this ColorWheel to the specified Serializer.

virtual bool load(Serializer &s)

Sets the state of this ColorWheel using the specified Serializer.

Protected Attributes

float mHue

The current Hue in the HSV color model.

float mWhite

The implicit Value component of the HSV color model. See implementation nanogui::ColorWheel::color for its usage. Valid values are in the range [0, 1].

float mBlack

The implicit Saturation component of the HSV color model. See implementation nanogui::ColorWheel::color for its usage. Valid values are in the range [0, 1].

Region mDragRegion

The current region the mouse is interacting with.

std::function<void(const Color&)> mCallback

The current callback to execute when the color value has changed.