![]() |
StoneyVCV v2
StoneyDSP Modules for VCV Rack 2.
|
#include <Widget.hpp>
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 float & | getPixelRatio () 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 float * | pixelRatioPtr = NULL |
Private Member Functions | |
Widget (const Widget &)=delete | |
Widget & | operator= (const Widget &)=delete |
Widget (Widget &&)=delete | |
Widget & | operator= (Widget &&)=delete |
Friends | |
template<class TWidget > | |
TWidget * | rack::createWidget (::rack::math::Vec pos) |
template<class TWidget > | |
TWidget * | rack::createWidgetCentered (::rack::math::Vec pos) |
template<class TWidget > | |
TWidget * | StoneyDSP::StoneyVCV::createWidget (::rack::math::Vec pos) |
template<class TWidget > | |
TWidget * | StoneyDSP::StoneyVCV::createWidgetCentered (::rack::math::Vec pos) |
template<class TWidget > | |
TWidget * | StoneyDSP::StoneyVCV::createWidgetSized (::rack::math::Vec pos, ::rack::math::Vec size) |
template<class TWidget > | |
TWidget * | StoneyDSP::StoneyVCV::createWidgetCenteredSized (::rack::math::Vec pos, ::rack::math::Vec size) |
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.
using StoneyDSP::StoneyVCV::ComponentLibrary::Widget::DrawArgs = ::rack::widget::Widget::DrawArgs |
StoneyDSP::StoneyVCV::ComponentLibrary::Widget::Widget | ( | ) |
Construct a new Widget
object.
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
.
|
virtualnoexcept |
Destroys the Widget
object.
|
privatedelete |
Advances the Widget
by one frame.
Calls the superclass's step()
to recurse to children.
Reimplemented in StoneyDSP::StoneyVCV::ComponentLibrary::ThemedPanelWidget, StoneyDSP::StoneyVCV::ComponentLibrary::ThemedParamPanelWidget, StoneyDSP::StoneyVCV::ComponentLibrary::ThemedPortPanelWidget, StoneyDSP::StoneyVCV::ComponentLibrary::ThemedRoundKnobPanelWidget, StoneyDSP::StoneyVCV::ComponentLibrary::ThemedWidget, and StoneyDSP::StoneyVCV::VCA::VCAPanelWidget.
|
overridevirtual |
Draws the Widget
to the NanoVG context.
Calls the superclass's draw(args)
to recurse to children.
args |
Reimplemented in StoneyDSP::StoneyVCV::ComponentLibrary::PanelBorderWidget, StoneyDSP::StoneyVCV::ComponentLibrary::PanelLinesWidget, StoneyDSP::StoneyVCV::ComponentLibrary::SvgWidget, StoneyDSP::StoneyVCV::ComponentLibrary::ThemedPanelWidget, StoneyDSP::StoneyVCV::ComponentLibrary::ThemedParamPanelWidget, StoneyDSP::StoneyVCV::ComponentLibrary::ThemedPortPanelWidget, StoneyDSP::StoneyVCV::ComponentLibrary::ThemedRoundKnobPanelWidget, StoneyDSP::StoneyVCV::ComponentLibrary::ThemedWidget, and StoneyDSP::StoneyVCV::VCA::VCAPanelWidget.
|
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).
e |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
Position relative to parent and size of Widget
.
|
protected |
|
protected |
Disables rendering but allow stepping.
Use isVisible()
, setVisible()
, show()
, or hide()
instead of using this variable directly.
|
protected |