VCV Rack API v2
Loading...
Searching...
No Matches
rack::app::SvgSlider Struct Reference

Behaves like a knob but linearly moves an widget::SvgWidget between two points. More...

#include <SvgSlider.hpp>

Inheritance diagram for rack::app::SvgSlider:
[legend]
Collaboration diagram for rack::app::SvgSlider:
[legend]

Public Member Functions

 SvgSlider ()
void setBackgroundSvg (std::shared_ptr< window::Svg > svg)
void setHandleSvg (std::shared_ptr< window::Svg > svg)
void setHandlePos (math::Vec minHandlePos, math::Vec maxHandlePos)
void setHandlePosCentered (math::Vec minHandlePosCentered, math::Vec maxHandlePosCentered)
void onChange (const ChangeEvent &e) override
DEPRECATED void setBackgroundSVG (std::shared_ptr< window::Svg > svg)
DEPRECATED void setHandleSVG (std::shared_ptr< window::Svg > svg)
DEPRECATED void setSVGs (std::shared_ptr< window::Svg > backgroundSvg, std::shared_ptr< window::Svg > handleSvg)
Public Member Functions inherited from rack::app::SliderKnob
 SliderKnob ()
void onHover (const HoverEvent &e) override
void onButton (const ButtonEvent &e) override
Public Member Functions inherited from rack::app::Knob
 Knob ()
 ~Knob ()
void initParamQuantity () override
 Configures ParamQuantity properties based on the type of ParamWidget.
void onDragStart (const DragStartEvent &e) override
void onDragEnd (const DragEndEvent &e) override
void onDragMove (const DragMoveEvent &e) override
void onDragLeave (const DragLeaveEvent &e) override
void onHoverScroll (const HoverScrollEvent &e) override
void onLeave (const LeaveEvent &e) override
void onAction (const ActionEvent &e) override
 Called when user clicks the knob without moving it.
Public Member Functions inherited from rack::app::ParamWidget
 ParamWidget ()
 ~ParamWidget ()
engine::ParamQuantitygetParamQuantity ()
void createTooltip ()
void destroyTooltip ()
void step () override
 Advances the module by one frame.
void draw (const DrawArgs &args) override
 Draws the widget to the NanoVG context.
void onDoubleClick (const DoubleClickEvent &e) override
void onEnter (const EnterEvent &e) override
void onLeave (const LeaveEvent &e) override
void createContextMenu ()
virtual void appendContextMenu (ui::Menu *menu)
 Override to add custom menu items at the bottom of the parameter context menu.
void resetAction ()
Public Member Functions inherited from rack::widget::OpaqueWidget
void onHoverKey (const HoverKeyEvent &e) override
void onHoverText (const HoverTextEvent &e) override
void onHoverScroll (const HoverScrollEvent &e) override
void onDragHover (const DragHoverEvent &e) override
void onPathDrop (const PathDropEvent &e) override
Public Member Functions inherited from rack::widget::Widget
virtual ~Widget ()
math::Rect getBox ()
void setBox (math::Rect box)
 Calls setPosition() and then setSize().
math::Vec getPosition ()
void setPosition (math::Vec pos)
 Sets position and triggers RepositionEvent if position changed.
math::Vec getSize ()
void setSize (math::Vec size)
 Sets size and triggers ResizeEvent if size changed.
widget::WidgetgetParent ()
bool isVisible ()
void setVisible (bool visible)
 Sets visible and triggers ShowEvent or HideEvent if changed.
void show ()
 Makes Widget visible and triggers ShowEvent if changed.
void hide ()
 Makes Widget not visible and triggers HideEvent if changed.
void requestDelete ()
 Requests this Widget's parent to delete it in the next step().
virtual math::Rect getChildrenBoundingBox ()
 Returns the smallest rectangle containing this widget's children (visible and invisible) in its local coordinates.
virtual math::Rect getVisibleChildrenBoundingBox ()
bool isDescendantOf (Widget *ancestor)
 Returns whether ancestor is a parent or distant parent of this widget.
virtual math::Vec getRelativeOffset (math::Vec v, Widget *ancestor)
 Returns v (given in local coordinates) transformed into the coordinate system of ancestor.
math::Vec getAbsoluteOffset (math::Vec v)
 Returns v transformed into world/root/global/absolute coordinates.
virtual float getRelativeZoom (Widget *ancestor)
 Returns the zoom level in the coordinate system of ancestor.
float getAbsoluteZoom ()
virtual math::Rect getViewport (math::Rect r=math::Rect::inf())
 Returns a subset of the given Rect bounded by the box of this widget and all ancestors.
template<class T>
T * getAncestorOfType ()
template<class T>
T * getFirstDescendantOfType ()
bool hasChild (Widget *child)
 Checks if the given widget is a child of this widget.
void addChild (Widget *child)
 Adds widget to the top of the children.
void addChildBottom (Widget *child)
 Adds widget to the bottom of the children.
void addChildBelow (Widget *child, Widget *sibling)
 Adds widget directly below another widget.
void addChildAbove (Widget *child, Widget *sibling)
void removeChild (Widget *child)
 Removes widget from list of children if it exists.
void clearChildren ()
 Removes and deletes all child Widgets.
virtual DEPRECATED void draw (NVGcontext *vg)
 Override draw(const DrawArgs &args) instead.
virtual void drawLayer (const DrawArgs &args, int layer)
 Draw additional layers.
void drawChild (Widget *child, const DrawArgs &args, int layer=0)
 Draws a particular child.
template<typename TMethod, class TEvent>
void recurseEvent (TMethod f, const TEvent &e)
 Recurses an event to all visible Widgets.
template<typename TMethod, class TEvent>
void recursePositionEvent (TMethod f, const TEvent &e)
 Recurses an event to all visible Widgets until it is consumed.
virtual void onSelect (const SelectEvent &e)
virtual void onDeselect (const DeselectEvent &e)
virtual void onSelectKey (const SelectKeyEvent &e)
virtual void onSelectText (const SelectTextEvent &e)
virtual void onDragEnter (const DragEnterEvent &e)
virtual void onDragDrop (const DragDropEvent &e)
virtual void onDirty (const DirtyEvent &e)
virtual void onReposition (const RepositionEvent &e)
virtual void onResize (const ResizeEvent &e)
virtual void onAdd (const AddEvent &e)
virtual void onRemove (const RemoveEvent &e)
virtual void onShow (const ShowEvent &e)
virtual void onHide (const HideEvent &e)
virtual void onContextCreate (const ContextCreateEvent &e)
virtual void onContextDestroy (const ContextDestroyEvent &e)
Public Member Functions inherited from rack::WeakBase
 ~WeakBase ()
size_t getWeakCount ()

Public Attributes

widget::FramebufferWidgetfb
widget::SvgWidgetbackground
widget::SvgWidgethandle
math::Vec minHandlePos
 Intermediate positions will be interpolated between these positions.
math::Vec maxHandlePos
Public Attributes inherited from rack::app::Knob
Internal * internal
bool horizontal = false
 Drag horizontally instead of vertically.
bool smooth = true
 Enables per-sample value smoothing while dragging.
bool snap = false
 Enables value snapping to the nearest integer.
float speed = 1.f
 Multiplier for mouse movement to adjust knob value.
bool forceLinear = false
 Force dragging to linear, e.g.
float minAngle = -M_PI
 Angles in radians.
float maxAngle = M_PI
Public Attributes inherited from rack::app::ParamWidget
Internal * internal
int paramId = -1
Public Attributes inherited from rack::widget::Widget
math::Rect box = math::Rect(math::Vec(), math::Vec(INFINITY, INFINITY))
 Position relative to parent and size of widget.
Widgetparent = NULL
 Automatically set when Widget is added as a child to another Widget.
std::list< Widget * > children
bool visible = true
 Disables rendering but allow stepping.
bool requestedDelete = false
 If set to true, parent will delete Widget in the next step().
Public Attributes inherited from rack::WeakBase
WeakHandleweakHandle = nullptr

Additional Inherited Members

Public Types inherited from rack::widget::Widget
using BaseEvent = widget::BaseEvent

Detailed Description

Behaves like a knob but linearly moves an widget::SvgWidget between two points.

Can be used for horizontal or vertical linear faders.

Constructor & Destructor Documentation

◆ SvgSlider()

rack::app::SvgSlider::SvgSlider ( )

Member Function Documentation

◆ setBackgroundSvg()

void rack::app::SvgSlider::setBackgroundSvg ( std::shared_ptr< window::Svg > svg)

◆ setHandleSvg()

void rack::app::SvgSlider::setHandleSvg ( std::shared_ptr< window::Svg > svg)

◆ setHandlePos()

void rack::app::SvgSlider::setHandlePos ( math::Vec minHandlePos,
math::Vec maxHandlePos )

◆ setHandlePosCentered()

void rack::app::SvgSlider::setHandlePosCentered ( math::Vec minHandlePosCentered,
math::Vec maxHandlePosCentered )

◆ onChange()

void rack::app::SvgSlider::onChange ( const ChangeEvent & e)
overridevirtual

Reimplemented from rack::widget::Widget.

◆ setBackgroundSVG()

DEPRECATED void rack::app::SvgSlider::setBackgroundSVG ( std::shared_ptr< window::Svg > svg)
inline

◆ setHandleSVG()

DEPRECATED void rack::app::SvgSlider::setHandleSVG ( std::shared_ptr< window::Svg > svg)
inline

◆ setSVGs()

DEPRECATED void rack::app::SvgSlider::setSVGs ( std::shared_ptr< window::Svg > backgroundSvg,
std::shared_ptr< window::Svg > handleSvg )
inline

Member Data Documentation

◆ fb

widget::FramebufferWidget* rack::app::SvgSlider::fb

◆ background

widget::SvgWidget* rack::app::SvgSlider::background

◆ handle

widget::SvgWidget* rack::app::SvgSlider::handle

◆ minHandlePos

math::Vec rack::app::SvgSlider::minHandlePos

Intermediate positions will be interpolated between these positions.

◆ maxHandlePos

math::Vec rack::app::SvgSlider::maxHandlePos

The documentation for this struct was generated from the following file: