VCV Rack API v2
Loading...
Searching...
No Matches
Knob.hpp
Go to the documentation of this file.
1#pragma once
2#include <app/common.hpp>
3#include <app/ParamWidget.hpp>
4#include <context.hpp>
5
6
7namespace rack {
8namespace app {
9
10
12struct Knob : ParamWidget {
13 struct Internal;
14 Internal* internal;
15
17 bool horizontal = false;
21 bool smooth = true;
25 bool snap = false;
27 float speed = 1.f;
29 bool forceLinear = false;
33 float minAngle = -M_PI;
34 float maxAngle = M_PI;
35
38 void initParamQuantity() override;
39 void onHover(const HoverEvent& e) override;
40 void onButton(const ButtonEvent& e) override;
41 void onDragStart(const DragStartEvent& e) override;
42 void onDragEnd(const DragEndEvent& e) override;
43 void onDragMove(const DragMoveEvent& e) override;
44 void onDragLeave(const DragLeaveEvent& e) override;
45 void onHoverScroll(const HoverScrollEvent& e) override;
46 void onLeave(const LeaveEvent& e) override;
50 void onAction(const ActionEvent& e) override {}
51};
52
53
54} // namespace app
55} // namespace rack
Root namespace for the Rack API.
Definition AudioDisplay.hpp:9
Implements vertical dragging behavior for ParamWidgets.
Definition Knob.hpp:12
void onButton(const ButtonEvent &e) override
bool smooth
Enables per-sample value smoothing while dragging.
Definition Knob.hpp:21
bool horizontal
Drag horizontally instead of vertically.
Definition Knob.hpp:17
void onDragStart(const DragStartEvent &e) override
bool snap
Enables value snapping to the nearest integer.
Definition Knob.hpp:25
float maxAngle
Definition Knob.hpp:34
void onDragEnd(const DragEndEvent &e) override
void onLeave(const LeaveEvent &e) override
bool forceLinear
Force dragging to linear, e.g.
Definition Knob.hpp:29
Internal * internal
Definition Knob.hpp:14
void onDragMove(const DragMoveEvent &e) override
void onDragLeave(const DragLeaveEvent &e) override
float minAngle
Angles in radians.
Definition Knob.hpp:33
void initParamQuantity() override
Configures ParamQuantity properties based on the type of ParamWidget.
void onHoverScroll(const HoverScrollEvent &e) override
float speed
Multiplier for mouse movement to adjust knob value.
Definition Knob.hpp:27
void onAction(const ActionEvent &e) override
Called when user clicks the knob without moving it.
Definition Knob.hpp:50
void onHover(const HoverEvent &e) override
Manages an engine::Param on a ModuleWidget.
Definition ParamWidget.hpp:14
Occurs after a certain action is triggered on a Widget.
Definition Widget.hpp:445
Occurs each mouse button press or release.
Definition Widget.hpp:237
Occurs when a Widget stops being dragged by releasing the mouse button.
Definition Widget.hpp:375
Occurs when the mouse leaves a Widget while dragging.
Definition Widget.hpp:414
Occurs every frame on the dragged Widget.
Definition Widget.hpp:381
Occurs when a Widget begins being dragged.
Definition Widget.hpp:369
Occurs every frame when the mouse is hovering over a Widget.
Definition Widget.hpp:225
Occurs when the mouse scroll wheel is moved while the mouse is hovering a Widget.
Definition Widget.hpp:315
Occurs when a different Widget is entered.
Definition Widget.hpp:333