iPlug2 - C++ Audio Plug-in Framework
Public Member Functions | Protected Attributes | List of all members
IVectorBase Class Reference

A base interface to be combined with IControl for vectorial controls "IVControls", in order for them to share a common style If you need more flexibility, you're on your own! More...

#include <IControl.h>

Inheritance diagram for IVectorBase:
[legend]

Public Member Functions

 IVectorBase (const IVStyle &style, bool labelInWidget=false, bool valueInWidget=false)
 IVectorBase Constructor. More...
 
void AttachIControl (IControl *pControl, const char *label)
 Call in the constructor of your IVControl to link the IVectorBase and IControl. More...
 
void SetColor (EVColor colorIdx, const IColor &color)
 Set one of the IVColors that style the IVControl. More...
 
void SetColors (const IVColorSpec &spec)
 Set the colors of this IVControl. More...
 
const IColorGetColor (EVColor color) const
 Get value of a specific EVColor in the IVControl.
 
void SetLabelStr (const char *label)
 
void SetValueStr (const char *value)
 
void SetWidgetFrac (float frac)
 
void SetAngle (float angle)
 
void SetShowLabel (bool show)
 
void SetShowValue (bool show)
 
void SetRoundness (float roundness)
 
void SetDrawFrame (bool draw)
 
void SetDrawShadows (bool draw)
 
void SetEmboss (bool draw)
 
void SetShadowOffset (float offset)
 
void SetFrameThickness (float thickness)
 
void SetSplashRadius (float radius)
 
void SetSplashPoint (float x, float y)
 
void SetShape (EVShape shape)
 
virtual void SetStyle (const IVStyle &style)
 Set the Style of this IVControl. More...
 
IVStyle GetStyle () const
 Get the style of this IVControl. More...
 
IRECT GetAdjustedHandleBounds (IRECT handleBounds) const
 Get the adjusted bounds for the widget handle, based on the style settings. More...
 
float GetRoundedCornerRadius (const IRECT &bounds) const
 Get the radius of rounded corners for a rectangle, based on the style roundness factor. More...
 
void DrawSplash (IGraphics &g, const IRECT &clipRegion=IRECT())
 Draw a splash effect when a widget handle is clicked (via SplashClickAnimationFunc) More...
 
virtual void DrawBackground (IGraphics &g, const IRECT &rect)
 Draw the IVControl background (usually transparent)
 
virtual void DrawWidget (IGraphics &g)
 Draw the IVControl main widget (override)
 
virtual void DrawLabel (IGraphics &g)
 Draw the IVControl label text.
 
virtual void DrawValue (IGraphics &g, bool mouseOver)
 Draw the IVControl value text.
 
virtual void DrawPressableShape (IGraphics &g, EVShape shape, const IRECT &bounds, bool pressed, bool mouseOver, bool disabled)
 Call one of the DrawPressableShape methods. More...
 
void DrawPressableEllipse (IGraphics &g, const IRECT &bounds, bool pressed, bool mouseOver, bool disabled)
 Draw an ellipse-shaped vector button. More...
 
IRECT DrawPressableRectangle (IGraphics &g, const IRECT &bounds, bool pressed, bool mouseOver, bool disabled, bool rtl=true, bool rtr=true, bool rbl=true, bool rbr=true)
 Draw a rectangle-shaped vector button. More...
 
IRECT DrawPressableTriangle (IGraphics &g, const IRECT &bounds, bool pressed, bool mouseOver, float angle, bool disabled)
 Draw a triangle-shaped vector button. More...
 
IRECT MakeRects (const IRECT &parent, bool hasHandle=false)
 Calculate the rectangles for the various areas, depending on the style. More...
 

Protected Attributes

IControlmControl = nullptr
 
IVStyle mStyle
 
bool mLabelInWidget = false
 
bool mValueInWidget = false
 
float mSplashRadius = 0.f
 
IVec2 mSplashPoint = {0.f, 0.f}
 
float mMaxSplashRadius = 50.f
 
float mTrackSize = 2.f
 
float mValueDisplayFrac = 0.66f
 
IRECT mWidgetBounds
 
IRECT mLabelBounds
 
IRECT mValueBounds
 
WDL_String mLabelStr
 
WDL_String mValueStr
 
EVShape mShape = EVShape::Rectangle
 

Detailed Description

A base interface to be combined with IControl for vectorial controls "IVControls", in order for them to share a common style If you need more flexibility, you're on your own!

Definition at line 624 of file IControl.h.

Constructor & Destructor Documentation

IVectorBase::IVectorBase ( const IVStyle style,
bool  labelInWidget = false,
bool  valueInWidget = false 
)
inline

IVectorBase Constructor.

Parameters
stylethe IVStyle for this control
labelInWidgetSet true If the label should be drawn inside the widget bounds
valueInWidgetSet true If the value should be drawn inside the widget bounds

Definition at line 631 of file IControl.h.

Referenced by IVPlotControl::AddPlotFunc(), IVRadioButtonControl::GetButtonForPoint(), IVButtonControl::IsHit(), IVKnobControl::OnInit(), IVRangeSliderControl::OnMouseDrag(), and IVGroupControl::OnResize().

Member Function Documentation

void IVectorBase::AttachIControl ( IControl pControl,
const char *  label 
)
inline
void IVectorBase::DrawPressableEllipse ( IGraphics g,
const IRECT bounds,
bool  pressed,
bool  mouseOver,
bool  disabled 
)
inline

Draw an ellipse-shaped vector button.

Parameters
gThe IGraphics context
boundsThe bounds in which to draw the shape
pressed/c true if shape is pressed
mouseOver/c true if the mouse is over the bounds
disabled/c true if the shape should be drawn disabled

Definition at line 804 of file IControl.h.

References IGraphics::DrawEllipse(), IGraphics::FillEllipse(), IRECT::GetPadded(), IRECT::GetTranslated(), IRECT::ReduceFromBottom(), and IRECT::ReduceFromRight().

IRECT IVectorBase::DrawPressableRectangle ( IGraphics g,
const IRECT bounds,
bool  pressed,
bool  mouseOver,
bool  disabled,
bool  rtl = true,
bool  rtr = true,
bool  rbl = true,
bool  rbr = true 
)
inline

Draw a rectangle-shaped vector button.

Parameters
gThe IGraphics context
boundsThe bounds in which to draw the shape
pressed/c true if shape is pressed
mouseOver/c true if the mouse is over the bounds
disabled/c true if the shape should be drawn disabled
Returns
The handle area of the rectangle

Definition at line 876 of file IControl.h.

References IGraphics::DrawRoundRect(), IGraphics::FillRoundRect(), IRECT::GetPadded(), IRECT::GetTranslated(), IRECT::ReduceFromBottom(), and IRECT::ReduceFromRight().

Referenced by IVTabSwitchControl::Draw(), and IVPanelControl::DrawWidget().

virtual void IVectorBase::DrawPressableShape ( IGraphics g,
EVShape  shape,
const IRECT bounds,
bool  pressed,
bool  mouseOver,
bool  disabled 
)
inlinevirtual

Call one of the DrawPressableShape methods.

Parameters
gThe IGraphics context
shapeThe shape to draw
boundsThe bounds in which to draw the shape
pressed/c true if shape is pressed
mouseOver/c true if the mouse is over the bounds
disabled/c true if the shape should be drawn disabled

Definition at line 775 of file IControl.h.

Referenced by IVTabSwitchControl::Draw(), IVButtonControl::DrawWidget(), IVSwitchControl::DrawWidget(), IVToggleControl::DrawWidget(), IVSlideSwitchControl::DrawWidget(), IVKnobControl::DrawWidget(), IVSliderControl::DrawWidget(), and IVXYPadControl::DrawWidget().

IRECT IVectorBase::DrawPressableTriangle ( IGraphics g,
const IRECT bounds,
bool  pressed,
bool  mouseOver,
float  angle,
bool  disabled 
)
inline

Draw a triangle-shaped vector button.

Parameters
gThe IGraphics context used for drawing
boundsWhere to draw the button
pressedWhether to draw the button pressed or unpressed
mouseOverWhether mouse is currently hovering on control

Definition at line 959 of file IControl.h.

References IRECT::B, IGraphics::DrawTriangle(), IGraphics::FillTriangle(), IRECT::GetTranslated(), IRECT::H(), IRECT::L, IRECT::MW(), IRECT::R, IRECT::T, and IRECT::W().

Referenced by IVRangeSliderControl::Draw().

void IVectorBase::DrawSplash ( IGraphics g,
const IRECT clipRegion = IRECT() 
)
inline

Draw a splash effect when a widget handle is clicked (via SplashClickAnimationFunc)

Parameters
gThe graphics context
clipRegionOptional clip region for the splash

Definition at line 725 of file IControl.h.

References IGraphics::FillCircle(), and IGraphics::PathClipRegion().

IRECT IVectorBase::GetAdjustedHandleBounds ( IRECT  handleBounds) const
inline

Get the adjusted bounds for the widget handle, based on the style settings.

Parameters
handleBoundsThe initial bounds
Returns
IRECT The adjusted bounds

Definition at line 700 of file IControl.h.

References IRECT::Offset(), and IRECT::Pad().

float IVectorBase::GetRoundedCornerRadius ( const IRECT bounds) const
inline

Get the radius of rounded corners for a rectangle, based on the style roundness factor.

Parameters
boundsThe rectangle
Returns
float The radius

Definition at line 714 of file IControl.h.

References IRECT::H(), and IRECT::W().

Referenced by IVSliderControl::Draw(), IVSlideSwitchControl::DrawWidget(), IVGroupControl::DrawWidget(), and IVGroupControl::OnResize().

IVStyle IVectorBase::GetStyle ( ) const
inline

Get the style of this IVControl.

Returns
IVStyle

Definition at line 695 of file IControl.h.

IRECT IVectorBase::MakeRects ( const IRECT parent,
bool  hasHandle = false 
)
inline
void IVectorBase::SetColor ( EVColor  colorIdx,
const IColor color 
)
inline

Set one of the IVColors that style the IVControl.

Parameters
colorIdxThe index of the color to set
colorThe new color

Definition at line 650 of file IControl.h.

Referenced by IVColorSwatchControl::OnMouseDown().

void IVectorBase::SetColors ( const IVColorSpec spec)
inline

Set the colors of this IVControl.

Parameters
specThe new color spec

Definition at line 658 of file IControl.h.

virtual void IVectorBase::SetStyle ( const IVStyle style)
inlinevirtual

Set the Style of this IVControl.

Parameters
style

Reimplemented in IVNumberBoxControl.

Definition at line 687 of file IControl.h.

Referenced by IVNumberBoxControl::SetStyle(), and IGraphics::StyleAllVectorControls().


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