iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
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...
 
virtual void OnStyleChanged ()
 Implement if extra changes are required in response to style changing. 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. More...
 
void SetLabelStr (const char *label)
 
const char * GetLabelStr () const
 
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...
 
IRECT GetWidgetBounds () const
 
IRECT GetLabelBounds () const
 
IRECT GetValueBounds () const
 
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) More...
 
virtual void DrawWidget (IGraphics &g)
 Draw the IVControl main widget (override) More...
 
virtual void DrawLabel (IGraphics &g)
 Draw the IVControl label text. More...
 
virtual void DrawValue (IGraphics &g, bool mouseOver)
 Draw the IVControl value text. More...
 
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 756 of file IControl.h.

Constructor & Destructor Documentation

◆ IVectorBase()

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 763 of file IControl.h.

References SetStyle().

◆ ~IVectorBase()

virtual IVectorBase::~IVectorBase ( )
inlinevirtual

Definition at line 770 of file IControl.h.

Member Function Documentation

◆ AttachIControl()

void IVectorBase::AttachIControl ( IControl pControl,
const char *  label 
)
inline

Call in the constructor of your IVControl to link the IVectorBase and IControl.

Parameters
pControlPtr to the control
labelCString for the IVControl label

Definition at line 775 of file IControl.h.

Referenced by IVButtonControl::IVButtonControl(), IVGroupControl::IVGroupControl(), IVMenuButtonControl::IVMenuButtonControl(), IVPlotControl::IVPlotControl(), IVScopeControl< MAXNC, MAXBUF >::IVScopeControl(), and IVTabSwitchControl::IVTabSwitchControl().

◆ DrawBackground()

virtual void IVectorBase::DrawBackground ( IGraphics g,
const IRECT rect 
)
inlinevirtual

◆ DrawLabel()

virtual void IVectorBase::DrawLabel ( IGraphics g)
inlinevirtual

◆ DrawPressableEllipse()

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 948 of file IControl.h.

References IGraphics::DrawEllipse(), DrawSplash(), IGraphics::FillEllipse(), IControl::GetAnimationFunction(), IControl::GetBlend(), GetColor(), IRECT::GetPadded(), IRECT::GetTranslated(), IRECT::ReduceFromBottom(), and IRECT::ReduceFromRight().

Referenced by DrawPressableShape().

◆ DrawPressableRectangle()

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 1020 of file IControl.h.

References IGraphics::DrawRoundRect(), DrawSplash(), IGraphics::FillRoundRect(), GetAdjustedHandleBounds(), IControl::GetAnimationFunction(), IControl::GetBlend(), GetColor(), IRECT::GetPadded(), GetRoundedCornerRadius(), IRECT::GetTranslated(), IRECT::ReduceFromBottom(), and IRECT::ReduceFromRight().

Referenced by DrawPressableShape(), and IVPanelControl::DrawWidget().

◆ DrawPressableShape()

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 918 of file IControl.h.

References DrawPressableEllipse(), DrawPressableRectangle(), and DrawPressableTriangle().

Referenced by IVButtonControl::DrawWidget(), IVSwitchControl::DrawWidget(), IVToggleControl::DrawWidget(), and IVKnobControl::DrawWidget().

◆ DrawPressableTriangle()

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 1103 of file IControl.h.

References DrawSplash(), IGraphics::DrawTriangle(), IGraphics::FillTriangle(), GetAdjustedHandleBounds(), IControl::GetAnimationFunction(), IControl::GetBlend(), GetColor(), IRECT::GetTranslated(), IRECT::H(), IRECT::MW(), and IRECT::W().

Referenced by DrawPressableShape().

◆ DrawSplash()

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 868 of file IControl.h.

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

Referenced by DrawPressableEllipse(), DrawPressableRectangle(), and DrawPressableTriangle().

◆ DrawValue()

virtual void IVectorBase::DrawValue ( IGraphics g,
bool  mouseOver 
)
inlinevirtual

◆ DrawWidget()

virtual void IVectorBase::DrawWidget ( IGraphics g)
inlinevirtual

◆ GetAdjustedHandleBounds()

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 839 of file IControl.h.

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

Referenced by DrawPressableRectangle(), DrawPressableTriangle(), and MakeRects().

◆ GetColor()

const IColor & IVectorBase::GetColor ( EVColor  color) const
inline

◆ GetLabelBounds()

IRECT IVectorBase::GetLabelBounds ( ) const
inline

Definition at line 862 of file IControl.h.

◆ GetLabelStr()

const char * IVectorBase::GetLabelStr ( ) const
inline

Definition at line 807 of file IControl.h.

◆ GetRoundedCornerRadius()

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 853 of file IControl.h.

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

Referenced by IVTabbedPagesControl::Draw(), DrawPressableRectangle(), IVGroupControl::DrawWidget(), and IVGroupControl::OnResize().

◆ GetStyle()

IVStyle IVectorBase::GetStyle ( ) const
inline

Get the style of this IVControl.

Returns
IVStyle

Definition at line 834 of file IControl.h.

Referenced by IVTabbedPagesControl::OnAttached(), and IVTabbedPagesControl::OnStyleChanged().

◆ GetValueBounds()

IRECT IVectorBase::GetValueBounds ( ) const
inline

Definition at line 863 of file IControl.h.

◆ GetWidgetBounds()

IRECT IVectorBase::GetWidgetBounds ( ) const
inline

Definition at line 861 of file IControl.h.

◆ MakeRects()

IRECT IVectorBase::MakeRects ( const IRECT parent,
bool  hasHandle = false 
)
inline

◆ OnStyleChanged()

virtual void IVectorBase::OnStyleChanged ( )
inlinevirtual

Implement if extra changes are required in response to style changing.

Reimplemented in IVTabPage, and IVTabbedPagesControl.

Definition at line 782 of file IControl.h.

Referenced by SetStyle().

◆ SetAngle()

void IVectorBase::SetAngle ( float  angle)
inline

Definition at line 810 of file IControl.h.

◆ SetColor()

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 787 of file IControl.h.

References IControl::SetDirty().

Referenced by IVColorSwatchControl::OnMouseDown().

◆ SetColors()

void IVectorBase::SetColors ( const IVColorSpec spec)
inline

Set the colors of this IVControl.

Parameters
specThe new color spec

Definition at line 795 of file IControl.h.

Referenced by SetStyle().

◆ SetDrawFrame()

void IVectorBase::SetDrawFrame ( bool  draw)
inline

Definition at line 814 of file IControl.h.

◆ SetDrawShadows()

void IVectorBase::SetDrawShadows ( bool  draw)
inline

Definition at line 815 of file IControl.h.

◆ SetEmboss()

void IVectorBase::SetEmboss ( bool  draw)
inline

Definition at line 816 of file IControl.h.

◆ SetFrameThickness()

void IVectorBase::SetFrameThickness ( float  thickness)
inline

Definition at line 818 of file IControl.h.

◆ SetLabelStr()

void IVectorBase::SetLabelStr ( const char *  label)
inline

Definition at line 806 of file IControl.h.

◆ SetRoundness()

void IVectorBase::SetRoundness ( float  roundness)
inline

Definition at line 813 of file IControl.h.

◆ SetShadowOffset()

void IVectorBase::SetShadowOffset ( float  offset)
inline

Definition at line 817 of file IControl.h.

◆ SetShape()

void IVectorBase::SetShape ( EVShape  shape)
inline

Definition at line 821 of file IControl.h.

◆ SetShowLabel()

void IVectorBase::SetShowLabel ( bool  show)
inline

Definition at line 811 of file IControl.h.

◆ SetShowValue()

void IVectorBase::SetShowValue ( bool  show)
inline

Definition at line 812 of file IControl.h.

◆ SetSplashPoint()

void IVectorBase::SetSplashPoint ( float  x,
float  y 
)
inline

Definition at line 820 of file IControl.h.

◆ SetSplashRadius()

void IVectorBase::SetSplashRadius ( float  radius)
inline

Definition at line 819 of file IControl.h.

◆ SetStyle()

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

Set the Style of this IVControl.

Parameters
style

Reimplemented in IVMenuButtonControl, and IVNumberBoxControl.

Definition at line 825 of file IControl.h.

References OnStyleChanged(), and SetColors().

Referenced by IVectorBase(), IVTabbedPagesControl::OnStyleChanged(), IVMenuButtonControl::SetStyle(), IVNumberBoxControl::SetStyle(), and IGraphics::StyleAllVectorControls().

◆ SetValueStr()

void IVectorBase::SetValueStr ( const char *  value)
inline

Definition at line 808 of file IControl.h.

◆ SetWidgetFrac()

void IVectorBase::SetWidgetFrac ( float  frac)
inline

Definition at line 809 of file IControl.h.

Member Data Documentation

◆ mControl

IControl* IVectorBase::mControl = nullptr
protected

Definition at line 1255 of file IControl.h.

◆ mLabelBounds

IRECT IVectorBase::mLabelBounds
protected

Definition at line 1265 of file IControl.h.

◆ mLabelInWidget

bool IVectorBase::mLabelInWidget = false
protected

Definition at line 1257 of file IControl.h.

◆ mLabelStr

WDL_String IVectorBase::mLabelStr
protected

Definition at line 1267 of file IControl.h.

◆ mMaxSplashRadius

float IVectorBase::mMaxSplashRadius = 50.f
protected

Definition at line 1261 of file IControl.h.

◆ mShape

EVShape IVectorBase::mShape = EVShape::Rectangle
protected

Definition at line 1269 of file IControl.h.

◆ mSplashPoint

IVec2 IVectorBase::mSplashPoint = {0.f, 0.f}
protected

Definition at line 1260 of file IControl.h.

◆ mSplashRadius

float IVectorBase::mSplashRadius = 0.f
protected

Definition at line 1259 of file IControl.h.

◆ mStyle

IVStyle IVectorBase::mStyle
protected

Definition at line 1256 of file IControl.h.

◆ mTrackSize

float IVectorBase::mTrackSize = 2.f
protected

Definition at line 1262 of file IControl.h.

◆ mValueBounds

IRECT IVectorBase::mValueBounds
protected

Definition at line 1266 of file IControl.h.

◆ mValueDisplayFrac

float IVectorBase::mValueDisplayFrac = 0.66f
protected

Definition at line 1263 of file IControl.h.

◆ mValueInWidget

bool IVectorBase::mValueInWidget = false
protected

Definition at line 1258 of file IControl.h.

◆ mValueStr

WDL_String IVectorBase::mValueStr
protected

Definition at line 1268 of file IControl.h.

◆ mWidgetBounds

IRECT IVectorBase::mWidgetBounds
protected

Definition at line 1264 of file IControl.h.


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