StoneyVCV v2
StoneyDSP Modules for VCV Rack 2.
Loading...
Searching...
No Matches
StoneyDSP::StoneyVCV::ComponentLibrary::Widget Struct Reference

The Widget struct. More...

#include <Widget.hpp>

Inheritance diagram for StoneyDSP::StoneyVCV::ComponentLibrary::Widget:
[legend]
Collaboration diagram for StoneyDSP::StoneyVCV::ComponentLibrary::Widget:
[legend]

Classes

struct  PixelRatioChangeEvent
 

Public Types

using DrawArgs = ::rack::widget::Widget::DrawArgs
 

Public Member Functions

 Widget ()
 Construct a new Widget object.
 
 Widget (::rack::math::Rect newBox)
 Construct a new Widget object with its' position and size set using a rack::math::Rect.
 
virtual ~Widget () noexcept
 Destroys the Widget object.
 
virtual void step () override
 Advances the Widget by one frame.
 
virtual void draw (const ::StoneyDSP::StoneyVCV::ComponentLibrary::Widget::DrawArgs &args) override
 Draws the Widget to the NanoVG context.
 
virtual void onPixelRatioChange (const PixelRatioChangeEvent &e)
 Called after the App->window->pixelRatio setting is changed.
 
const floatgetPixelRatio () const noexcept
 

Protected Attributes

::rack::math::Rect box = ::rack::math::Rect(::rack::math::Vec(), ::rack::math::Vec(INFINITY, INFINITY))
 Position relative to parent and size of Widget.
 
::rack::Widget * parent = NULL
 Automatically set when Widget is added as a child to another Widget.
 
::std::list<::rack::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().
 
float lastPixelRatio = { rack::contextGet() ->window->pixelRatio}
 
const floatpixelRatioPtr = NULL
 

Private Member Functions

 Widget (const Widget &)=delete
 
Widgetoperator= (const Widget &)=delete
 
 Widget (Widget &&)=delete
 
Widgetoperator= (Widget &&)=delete
 

Friends

template<class TWidget >
TWidgetrack::createWidget (::rack::math::Vec pos)
 
template<class TWidget >
TWidgetrack::createWidgetCentered (::rack::math::Vec pos)
 
template<class TWidget >
TWidgetStoneyDSP::StoneyVCV::createWidget (::rack::math::Vec pos)
 
template<class TWidget >
TWidgetStoneyDSP::StoneyVCV::createWidgetCentered (::rack::math::Vec pos)
 
template<class TWidget >
TWidgetStoneyDSP::StoneyVCV::createWidgetSized (::rack::math::Vec pos, ::rack::math::Vec size)
 
template<class TWidget >
TWidgetStoneyDSP::StoneyVCV::createWidgetCenteredSized (::rack::math::Vec pos, ::rack::math::Vec size)
 

Detailed Description

The Widget struct.

A node in the 2D scene graph. The bounding box of a Widget is a rectangle specified by box relative to their parent.

The appearance is defined by overriding draw(), and the behavior is defined by overriding step() and on*() event handlers.

Member Typedef Documentation

◆ DrawArgs

Constructor & Destructor Documentation

◆ Widget() [1/4]

StoneyDSP::StoneyVCV::ComponentLibrary::Widget::Widget ( )

Construct a new Widget object.

◆ Widget() [2/4]

StoneyDSP::StoneyVCV::ComponentLibrary::Widget::Widget ( ::rack::math::Rect  newBox)

Construct a new Widget object with its' position and size set using a rack::math::Rect.

◆ ~Widget()

virtual StoneyDSP::StoneyVCV::ComponentLibrary::Widget::~Widget ( )
virtualnoexcept

Destroys the Widget object.

◆ Widget() [3/4]

StoneyDSP::StoneyVCV::ComponentLibrary::Widget::Widget ( const Widget )
privatedelete

◆ Widget() [4/4]

StoneyDSP::StoneyVCV::ComponentLibrary::Widget::Widget ( Widget &&  )
privatedelete

Member Function Documentation

◆ step()

◆ draw()

◆ onPixelRatioChange()

virtual void StoneyDSP::StoneyVCV::ComponentLibrary::Widget::onPixelRatioChange ( const PixelRatioChangeEvent e)
inlinevirtual

Called after the App->window->pixelRatio setting is changed.

Sub-classes can override this to receive callbacks when the event is dispatched (from the Widget::step() method).

Parameters
e

◆ getPixelRatio()

const float & StoneyDSP::StoneyVCV::ComponentLibrary::Widget::getPixelRatio ( ) const
noexcept

◆ operator=() [1/2]

Widget & StoneyDSP::StoneyVCV::ComponentLibrary::Widget::operator= ( const Widget )
privatedelete

◆ operator=() [2/2]

Widget & StoneyDSP::StoneyVCV::ComponentLibrary::Widget::operator= ( Widget &&  )
privatedelete

Friends And Related Symbol Documentation

◆ rack::createWidget

template<class TWidget >
TWidget * rack::createWidget ( ::rack::math::Vec  pos)
friend

◆ rack::createWidgetCentered

template<class TWidget >
TWidget * rack::createWidgetCentered ( ::rack::math::Vec  pos)
friend

◆ StoneyDSP::StoneyVCV::createWidget

template<class TWidget >
TWidget * StoneyDSP::StoneyVCV::createWidget ( ::rack::math::Vec  pos)
friend

◆ StoneyDSP::StoneyVCV::createWidgetCentered

template<class TWidget >
TWidget * StoneyDSP::StoneyVCV::createWidgetCentered ( ::rack::math::Vec  pos)
friend

◆ StoneyDSP::StoneyVCV::createWidgetSized

template<class TWidget >
TWidget * StoneyDSP::StoneyVCV::createWidgetSized ( ::rack::math::Vec  pos,
::rack::math::Vec  size 
)
friend

◆ StoneyDSP::StoneyVCV::createWidgetCenteredSized

template<class TWidget >
TWidget * StoneyDSP::StoneyVCV::createWidgetCenteredSized ( ::rack::math::Vec  pos,
::rack::math::Vec  size 
)
friend

Member Data Documentation

◆ box

::rack::math::Rect StoneyDSP::StoneyVCV::ComponentLibrary::Widget::box = ::rack::math::Rect(::rack::math::Vec(), ::rack::math::Vec(INFINITY, INFINITY))
protected

Position relative to parent and size of Widget.

◆ parent

::rack::Widget* StoneyDSP::StoneyVCV::ComponentLibrary::Widget::parent = NULL
protected

Automatically set when Widget is added as a child to another Widget.

◆ children

::std::list<::rack::Widget *> StoneyDSP::StoneyVCV::ComponentLibrary::Widget::children
protected

◆ visible

bool StoneyDSP::StoneyVCV::ComponentLibrary::Widget::visible = true
protected

Disables rendering but allow stepping.

Use isVisible(), setVisible(), show(), or hide() instead of using this variable directly.

◆ requestedDelete

bool StoneyDSP::StoneyVCV::ComponentLibrary::Widget::requestedDelete = false
protected

If set to true, parent will delete Widget in the next step().

Use requestDelete() instead of using this variable directly.

◆ lastPixelRatio

float StoneyDSP::StoneyVCV::ComponentLibrary::Widget::lastPixelRatio = { rack::contextGet() ->window->pixelRatio}
protected

◆ pixelRatioPtr

const float* StoneyDSP::StoneyVCV::ComponentLibrary::Widget::pixelRatioPtr = NULL
protected

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