31 BEGIN_IGRAPHICS_NAMESPACE
38 #pragma mark - Vector Controls 45 IVLabelControl(
const IRECT& bounds,
const char* label,
const IVStyle& style = DEFAULT_STYLE.WithDrawFrame(
false).WithColor(kSH, COLOR_BLACK).WithShadowOffset(1).WithValueText(DEFAULT_VALUE_TEXT.WithSize(20.f).WithFGColor(COLOR_WHITE)));
66 bool IsHit(
float x,
float y)
const override;
75 IVSwitchControl(
const IRECT& bounds,
int paramIdx = kNoParameter,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE,
bool valueInButton =
true);
82 bool IsHit(
float x,
float y)
const override;
83 void SetDirty(
bool push,
int valIdx = kNoValIdx)
override;
92 IVToggleControl(
const IRECT& bounds,
int paramIdx = kNoParameter,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE,
const char* offText =
"OFF",
const char* onText =
"ON");
107 IVSlideSwitchControl(
const IRECT& bounds,
int paramIdx = kNoParameter,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE,
bool valueInButton =
false, EDirection direction = EDirection::Horizontal);
109 IVSlideSwitchControl(
const IRECT& bounds, IActionFunction aF =
EmptyClickActionFunc,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE,
bool valueInButton =
false, EDirection direction = EDirection::Horizontal,
int numStates = 2,
int initialState = 0);
116 void OnEndAnimation()
override;
117 void SetDirty(
bool push,
int valIdx = kNoValIdx)
override;
121 IRECT mStartRect, mEndRect;
123 EDirection mDirection;
131 enum class ETabSegment { Start, Mid, End };
141 IVTabSwitchControl(
const IRECT& bounds,
int paramIdx = kNoParameter,
const std::initializer_list<const char*>& options = {},
const char* label =
"",
const IVStyle & style = DEFAULT_STYLE, EVShape shape = EVShape::Rectangle, EDirection direction = EDirection::Horizontal);
151 IVTabSwitchControl(
const IRECT& bounds, IActionFunction aF,
const std::initializer_list<const char*>& options,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE, EVShape shape = EVShape::Rectangle, EDirection direction = EDirection::Horizontal);
153 virtual ~IVTabSwitchControl() { mTabLabels.Empty(
true); }
158 virtual void DrawButton(
IGraphics& g,
const IRECT& bounds,
bool pressed,
bool mouseOver, ETabSegment segment,
bool disabled);
163 virtual bool IsHit(
float x,
float y)
const override;
166 const char* GetSelectedLabelStr()
const;
170 virtual int GetButtonForPoint(
float x,
float y)
const;
172 int mMouseOverButton = -1;
173 WDL_TypedBuf<IRECT> mButtons;
174 WDL_PtrList<WDL_String> mTabLabels;
175 EDirection mDirection;
190 IVRadioButtonControl(
const IRECT& bounds,
int paramIdx = kNoParameter,
const std::initializer_list<const char*>& options = {},
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE, EVShape shape = EVShape::Ellipse, EDirection direction = EDirection::Vertical,
float buttonSize = 10.f);
201 IVRadioButtonControl(
const IRECT& bounds, IActionFunction aF,
const std::initializer_list<const char*>& options,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE, EVShape shape = EVShape::Ellipse, EDirection direction = EDirection::Vertical,
float buttonSize = 10.f);
206 int GetButtonForPoint(
float x,
float y)
const override;
209 float mButtonAreaWidth;
210 bool mOnlyButtonsRespondToMouse =
false;
219 const char* label =
"",
220 const IVStyle& style = DEFAULT_STYLE,
221 bool valueIsEditable =
false,
bool valueInWidget =
false,
222 float a1 = -135.f,
float a2 = 135.f,
float aAnchor = -135.f,
223 EDirection direction = EDirection::Vertical,
double gearing = DEFAULT_GEARING,
float trackSize = 2.f);
226 const char* label =
"",
227 const IVStyle& style = DEFAULT_STYLE,
228 bool valueIsEditable =
false,
bool valueInWidget =
false,
229 float a1 = -135.f,
float a2 = 135.f,
float aAnchor = -135.f,
230 EDirection direction = EDirection::Vertical,
double gearing = DEFAULT_GEARING,
float trackSize = 2.f);
236 virtual void DrawIndicatorTrack(
IGraphics& g,
float angle,
float cx,
float cy,
float radius);
237 virtual void DrawPointer(
IGraphics& g,
float angle,
float cx,
float cy,
float radius);
246 bool IsHit(
float x,
float y)
const override;
247 void SetDirty(
bool push,
int valIdx = kNoValIdx)
override;
250 void SetInnerPointerFrac(
float frac) { mInnerPointerFrac = frac; }
251 void SetOuterPointerFrac(
float frac) { mOuterPointerFrac = frac; }
252 void SetPointerThickness(
float thickness) { mPointerThickness = thickness; }
255 virtual IRECT GetKnobDragBounds()
override;
257 float mTrackToHandleDistance = 4.f;
258 float mInnerPointerFrac = 0.1f;
259 float mOuterPointerFrac = 1.f;
260 float mPointerThickness = 2.5f;
261 float mAngle1, mAngle2;
263 bool mValueMouseOver =
false;
271 IVSliderControl(
const IRECT& bounds,
int paramIdx = kNoParameter,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE,
bool valueIsEditable =
false, EDirection dir = EDirection::Vertical,
double gearing = DEFAULT_GEARING,
float handleSize = 8.f,
float trackSize = 2.f,
bool handleInsideTrack =
false);
273 IVSliderControl(
const IRECT& bounds, IActionFunction aF,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE,
bool valueIsEditable =
false, EDirection dir = EDirection::Vertical,
double gearing = DEFAULT_GEARING,
float handleSize = 8.f,
float trackSize = 2.f,
bool handleInsideTrack =
false);
286 bool IsHit(
float x,
float y)
const override;
288 void SetDirty(
bool push,
int valIdx = kNoValIdx)
override;
292 bool mHandleInsideTrack =
false;
293 bool mValueMouseOver =
false;
300 IVRangeSliderControl(
const IRECT& bounds,
const std::initializer_list<int>& params,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE, EDirection dir = EDirection::Vertical,
bool onlyHandle =
false,
float handleSize = 8.f,
float trackSize = 2.f);
312 void MakeTrackRects(
const IRECT& bounds)
override;
313 IRECT GetHandleBounds(
int trackIdx);
315 int mMouseOverHandle = -1;
317 bool mMouseIsDown =
false;
325 IVXYPadControl(
const IRECT& bounds,
const std::initializer_list<int>& params,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE,
float handleRadius = 10.f);
329 virtual void DrawHandle(
IGraphics& g,
const IRECT& trackBounds,
const IRECT& handleBounds);
337 bool mMouseDown =
false;
338 bool mTrackClipsHandle =
true;
367 IVPlotControl(
const IRECT& bounds,
const std::initializer_list<Plot>& funcs,
int numPoints,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE,
float min = -1.,
float max = 1.,
bool useLayer =
false);
379 std::vector<Plot> mPlots;
382 bool mUseLayer =
true;
383 int mHorizontalDivisions = 10;
384 int mVerticalDivisions = 10;
386 std::vector<float> mPoints;
396 IVGroupControl(
const char* label,
const char* groupName,
float padL = 0.f,
float padT = 0.f,
float padR = 0.f,
float padB = 0.f,
const IVStyle& style = DEFAULT_STYLE);
403 void SetBoundsBasedOnGroup(
const char* groupName,
float padL,
float padT,
float padR,
float padB);
405 WDL_String mGroupName;
410 float mLabelOffset = 10.f;
411 float mLabelPadding = 10.f;
419 IVPanelControl(
const IRECT& bounds,
const char* label =
"",
const IVStyle& style = DEFAULT_STYLE.WithColor(kFG, COLOR_TRANSLUCENT).WithEmboss(
true))
451 enum class ECellLayout { kGrid, kHorizontal, kVertical };
453 using ColorChosenFunc = std::function<void(int, IColor)>;
455 IVColorSwatchControl(
const IRECT& bounds,
const char* label =
"", ColorChosenFunc func =
nullptr,
const IVStyle& spec = DEFAULT_STYLE, ECellLayout layout = ECellLayout::kGrid,
456 const std::initializer_list<EVColor>& colorIDs = { kBG, kFG, kPR, kFR, kHL, kSH, kX1, kX2, kX3 },
457 const std::initializer_list<const char*>& labelsForIDs = { kVColorStrs[kBG],kVColorStrs[kFG],kVColorStrs[kPR],kVColorStrs[kFR],kVColorStrs[kHL],kVColorStrs[kSH],kVColorStrs[kX1],kVColorStrs[kX2],kVColorStrs[kX3] });
470 ColorChosenFunc mColorChosenFunc =
nullptr;
472 ECellLayout mLayout = ECellLayout::kVertical;
473 WDL_TypedBuf<IRECT> mCellRects;
474 WDL_PtrList<WDL_String> mLabels;
475 std::vector<EVColor> mColorIdForCells;
478 #pragma mark - SVG Vector Controls 487 void SetSVG(
ISVG& svg);
491 float mStartAngle = -135.f;
492 float mEndAngle = 135.f;
521 ISVGSwitchControl(
const IRECT& bounds,
const std::initializer_list<ISVG>& svgs,
int paramIdx = kNoParameter, IActionFunction aF =
nullptr);
526 std::vector<ISVG> mSVGs;
540 ISVGSliderControl(
const IRECT& bounds,
const ISVG& handleSvg,
const ISVG& trackSVG,
int paramIdx = kNoParameter, EDirection dir = EDirection::Vertical,
double gearing = DEFAULT_GEARING);
546 IRECT GetHandleBounds(
double value = -1.0)
const;
548 IRECT mTrackSVGBounds;
549 IRECT mHandleBoundsAtMax;
554 #pragma mark - Bitmap Controls 598 IBKnobControl(
float x,
float y,
const IBitmap& bitmap,
int paramIdx, EDirection direction = EDirection::Vertical,
double gearing = DEFAULT_GEARING)
602 IBKnobControl(
const IRECT& bounds,
const IBitmap& bitmap,
int paramIdx, EDirection direction = EDirection::Vertical,
double gearing = DEFAULT_GEARING)
630 IBSliderControl(
float x,
float y,
float trackLength,
const IBitmap& handleBitmap,
const IBitmap& trackBitmap =
IBitmap(),
int paramIdx = kNoParameter, EDirection dir = EDirection::Vertical,
double gearing = DEFAULT_GEARING);
632 IBSliderControl(
const IRECT& bounds,
const IBitmap& handleBitmap,
const IBitmap& trackBitmap =
IBitmap(),
int paramIdx = kNoParameter, EDirection dir = EDirection::Vertical,
double gearing = DEFAULT_GEARING);
640 IRECT GetHandleBounds(
double value = -1.0)
const;
651 IBTextControl(
const IRECT& bounds,
const IBitmap& bitmap,
const IText& text = DEFAULT_TEXT,
const char* str =
"",
int charWidth = 6,
int charHeight = 12,
int charOffset = 0,
bool multiLine =
false,
bool vCenter =
true, EBlend blend = EBlend::Default);
658 int mCharWidth, mCharHeight, mCharOffset;
663 END_IGRAPHICS_NAMESPACE
std::function< double(double)> IPlotFunc
IVPlotControl passes values between 0 and 1 to this object, that are the plot normalized x values...
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.
A control to display some text in the UI, driven by values in the RT audio thread.
void OnMouseOut() override
Implement this method to respond to a mouseout event on this control.
Vectorial multi-channel capable oscilloscope control.
The lowest level base class of an IGraphics control.
Used to manage a rectangular area, independent of draw class/platform.
void OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
virtual void OnResize()
Called when IControl is constructed or resized using SetRect().
A "meta control" for a "preset manager" for disk-based preset files It adds several child buttons...
virtual void OnMouseDown(float x, float y, const IMouseMod &mod)
Implement this method to respond to a mouse down event on this control.
virtual void DrawValue(IGraphics &g, bool mouseOver)
Draw the IVControl value text.
A "meta control" for a number box with an Inc/Dec button It adds several child buttons.
A control to show a color swatch of up to 9 colors.
A basic control to display some text.
virtual void DrawBackground(IGraphics &g, const IRECT &rect)
Draw the IVControl background (usually transparent)
User-facing bitmap abstraction that you use to manage bitmap data, independant of draw class/platform...
void OnMouseOut() override
Implement this method to respond to a mouseout event on this control.
Used to manage mouse modifiers i.e.
A base class for switch controls.
bool mMouseIsOver
if mGraphics::mHandleMouseOver = true, this will be true when the mouse is over control.
A panel control which can be styled with emboss etc.
void EmptyClickActionFunc(IControl *pCaller)
A click action function that does nothing.
A vector "tab" multi switch control.
A Slider control with and SVG for track and handle.
Used to manage color data, independent of draw class/platform.
A control for choosing a color.
A base interface to be combined with IControl for bitmap-based controls "IBControls", managing an IBitmap.
A vector XY Pad slider control.
void DefaultClickActionFunc(IControl *pCaller)
A click action function that triggers the default animation function for DEFAULT_ANIMATION_DURATION.
virtual void OnMouseDrag(float x, float y, float dX, float dY, const IMouseMod &mod)
Implement this method to respond to a mouse drag event on this control.
A vector switch control which shows one of multiple SVG states.
A control to display text using a monospace bitmap font.
User-facing SVG abstraction that you use to manage SVG data ISVG doesn't actually own the image data...
void AttachIControl(IControl *pControl, const char *label)
Call in the constructor of your IVControl to link the IVectorBase and IControl.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
This file contains the base IControl implementation, along with some base classes for specific types ...
virtual bool IsHit(float x, float y) const
Hit test the control.
virtual void OnMouseUp(float x, float y, const IMouseMod &mod)
Implement this method to respond to a mouse up event on this control.
Vectorial multi-channel capable meter control.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
A base class for mult-strip/track controls, such as multi-sliders, meters Track refers to the channel...
IRECT MakeRects(const IRECT &parent, bool hasHandle=false)
Calculate the rectangles for the various areas, depending on the style.
A vectorial multi-slider control.
A control to display a rolling graphics of historical values.
IText is used to manage font and text/text entry style for a piece of text on the UI...
A vector knob/dial control which rotates an SVG image.
A vector label control that can display text with a shadow.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
IControl(const IRECT &bounds, int paramIdx=kNoParameter, IActionFunction actionFunc=nullptr)
Constructor.
IBitmap GetScaledBitmap(IBitmap &inBitmap)
Get a version of the input bitmap from the cache that corresponds to the current screen scale For exa...
void OnRescale() override
Implement to do something when graphics is scaled globally (e.g.
A switch with a slide animation when clicked.
void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
The lowest level base class of an IGraphics context.
IVectorBase(const IVStyle &style, bool labelInWidget=false, bool valueInWidget=false)
IVectorBase Constructor.
Groups a plot function and color.
virtual void OnMouseOver(float x, float y, const IMouseMod &mod)
Implement this method to respond to a mouseover event on this control.
virtual void DrawLabel(IGraphics &g)
Draw the IVControl label text.
void OnInit() override
Called just prior to when the control is attached, after its delegate and graphics member variable se...
void OnMouseOut() override
Implement this method to respond to a mouseout event on this control.
A vector plot to display functions and waveforms.
A base class for knob/dial controls, to handle mouse action and Sender.
A bitmap knob/dial control that rotates an image.
void SplashClickActionFunc(IControl *pCaller)
The splash click action function is used by IVControls to start SplashAnimationFunc.
A base class for slider/fader controls, to handle mouse action and Sender.
void SetTargetRECT(const IRECT &bounds)
Set the rectangular mouse tracking target area, within the graphics context for this control...
void OnMouseOut() override
Implement this method to respond to a mouseout event on this control.
A bitmap knob/dial control that draws a frame from a stacked bitmap.
virtual void DrawWidget(IGraphics &g)
Draw the IVControl main widget (override)
IRECT GetCentredInside(const IRECT &sr) const
Get a rectangle the size of sr but with the same center point as this rectangle.
virtual void OnMouseDblClick(float x, float y, const IMouseMod &mod)
Implement this method to respond to a mouse double click event on this control.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnMouseOut() override
Implement this method to respond to a mouseout event on this control.
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!
void OnRescale() override
Implement to do something when graphics is scaled globally (e.g.
void OnMouseOut() override
Implement this method to respond to a mouseout event on this control.
void OnRescale() override
Implement to do something when graphics is scaled globally (e.g.
A bitmap slider/fader control.
std::unique_ptr< ILayer > ILayerPtr
ILayerPtr is a managed pointer for transferring the ownership of layers.
Vectorial keyboard control.
void OnRescale() override
Implement to do something when graphics is scaled globally (e.g.
A vector range slider control, with two handles.
A control to draw a rectangle around a named IControl group.
A struct encapsulating a set of properties used to configure IVControls.
virtual void SetDirty(bool triggerAction=true, int valIdx=kNoValIdx)
Mark the control as dirty, i.e.
A vector knob control drawn using graphics primitives.
virtual void OnMouseOut()
Implement this method to respond to a mouseout event on this control.
void Draw(IGraphics &g) override
Draw the control to the graphics context.