13 #define WDL_NO_SUPPORT_UTF8 20 BEGIN_IGRAPHICS_NAMESPACE
25 pCaller->OnEndAnimation();
35 pCaller->OnEndAnimation();
39 pCaller->
As<
IVectorBase>()->SetSplashRadius((
float) progress);
62 pGraphics->ShowBubbleControl(pCaller, bounds.
R, bounds.
MH(), display.Get(), EDirection::Horizontal,
IRECT(0, 0, 50, 30));
72 pGraphics->ShowBubbleControl(pCaller, bounds.
MW(), bounds.
T, display.Get(), EDirection::Vertical,
IRECT(0, 0, 50, 30));
75 END_IGRAPHICS_NAMESPACE
78 using namespace iplug;
79 using namespace igraphics;
86 mVals[0].idx = paramIdx;
95 for (
auto& paramIdx : params) {
96 mVals.push_back({paramIdx, 0.});
102 , mTargetRECT(bounds)
109 assert(valIdx > kNoValIdx && valIdx <
NVals());
110 return mVals[valIdx].idx;
115 assert(valIdx > kNoValIdx && valIdx <
NVals());
116 mVals.at(valIdx).idx = paramIdx;
124 if(paramIdx > kNoParameter)
125 return mDelegate->
GetParam(paramIdx);
132 const int nVals =
NVals();
134 for (
int v = 0; v < nVals; v++)
136 if(mVals[v].idx == paramIdx)
147 assert(valIdx > kNoValIdx && valIdx <
NVals());
148 mVals[valIdx].value = value;
153 assert(valIdx > kNoValIdx && valIdx <
NVals());
154 return mVals[valIdx].value;
162 if (!
GetUI()->ControlIsCaptured(
this))
183 valIdx = (
NVals() == 1) ? 0 : valIdx;
185 auto paramDefault = [
this](
int v)
198 valIdx = (
NVals() == 1) ? 0 : valIdx;
207 auto paramUpdate = [
this](
int v)
223 void IControl::Animate()
226 mAnimationFunc(
this);
245 mBlend.mWeight = (disable ? GRAYED_ALPHA : 1.0f);
283 if (pSelectedMenu && valIdx > kNoValIdx &&
GetParamIdx(valIdx) > kNoParameter && !mDisablePrompt)
291 if (x < 0.f) x = 0.f;
292 if (y < 0.f) y = 0.f;
294 float tX = x + (mTargetRECT.
L - mRECT.
L);
295 float tY = y + (mTargetRECT.
T - mRECT.
T);
297 SetRECT({x, y, x + mRECT.
W(), y + mRECT.
H()});
303 if (w < 0.f) w = 0.f;
304 if (h < 0.f) h = 0.f;
311 mGestureFuncs.insert(std::make_pair(type, func));
320 auto itr = mGestureFuncs.find(info.type);
322 if(itr != mGestureFuncs.end())
324 mLastGesture = info.type;
325 itr->second(
this, info);
334 if (valIdx > kNoValIdx &&
GetParamIdx(valIdx) > kNoParameter && !mDisablePrompt)
336 if (
GetParam(valIdx)->NDisplayTexts())
342 float cX = mRECT.
MW();
343 float cY = mRECT.
MH();
344 float halfW = PARAM_EDIT_W/2.f;
345 float halfH = PARAM_EDIT_H/2.f;
347 IRECT txtRECT =
IRECT(cX - halfW, cY - halfH, cX + halfW,cY + halfH);
357 if (valIdx > kNoValIdx &&
GetParamIdx(valIdx) > kNoParameter && !mDisablePrompt)
368 mPTHighlightColor = COLOR_RED;
371 mPTHighlightColor = COLOR_BLUE;
374 mPTHighlightColor = COLOR_GREEN;
377 mPTHighlightColor = COLOR_YELLOW;
383 mPTisHighlighted = isHighlighted;
389 if (mPTisHighlighted)
391 g.
FillCircle(mPTHighlightColor, mRECT.
R-5, mRECT.
T+5, 2);
401 if(direction == EDirection::Vertical)
402 val = 1.f - (y-bounds.
T) / bounds.
H();
404 val = (x-bounds.
L) / bounds.
W();
406 auto valFunc = [&](
int valIdx) {
407 SetValue(
Clip(std::round(val / 0.001 ) * 0.001, minClip, maxClip), valIdx);
414 void IControl::OnEndAnimation()
416 mAnimationFunc =
nullptr;
419 if(mAnimationEndActionFunc)
420 mAnimationEndActionFunc(
this);
425 mAnimationStartTime = std::chrono::high_resolution_clock::now();
426 mAnimationDuration = Milliseconds(duration);
434 auto elapsed = Milliseconds(std::chrono::high_resolution_clock::now() - mAnimationStartTime);
435 return elapsed.count() / mAnimationDuration.count();
438 ITextControl::ITextControl(
const IRECT& bounds,
const char* str,
const IText& text,
const IColor& BGColor,
bool setBoundsBasedOnStr)
442 , mSetBoundsBasedOnStr(setBoundsBasedOnStr)
450 if(mSetBoundsBasedOnStr)
451 SetBoundsBasedOnStr();
456 if (strcmp(mStr.Get(), str))
460 if(mSetBoundsBasedOnStr)
461 SetBoundsBasedOnStr();
470 va_start(arglist, fmt);
471 mStr.SetAppendFormattedArgs(
false, maxlen, fmt, arglist);
479 g.
FillRect(mBGColor, mRECT, &mBlend);
482 g.
DrawText(mText, mStr.Get(), mRECT, &mBlend);
492 IURLControl::IURLControl(
const IRECT& bounds,
const char* str,
const char* urlStr,
const IText& text,
const IColor& BGColor,
const IColor& MOColor,
const IColor& CLColor)
495 , mOriginalColor(text.mFGColor)
499 mIgnoreMouse =
false;
504 g.
FillRect(mBGColor, mRECT, &mBlend);
507 mText.mFGColor = mMOColor;
509 mText.mFGColor = mClicked ? mCLColor : mOriginalColor;
511 if (mStr.GetLength())
516 float linePosY = 0.f;
517 float linePosL = 0.f;
518 float linePosR = 0.f;
520 if(mText.mVAlign == EVAlign::Middle)
521 linePosY = mRECT.
MH() + textDims.
B;
522 else if(mText.mVAlign == EVAlign::Bottom)
524 else if(mText.mVAlign == EVAlign::Top)
525 linePosY = mRECT.
T - textDims.
H();
527 if(mText.mAlign == EAlign::Center)
529 linePosL = mRECT.
MW() + textDims.
L;
530 linePosR = mRECT.
MW() + textDims.
R;
532 else if(mText.mAlign == EAlign::Near)
535 linePosR = mRECT.
L + textDims.
W();
537 else if(mText.mAlign == EAlign::Far)
539 linePosL = mRECT.
R - textDims.
W();
543 g.
DrawLine(mText.mFGColor, linePosL, linePosY, linePosR, linePosY, &mBlend);
544 g.
DrawText(mText, mStr.Get(), mRECT, &mBlend);
558 mOriginalColor = txt.mFGColor;
561 ITextToggleControl::ITextToggleControl(
const IRECT& bounds,
int paramIdx,
const char* offText,
const char* onText,
const IText& text,
const IColor& bgColor)
568 mIgnoreMouse =
false;
569 mDblAsSingleClick =
true;
572 ITextToggleControl::ITextToggleControl(
const IRECT& bounds, IActionFunction aF,
const char* offText,
const char* onText,
const IText& text,
const IColor& bgColor)
578 mDblAsSingleClick =
true;
579 mIgnoreMouse =
false;
595 SetStr(mOnText.Get());
597 SetStr(mOffText.Get());
605 , mShowParamLabel(showParamLabel)
608 mDblAsSingleClick =
true;
609 mDisablePrompt =
false;
610 mIgnoreMouse =
false;
647 if(pParam && pParam->
Type() == IParam::kTypeEnum)
653 PlaceHolder::PlaceHolder(
const IRECT& bounds,
const char* str)
656 mBGColor = COLOR_WHITE;
657 mDisablePrompt =
false;
658 mDblAsSingleClick =
false;
659 mIgnoreMouse =
false;
665 g.
DrawLine(COLOR_RED, mRECT.
L, mRECT.
T, mRECT.
R, mRECT.
B, &BLEND_50, 2.f);
666 g.
DrawLine(COLOR_RED, mRECT.
L, mRECT.
B, mRECT.
R, mRECT.
T, &BLEND_50, 2.f);
671 g.
DrawText(mHeightText, mHeightStr.Get(), mRECT.
L + mInset, mRECT.
MH());
676 g.
DrawText(mWidthText, mWidthStr.Get(), mRECT.
MW(), mRECT.
T + mInset);
681 g.
DrawText(mTLGCText, mTLHCStr.Get(), mRECT.
L + mInset, mRECT.
T + mInset);
683 if (mStr.GetLength())
690 mCentreLabelBounds = r;
696 mTLHCStr.SetFormatted(32,
"%0.1f, %0.1f", mRECT.
L, mRECT.
T);
697 mWidthStr.SetFormatted(32,
"%0.1f", mRECT.
W());
698 mHeightStr.SetFormatted(32,
"%0.1f", mRECT.
H());
701 IButtonControlBase::IButtonControlBase(
const IRECT& bounds, IActionFunction aF)
702 :
IControl(bounds, kNoParameter, aF)
704 mDblAsSingleClick =
true;
713 void IButtonControlBase::OnEndAnimation()
716 IControl::OnEndAnimation();
719 ISwitchControlBase::ISwitchControlBase(
const IRECT& bounds,
int paramIdx, IActionFunction aF,
int numStates)
721 , mNumStates(numStates)
723 mDisabledState.Resize(numStates);
724 SetAllStatesDisabled(
false);
725 mDblAsSingleClick =
true;
728 void ISwitchControlBase::SetAllStatesDisabled(
bool disabled)
730 for(
int i=0; i<mNumStates; i++)
732 SetStateDisabled(i, disabled);
737 void ISwitchControlBase::SetStateDisabled(
int stateIdx,
bool disabled)
739 if(stateIdx >= 0 && stateIdx < mNumStates && mDisabledState.GetSize())
740 mDisabledState.Get()[stateIdx] = disabled;
745 bool ISwitchControlBase::GetStateDisabled(
int stateIdx)
const 747 if(stateIdx >= 0 && stateIdx < mNumStates && mDisabledState.GetSize())
748 return mDisabledState.Get()[stateIdx];
757 assert(mNumStates > 1);
766 const double step = 1. / (double(mNumStates) - 1.);
784 bool IKnobControlBase::IsFineControl(
const IMouseMod& mod,
bool wheel)
const 790 return wheel ? mod.C : mod.R;
793 return (mod.C || mod.S);
802 if (mHideCursorOnDrag)
810 if (mHideCursorOnDrag)
819 double gearing = IsFineControl(mod,
false) ? mGearing * 10.0 : mGearing;
821 IRECT dragBounds = GetKnobDragBounds();
823 if (mDirection == EDirection::Vertical)
824 mMouseDragValue +=
static_cast<double>(dY /
static_cast<double>(dragBounds.
T - dragBounds.
B) / gearing);
826 mMouseDragValue +=
static_cast<double>(dX /
static_cast<double>(dragBounds.
R - dragBounds.
L) / gearing);
828 mMouseDragValue =
Clip(mMouseDragValue, 0., 1.);
830 double v = mMouseDragValue;
842 double gearing = IsFineControl(mod,
true) ? 0.001 : 0.01;
844 double v =
GetValue() + gearing * d;
851 const double step = pParam->
GetStep();
854 v += d > 0 ? step : -step;
863 ISliderControlBase::ISliderControlBase(
const IRECT& bounds,
int paramIdx, EDirection dir,
double gearing,
float handleSize)
866 , mHandleSize(handleSize)
871 ISliderControlBase::ISliderControlBase(
const IRECT& bounds, IActionFunction aF, EDirection dir,
double gearing,
float handleSize)
874 , mHandleSize(handleSize)
882 mTrackBounds = mRECT;
900 if (mHideCursorOnDrag)
908 if (mHideCursorOnDrag)
919 if(mod.touchID || !mHideCursorOnDrag)
937 double gearing = IsFineControl(mod,
false) ? mGearing * 10.0 : mGearing;
939 if (mDirection == EDirection::Vertical)
940 mMouseDragValue +=
static_cast<double>(dY /
static_cast<double>(mTrackBounds.T - mTrackBounds.B) / gearing);
942 mMouseDragValue +=
static_cast<double>(dX /
static_cast<double>(mTrackBounds.R - mTrackBounds.L) / gearing);
944 mMouseDragValue =
Clip(mMouseDragValue, 0., 1.);
946 double v = mMouseDragValue;
957 double gearing = IsFineControl(mod,
true) ? 0.001 : 0.01;
959 double v =
GetValue() + gearing * d;
966 const double step = pParam->
GetStep();
969 v += d > 0 ? step : -step;
978 bool ISliderControlBase::IsFineControl(
const IMouseMod& mod,
bool wheel)
const 984 return wheel ? mod.C : mod.R;
987 return (mod.C || mod.S);
992 IDirBrowseControlBase::~IDirBrowseControlBase()
996 mPathLabels.Empty(
true);
1000 int IDirBrowseControlBase::NItems()
1002 return mItems.GetSize();
1005 void IDirBrowseControlBase::AddPath(
const char* path,
const char* label)
1007 assert(strlen(path));
1009 mPaths.Add(
new WDL_String(path));
1010 mPathLabels.Add(
new WDL_String(label));
1013 void IDirBrowseControlBase::CollectSortedItems(
IPopupMenu* pMenu)
1015 int nItems = pMenu->NItems();
1017 for (
int i = 0; i < nItems; i++)
1021 if(pItem->GetSubmenu())
1022 CollectSortedItems(pItem->GetSubmenu());
1028 void IDirBrowseControlBase::SetupMenu()
1031 mItems.Empty(
false);
1034 mSelectedIndex = -1;
1038 if (mPaths.GetSize() == 1)
1040 ScanDirectory(mPaths.Get(0)->Get(), mMainMenu);
1044 for (
int p = 0; p<mPaths.GetSize(); p++)
1047 mMainMenu.AddItem(mPathLabels.Get(p)->Get(), idx++, pNewMenu);
1048 ScanDirectory(mPaths.Get(p)->Get(), *pNewMenu);
1052 CollectSortedItems(&mMainMenu);
1078 void IDirBrowseControlBase::ScanDirectory(
const char* path,
IPopupMenu& menuToAddTo)
1086 const char* f = d.GetCurrentFN();
1087 if (f && f[0] !=
'.')
1089 if (d.GetCurrentIsDirectory())
1092 d.GetCurrentFullFN(&subdir);
1094 menuToAddTo.AddItem(d.GetCurrentFN(), pNewMenu, -2);
1095 ScanDirectory(subdir.Get(), *pNewMenu);
1099 const char* a = strstr(f, mExtension.Get());
1100 if (a && a > f && strlen(a) == strlen(mExtension.Get()))
1102 WDL_String menuEntry {f};
1104 if(!mShowFileExtensions)
1105 menuEntry.Set(f, (
int) (a - f) - 1);
1108 menuToAddTo.AddItem(pItem, -2 );
1109 WDL_String* pFullPath =
new WDL_String(
"");
1110 d.GetCurrentFullFN(pFullPath);
1111 mFiles.Add(pFullPath);
1115 }
while (!d.Next());
1118 if(!mShowEmptySubmenus)
1119 menuToAddTo.RemoveEmptySubmenus();
The lowest level base class of an IGraphics control.
void SetPTParameterHighlight(bool isHighlighted, int color)
Used internally by the AAX wrapper view interface to set the control parmeter highlight.
Used to manage a rectangular area, independent of draw class/platform.
virtual void SetValueFromUserInput(double value, int valIdx=0)
Set the control's value after user input.
IGEditorDelegate * GetDelegate()
Gets a pointer to the class implementing the IEditorDelegate interface that handles parameter changes...
virtual void OnMouseDown(float x, float y, const IMouseMod &mod)
Implement this method to respond to a mouse down event on this control.
int LinkedToParam(int paramIdx) const
Check if the control is linked to a particular parameter.
A basic control to display some text.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
void ReleaseMouseCapture()
Used to tell the graphics context to stop tracking mouse interaction with a control.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
Used to manage mouse modifiers i.e.
bool mMouseIsOver
if mGraphics::mHandleMouseOver = true, this will be true when the mouse is over control.
void OnMouseDrag(float x, float y, float dX, float dY, const IMouseMod &mod) override
Implement this method to respond to a mouse drag event on this control.
virtual void Hide(bool hide)
Shows or hides the IControl.
IRECT FracRectHorizontal(float frac, bool rhs=false) const
Returns a new IRECT with a width that is multiplied by frac.
virtual void FillCircle(const IColor &color, float cx, float cy, float r, const IBlend *pBlend=0)
Fill a circle with a color.
const IParam * GetParam(int valIdx=0) const
Get a const pointer to the IParam object (owned by the editor delegate class), associated with this c...
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
void EmptyClickActionFunc(IControl *pCaller)
A click action function that does nothing.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
IPlug's parameter class.
virtual void SetValueFromDelegate(double value, int valIdx=0)
Set the control's value from the delegate This method is called from the class implementing the IEdit...
virtual void SetValueToDefault(int valIdx=kNoValIdx)
Set one or all of the control's values to the default value of the associated parameter.
IControl * SetActionFunction(IActionFunction actionFunc)
Set an Action Function for this control.
virtual void SendParameterValueFromUI(int paramIdx, double normalizedValue)
SPVFUI Called by the UI during a parameter change gesture, in order to notify the host of the new val...
Used to manage color data, independent of draw class/platform.
IRECT GetTranslated(float x, float y) const
Get a translated copy of this rectangle.
double ConstrainNormalized(double normalizedValue) const
Constrains a normalised input value similarly to Constrain()
Used to describe a particular gesture.
IPlug's parameter class.
void DefaultClickActionFunc(IControl *pCaller)
A click action function that triggers the default animation function for DEFAULT_ANIMATION_DURATION.
void DrawText(const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend=0)
Draw some text to the graphics context in a specific rectangle.
virtual void AttachGestureRecognizer(EGestureType type)
Registers a gesture recognizer with the graphics context.
void OnMouseWheel(float x, float y, const IMouseMod &mod, float d) override
Implement this method to respond to a mouse wheel event on this control.
double GetRange() const
Returns the parameter's range.
int GetParamIdx(int valIdx=0) const
Get the index of a parameter that the control is linked to Normaly controls are either linked to a si...
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
This file contains the base IControl implementation, along with some base classes for specific types ...
virtual int GetValIdxForPos(float x, float y) const
Check to see which of the control's values relates to this x and y coordinate.
float R
Right side of the rectangle (X + W)
void Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnInit() override
Called just prior to when the control is attached, after its delegate and graphics member variable se...
void SetRECT(const IRECT &bounds)
Set the rectangular draw area for this control, within the graphics context.
IControl * GetControlInTextEntry()
double GetAnimationProgress() const
Get the progress in a control's animation, in the range 0-1.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
double FromNormalized(double normalizedValue) const
Convert a normalized value to real value for this parameter.
void ShowBubbleHorizontalActionFunc(IControl *pCaller)
Use with a param-linked control to popup the bubble control horizontally.
const IRECT & GetRECT() const
Get the rectangular draw area for this control, within the graphics context.
void ForValIdx(int valIdx, T func, Args...args)
A helper template function to call a method for an individual value, or for all values.
void ShowBubbleVerticalActionFunc(IControl *pCaller)
Use with a param-linked control to popup the bubble control vertically.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
IText is used to manage font and text/text entry style for a piece of text on the UI...
virtual void OnPopupMenuSelection(IPopupMenu *pSelectedMenu, int valIdx)
Implement this method to handle popup menu selection after IGraphics::CreatePopupMenu/IControl::Promp...
virtual bool IsDirty()
Called at each display refresh by the IGraphics draw loop, after IControl::Animate(), to determine if the control is marked as dirty.
IControl(const IRECT &bounds, int paramIdx=kNoParameter, IActionFunction actionFunc=nullptr)
Constructor.
bool GetMouseIsOver() const
This can be used in IControl::Draw() to check if the mouse is over the control, without implementing ...
void OnMouseWheel(float x, float y, const IMouseMod &mod, float d) override
Implement this method to respond to a mouse wheel event on this control.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
virtual void SetStr(const char *str)
Set the text to display.
void GetMouseDownPoint(float &x, float &y) const
Get the x, y position of the last mouse down message.
double GetDefault(bool normalized=false) const
Returns the parameter's default value.
The lowest level base class of an IGraphics context.
void SetAnimation(IAnimationFunction func)
Set the animation function.
virtual void OnMouseOver(float x, float y, const IMouseMod &mod)
Implement this method to respond to a mouseover event on this control.
void OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
void PromptUserInput(IControl &control, const IRECT &bounds, int valIdx=0)
Prompt for user input either using a text entry or pop up menu.
void GetDisplay(WDL_String &display, bool withDisplayText=true) const
Get the current textual display for the current parameter value.
const char * GetLabel() const
Returns the parameter's label.
void OnInit() override
Called just prior to when the control is attached, after its delegate and graphics member variable se...
void UpdatePeers(IControl *pCaller, int callerValIdx)
This method is called after interacting with a control, so that any other controls linked to the same...
void PromptUserInput(int valIdx=0)
Call this method in response to a mouse event to create an edit box so the user can enter a value...
virtual void SnapToMouse(float x, float y, EDirection direction, const IRECT &bounds, int valIdx=-1, double minClip=0., double maxClip=1.)
Set control value based on x, y position within a rectangle.
virtual void FillRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0)
Fill a rectangular region of the graphics context with a color.
void SetBoundsBasedOnStr()
Measures the bounds of the text that the control displays and compacts/expands the controls bounds to...
BEGIN_IPLUG_NAMESPACE T Clip(T x, T lo, T hi)
Clips the value x between lo and hi.
BEGIN_IPLUG_NAMESPACE BEGIN_IGRAPHICS_NAMESPACE void DefaultAnimationFunc(IControl *pCaller)
An animation function that just calls the caller control's OnEndAnimation() method at the end of the ...
void Constrain(float &x, float &y) const
Ensure the point (x,y) is inside this IRECT.
void SetTargetAndDrawRECTs(const IRECT &bounds)
Set BOTH the draw rect and the target area, within the graphics context for this control.
void SplashAnimationFunc(IControl *pCaller)
The splash animation function is used by IVControls to animate the splash.
IAnimationFunction GetAnimationFunction()
Get the control's animation function, if it exists.
virtual void HideMouseCursor(bool hide=true, bool lock=true)=0
Call to hide/show the mouse cursor.
void SplashClickActionFunc(IControl *pCaller)
The splash click action function is used by IVControls to start SplashAnimationFunc.
virtual void DrawPTHighlight(IGraphics &g)
Implement this to customise how a colored highlight is drawn on the control in ProTools (AAX format o...
double ToNormalized(double nonNormalizedValue) const
Convert a real value to normalized value for this parameter.
T * As()
Helper function to dynamic cast an IControl to a subclass.
virtual bool OnGesture(const IGestureInfo &info)
double GetValue(int valIdx=0) const
Get the control's value.
IControl * AttachGestureRecognizer(EGestureType type, IGestureFunc func)
Add a IGestureFunc that should be triggered in response to a certain type of gesture.
EParamType Type() const
Get the parameter's type.
void SetTargetRECT(const IRECT &bounds)
Set the rectangular mouse tracking target area, within the graphics context for this control...
void SetText(const IText &) override
Set the Text object typically used to determine font/layout/size etc of the main text in a control...
float L
Left side of the rectangle (X)
void OnMouseDrag(float x, float y, float dX, float dY, const IMouseMod &mod) override
Implement this method to respond to a mouse drag event on this control.
void GetDisplayWithLabel(WDL_String &display, bool withDisplayText=true) const
Fills the WDL_String the value of the parameter along with the label, e.g.
virtual void SetParamIdx(int paramIdx, int valIdx=0)
Set the index of a parameter that the control is linked to If you are calling this "manually" to reus...
virtual void SetPosition(float x, float y)
Set the position of the control, preserving the width and height.
IRECT GetCentredInside(const IRECT &sr) const
Get a rectangle the size of sr but with the same center point as this rectangle.
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 OnMouseDblClick(float x, float y, const IMouseMod &mod)
Implement this method to respond to a mouse double click event on this control.
virtual void SetStrFmt(int maxlen, const char *fmt,...)
Set the text to display, using a printf-like format string.
void SetDirty(bool push, int valIdx=0) override
Mark the control as dirty, i.e.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
virtual void SetValue(double value, int valIdx=0)
Set one of the control's values.
ICaptionControl(const IRECT &bounds, int paramIdx, const IText &text=DEFAULT_TEXT, const IColor &BGColor=DEFAULT_BGCOLOR, bool showParamLabel=true)
Creates an ICaptionControl.
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 Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
virtual bool OpenURL(const char *url, const char *msgWindowTitle=0, const char *confirmMsg=0, const char *errMsgOnFailure=0)=0
Open a URL in the platform’s default browser.
virtual void DrawLine(const IColor &color, float x1, float y1, float x2, float y2, const IBlend *pBlend=0, float thickness=1.f)
Draw a line to the graphics context.
void StartAnimation(int duration)
double GetStep() const
Returns the parameter's step size.
virtual void SetSize(float w, float h)
Set the size of the control, preserving the current position.
float T
Top of the rectangle (Y)
IParam * GetParam(int paramIdx)
Get a pointer to one of the delegate's IParam objects.
virtual void FillTriangle(const IColor &color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend *pBlend=0)
Fill a triangle with a color.
virtual float MeasureText(const IText &text, const char *str, IRECT &bounds) const
Measure the rectangular region that some text will occupy.
virtual void SetDirty(bool triggerAction=true, int valIdx=kNoValIdx)
Mark the control as dirty, i.e.
virtual void SetDisabled(bool disable)
Sets disabled mode for the control, the default implementation modifies the mBlend member...
float B
Bottom of the rectangle (Y + H)
virtual void OnMouseOut()
Implement this method to respond to a mouseout event on this control.