19 using namespace iplug;
20 using namespace igraphics;
22 #pragma mark - VECTOR CONTROLS 24 const IColor IVKeyboardControl::DEFAULT_BK_COLOR =
IColor(255, 70, 70, 70);
25 const IColor IVKeyboardControl::DEFAULT_WK_COLOR =
IColor(255, 240, 240, 240);
26 const IColor IVKeyboardControl::DEFAULT_PK_COLOR =
IColor(60, 0, 0, 0);
27 const IColor IVKeyboardControl::DEFAULT_FR_COLOR = COLOR_BLACK;
28 const IColor IVKeyboardControl::DEFAULT_HK_COLOR = COLOR_ORANGE;
30 IVLabelControl::IVLabelControl(
const IRECT& bounds,
const char* label,
const IVStyle& style)
34 mText = style.valueText;
35 AttachIControl(
this, label);
40 DrawBackground(g, mRECT);
45 g.
DrawText(mStyle.valueText.WithFGColor(GetColor(kSH)), mStr.Get(), mRECT.
GetTranslated(mStyle.shadowOffset, mStyle.shadowOffset), &mBlend);
47 g.
DrawText(mStyle.valueText, mStr.Get(), mRECT, &mBlend);
51 g.
DrawRect(GetColor(kFR), mRECT, &mBlend, mStyle.frameThickness);
58 mText = style.valueText;
88 IVSwitchControl::IVSwitchControl(
const IRECT& bounds,
int paramIdx,
const char* label,
const IVStyle& style,
bool valueInButton)
93 mText = style.valueText;
96 mText.mVAlign = mStyle.valueText.mVAlign = EVAlign::Middle;
99 IVSwitchControl::IVSwitchControl(
const IRECT& bounds, IActionFunction aF,
const char* label,
const IVStyle& style,
int numStates,
bool valueInButton)
104 mText = style.valueText;
107 mText.mVAlign = mStyle.valueText.mVAlign = EVAlign::Middle;
141 return mWidgetBounds.
Contains(x, y);
154 if(!mLabelStr.GetLength())
155 mLabelStr.Set(pParam->
GetName());
159 IVToggleControl::IVToggleControl(
const IRECT& bounds,
int paramIdx,
const char* label,
const IVStyle& style,
const char* offText,
const char* onText)
167 IVToggleControl::IVToggleControl(
const IRECT& bounds, IActionFunction aF,
const char* label,
const IVStyle& style,
const char* offText,
const char* onText,
bool initialState)
186 g.
DrawText(mStyle.valueText, mOnText.Get(), mValueBounds, &mBlend);
188 g.
DrawText(mStyle.valueText, mOffText.Get(), mValueBounds, &mBlend);
192 IVSlideSwitchControl::IVSlideSwitchControl(
const IRECT& bounds,
int paramIdx,
const char* label,
const IVStyle& style,
bool valueInButton, EDirection direction)
194 , mDirection(direction)
203 mValueBounds = mHandleBounds;
206 pCaller->OnEndAnimation();
210 DEFAULT_ANIMATION_DURATION);
214 IVSlideSwitchControl::IVSlideSwitchControl(
const IRECT& bounds, IActionFunction aF,
const char* label,
const IVStyle& style,
bool valueInButton, EDirection direction,
int numStates,
int initialState)
215 :
IVSwitchControl(bounds,
nullptr, label, style, numStates, valueInButton)
216 , mDirection(direction)
227 mValueBounds = mHandleBounds;
230 pCaller->OnEndAnimation();
235 DEFAULT_ANIMATION_DURATION);
241 void IVSlideSwitchControl::UpdateRects()
243 mHandleBounds = mStartRect = mWidgetBounds.
SubRect(mDirection, mNumStates, GetSelectedIdx());
244 mEndRect = mWidgetBounds.
SubRect(mDirection, mNumStates, (GetSelectedIdx() + 1) % mNumStates);
247 mValueBounds = mHandleBounds;
256 void IVSlideSwitchControl::OnEndAnimation()
260 IControl::OnEndAnimation();
275 DrawTrack(g, mWidgetBounds);
279 void IVSlideSwitchControl::DrawTrack(
IGraphics& g,
const IRECT& filledArea)
296 , mDirection(direction)
299 mText = style.valueText;
300 mText.mAlign = mStyle.valueText.mAlign = EAlign::Center;
301 mText.mVAlign = mStyle.valueText.mVAlign = EVAlign::Middle;
304 for (
auto& option : options)
306 mTabLabels.Add(
new WDL_String(option));
313 , mDirection(direction)
316 mText = style.valueText;
317 mText.mAlign = mStyle.valueText.mAlign = EAlign::Center;
318 mText.mVAlign = mStyle.valueText.mVAlign = EVAlign::Middle;
321 for (
auto& option : options)
323 mTabLabels.Add(
new WDL_String(option));
333 if(pParam && mTabLabels.GetSize() == 0)
335 for (
int i = 0; i < mNumStates; i++)
337 mTabLabels.Add(
new WDL_String(
GetParam()->GetDisplayText(i)));
340 if(!mLabelStr.GetLength())
341 mLabelStr.Set(pParam->
GetName());
352 void IVTabSwitchControl::DrawButton(
IGraphics& g,
const IRECT& r,
bool pressed,
bool mouseOver, ETabSegment segment,
bool disabled)
356 case EVShape::EndsRounded:
357 if(mDirection == EDirection::Horizontal)
358 DrawPressableRectangle(g, r, pressed, mouseOver, disabled, segment == ETabSegment::Start, segment == ETabSegment::End,
false,
false);
360 DrawPressableRectangle(g, r, pressed, mouseOver,
false, disabled, segment == ETabSegment::Start,
false, segment == ETabSegment::End);
362 case EVShape::AllRounded:
363 if(mDirection == EDirection::Horizontal)
376 int selected = GetSelectedIdx();
377 ETabSegment segment = ETabSegment::Start;
379 for (
int i = 0; i < mNumStates; i++)
381 IRECT r = mButtons.Get()[i];
384 segment = ETabSegment::Mid;
386 if(i == mNumStates-1)
387 segment = ETabSegment::End;
389 DrawButton(g, r, i == selected, mMouseOverButton == i, segment,
IsDisabled() || GetStateDisabled(i));
391 if(mTabLabels.Get(i))
393 g.
DrawText(mStyle.valueText, mTabLabels.Get(i)->Get(), r, &mBlend);
400 for (
int i = 0; i < mNumStates; i++)
402 if (mButtons.Get()[i].Contains(x, y))
418 SetValue(((
double) index * (1./(
double) (mNumStates-1))));
438 for (
int i = 0; i < mNumStates; i++)
440 mButtons.Add(mWidgetBounds.
SubRect(mDirection, mNumStates, i));
448 return mTabLabels.Get(GetSelectedIdx())->Get();
453 , mButtonSize(buttonSize)
455 mButtonAreaWidth = buttonSize * 3.f;
456 mText.mAlign = mStyle.valueText.mAlign = EAlign::Near;
457 mText.mVAlign = mStyle.valueText.mVAlign = EVAlign::Middle;
462 , mButtonSize(buttonSize)
464 mButtonAreaWidth = buttonSize * 3.f;
465 mText.mAlign = mStyle.valueText.mAlign = EAlign::Near;
466 mText.mVAlign = mStyle.valueText.mVAlign = EVAlign::Middle;
471 int hit = GetSelectedIdx();
473 for (
int i = 0; i < mNumStates; i++)
475 IRECT r = mButtons.Get()[i];
479 if (mTabLabels.Get(i))
482 g.
DrawText(mStyle.valueText.WithFGColor(i == hit ?
GetColor(kON) :
GetColor(kX1)), mTabLabels.Get(i)->Get(), r, &mBlend);
489 if (mOnlyButtonsRespondToMouse)
491 for (
int i = 0; i < mNumStates; i++)
493 if (mButtons.Get()[i].GetFromLeft(mButtonAreaWidth).Contains(x, y))
503 IVKnobControl::IVKnobControl(
const IRECT& bounds,
int paramIdx,
const char* label,
const IVStyle& style,
bool valueIsEditable,
bool valueInWidget,
float a1,
float a2,
float aAnchor, EDirection direction,
double gearing,
float trackSize)
508 , mAnchorAngle(aAnchor)
511 mText = style.valueText;
512 mHideCursorOnDrag = mStyle.hideCursor;
513 mShape = EVShape::Ellipse;
514 mTrackSize = trackSize;
518 IVKnobControl::IVKnobControl(
const IRECT& bounds, IActionFunction aF,
const char* label,
const IVStyle& style,
bool valueIsEditable,
bool valueInWidget,
float a1,
float a2,
float aAnchor, EDirection direction,
double gearing,
float trackSize)
523 , mAnchorAngle(aAnchor)
526 mText = style.valueText;
527 mHideCursorOnDrag = mStyle.hideCursor;
528 mShape = EVShape::Ellipse;
529 mTrackSize = trackSize;
546 if(mWidgetBounds.
W() > mWidgetBounds.
H())
558 if(mWidgetBounds.
W() > mWidgetBounds.
H())
559 widgetRadius = (mWidgetBounds.
H()/2.f);
561 widgetRadius = (mWidgetBounds.
W()/2.f);
563 const float cx = mWidgetBounds.
MW(), cy = mWidgetBounds.
MH();
565 widgetRadius -= (mTrackSize/2.f);
567 IRECT knobHandleBounds = mWidgetBounds.
GetCentredInside((widgetRadius - mTrackToHandleDistance) * 2.f );
568 const float angle = mAngle1 + (
static_cast<float>(
GetValue()) * (mAngle2 - mAngle1));
569 DrawIndicatorTrack(g, angle, cx, cy, widgetRadius);
571 DrawPointer(g, angle, cx, cy, knobHandleBounds.
W() / 2.f);
574 void IVKnobControl::DrawIndicatorTrack(
IGraphics& g,
float angle,
float cx,
float cy,
float radius)
576 if (mTrackSize > 0.f)
578 g.
DrawArc(
GetColor(kX1), cx, cy, radius, angle >= mAnchorAngle ? mAnchorAngle : mAnchorAngle - (mAnchorAngle - angle), angle >= mAnchorAngle ? angle : mAnchorAngle, &mBlend, mTrackSize);
582 void IVKnobControl::DrawPointer(
IGraphics& g,
float angle,
float cx,
float cy,
float radius)
584 g.
DrawRadialLine(
GetColor(kFR), cx, cy, angle, mInnerPointerFrac * radius, mOuterPointerFrac * radius, &mBlend, mPointerThickness);
589 if(mStyle.showValue && mValueBounds.
Contains(x, y))
618 if(mStyle.showValue && !mDisablePrompt)
619 mValueMouseOver = mValueBounds.
Contains(x,y);
640 return mWidgetBounds.
Contains(x, y);
661 if(!mLabelStr.GetLength())
662 mLabelStr.Set(pParam->
GetName());
666 IVSliderControl::IVSliderControl(
const IRECT& bounds,
int paramIdx,
const char* label,
const IVStyle& style,
bool valueIsEditable, EDirection dir,
double gearing,
float handleSize,
float trackSize,
bool handleInsideTrack)
669 , mHandleInsideTrack(handleInsideTrack)
672 mText = style.valueText;
673 mHideCursorOnDrag = style.hideCursor;
674 mShape = EVShape::Ellipse;
675 mTrackSize = trackSize;
679 IVSliderControl::IVSliderControl(
const IRECT& bounds, IActionFunction aF,
const char* label,
const IVStyle& style,
bool valueIsEditable, EDirection dir,
double gearing,
float handleSize,
float trackSize,
bool handleInsideTrack)
682 , mHandleInsideTrack(handleInsideTrack)
685 mText = style.valueText;
686 mHideCursorOnDrag = style.hideCursor;
687 mShape = EVShape::Ellipse;
688 mTrackSize = trackSize;
700 void IVSliderControl::DrawTrack(
IGraphics& g,
const IRECT& filledArea)
702 const float extra = mHandleInsideTrack ? mHandleSize : 0.f;
703 const IRECT adjustedTrackBounds = mDirection == EDirection::Vertical ? mTrackBounds.GetVPadded(extra) : mTrackBounds.GetHPadded(extra);
704 const IRECT adjustedFillBounds = mDirection == EDirection::Vertical ? filledArea.
GetVPadded(extra) : filledArea.
GetHPadded(extra);
719 DrawTrack(g, filledTrack);
723 const float offset = (mStyle.drawShadows && mShape != EVShape::Ellipse ) ? mStyle.shadowOffset * 0.5f : 0.f;
725 if(mDirection == EDirection::Vertical)
727 cx = filledTrack.
MW() + offset;
733 cy = filledTrack.
MH() + offset;
736 if(mHandleSize > 0.f)
738 DrawHandle(g, {cx-mHandleSize, cy-mHandleSize, cx+mHandleSize, cy+mHandleSize});
742 void IVSliderControl::DrawHandle(
IGraphics& g,
const IRECT& bounds)
749 if(mStyle.showValue && mValueBounds.
Contains(x, y))
776 if(mStyle.showValue && !mDisablePrompt)
777 mValueMouseOver = mValueBounds.
Contains(x,y);
787 if(mDirection == EDirection::Vertical)
805 return mWidgetBounds.
Contains(x, y);
824 if(!mLabelStr.GetLength())
825 mLabelStr.Set(pParam->
GetName());
831 IVRangeSliderControl::IVRangeSliderControl(
const IRECT& bounds,
const std::initializer_list<int>& params,
const char* label,
const IVStyle& style, EDirection dir,
bool onlyHandle,
float handleSize,
float trackSize)
833 , mHandleSize(handleSize)
835 mTrackSize = trackSize;
846 void IVRangeSliderControl::MakeTrackRects(
const IRECT& bounds)
848 for (
int ch = 0; ch <
NVals(); ch++)
850 if(mDirection == EDirection::Vertical)
857 void IVRangeSliderControl::DrawTrack(
IGraphics& g,
const IRECT& r,
int chIdx)
859 bool thisTrack = mMouseOverHandle == chIdx;
862 if(mDirection == EDirection::Horizontal)
863 angle = chIdx % 2 ? 180.f : 0.f;
865 angle = chIdx % 2 ? 270.f : 90.f;
870 IRECT IVRangeSliderControl::GetHandleBounds(
int trackIdx)
874 const float offset = (mStyle.drawShadows && mShape != EVShape::Ellipse ) ? mStyle.shadowOffset * 0.5f : 0.f;
875 if(mDirection == EDirection::Vertical)
877 cx = filledTrack.
MW() + offset;
881 return IRECT(cx+mTrackSize, cy-mHandleSize, cx+(2.f*mHandleSize)+mTrackSize, cy+mHandleSize);
883 return IRECT(cx-(2.f*mHandleSize), cy-mHandleSize, cx, cy+mHandleSize);
888 cy = filledTrack.
MH() + offset;
891 return IRECT(cx-mHandleSize, cy-(2.f*mHandleSize), cx+mHandleSize, cy);
893 return IRECT(cx-mHandleSize, cy+mTrackSize, cx+mHandleSize, cy+(2.f*mHandleSize)+mTrackSize);
899 IRECT r = mTrackBounds.Get()[0];
901 DrawTrackBackground(g, r, 0);
903 for(
int i=0;i<
NVals()-1;i++)
908 if(mDirection == EDirection::Vertical)
909 g.
FillRect(
GetColor(kX1),
IRECT(filled1.
L, filled1.
T < filled2.
T ? filled1.
T : filled2.
T, filled1.
R, filled1.
T > filled2.
T ? filled1.
T : filled2.
T), &mBlend);
911 g.
FillRect(
GetColor(kX1),
IRECT(filled1.
R < filled2.
R ? filled1.
R : filled2.
R, filled1.
T, filled1.
R > filled2.
R ? filled1.
R : filled2.
R, filled1.
B), &mBlend);
914 if(mStyle.drawFrame && mDrawTrackFrame)
925 for(
int i=0;i<
NVals();i++)
927 bounds = GetHandleBounds(i);
935 mMouseOverHandle = hitHandle;
949 if(mMouseOverHandle == -1)
952 auto minClip = mMouseOverHandle == 0 ? 0. :
GetValue(mMouseOverHandle-1);
953 auto maxClip = mMouseOverHandle ==
NVals()-1 ? 1. :
GetValue(mMouseOverHandle+1);
954 SnapToMouse(x, y, mDirection, mWidgetBounds, mMouseOverHandle, minClip, maxClip);
957 IVXYPadControl::IVXYPadControl(
const IRECT& bounds,
const std::initializer_list<int>& params,
const char* label,
const IVStyle& style,
float handleRadius)
960 , mHandleRadius(handleRadius)
962 mShape = EVShape::Ellipse;
981 const IRECT trackBounds = mWidgetBounds.
GetPadded(mTrackClipsHandle ? 0 : -mHandleRadius);
983 const float xpos =
static_cast<float>(
GetValue(0)) * trackBounds.
W();
984 const float ypos =
static_cast<float>(
GetValue(1)) * trackBounds.
H();
985 const IRECT handleBounds =
IRECT(trackBounds.
L + xpos-mHandleRadius, trackBounds.
B - ypos-mHandleRadius, trackBounds.
L + xpos+mHandleRadius, trackBounds.
B -ypos+mHandleRadius);
987 DrawHandle(g, trackBounds, handleBounds);
990 void IVXYPadControl::DrawHandle(
IGraphics& g,
const IRECT& trackBounds,
const IRECT& handleBounds)
992 if(mTrackClipsHandle)
998 void IVXYPadControl::DrawTrack(
IGraphics& g)
1007 if(mStyle.hideCursor)
1015 if(mStyle.hideCursor)
1025 float xn = (x - mRECT.
L) / mRECT.
W();
1026 float yn = 1.f - ((y - mRECT.
T) / mRECT.
H());
1043 , mUseLayer(useLayer)
1045 mPoints.resize(numPoints);
1049 for(
auto plot : plots)
1060 float hdiv = mWidgetBounds.
W() /
static_cast<float>(mHorizontalDivisions);
1061 float vdiv = mWidgetBounds.
H() /
static_cast<float>(mVerticalDivisions + 2);
1065 auto drawFunc = [&](){
1068 for (
int p=0; p<mPlots.size(); p++)
1070 for (
int i=0; i<mPoints.size(); i++)
1072 auto v = mPlots[p].func((static_cast<float>(i)/static_cast<float>(mPoints.size() - 1)));
1073 v = (v - mMin) / (mMax-mMin);
1074 mPoints[i] =
static_cast<float>(v);
1077 g.
DrawData(mPlots[p].color, plotsRECT, mPoints.data(),
static_cast<int>(mPoints.size()),
nullptr, &mBlend, mTrackSize);
1080 if (mStyle.drawFrame)
1107 mPlots.push_back({color, func});
1110 mLayer->Invalidate();
1114 IVGroupControl::IVGroupControl(
const IRECT& bounds,
const char* label,
float labelOffset,
const IVStyle& style)
1117 , mLabelOffset(labelOffset)
1120 mIgnoreMouse =
true;
1123 IVGroupControl::IVGroupControl(
const char* label,
const char* groupName,
float padL,
float padT,
float padR,
float padB,
const IVStyle& style)
1126 , mGroupName(groupName)
1133 mIgnoreMouse =
true;
1138 if(mGroupName.GetLength())
1140 SetBoundsBasedOnGroup(mGroupName.Get(), mPadL, mPadT, mPadR, mPadB);
1156 const float ft = mStyle.frameThickness;
1157 const float hft = ft/2.f;
1163 auto labelR = mLabelBounds.
Empty() ? mRECT.
MW() : mLabelBounds.
R;
1164 auto labelL = mLabelBounds.
Empty() ? mRECT.
MW() : mLabelBounds.
L;
1166 for(
int i=0; i < nPaths; i++)
1168 const float offset = i == 0 ? 0.f : mStyle.shadowOffset;
1171 g.
PathArc(b.R - cr - hft - offset, b.T + cr + hft - offset, cr, 0.f, 90.f);
1172 g.
PathArc(b.R - cr - hft - offset, b.B - cr - hft - offset, cr, 90.f, 180.f);
1173 g.
PathArc(b.L + cr + hft - offset, b.B - cr - hft - offset, cr, 180.f, 270.f);
1174 g.
PathArc(b.L + cr + hft - offset, b.T + cr + hft - offset, cr, 270.f, 360.f);
1183 mLabelBounds.
HPad(mLabelPadding);
1184 mWidgetBounds.
Offset(0, -(mLabelBounds.
H()/2.f) - (mStyle.frameThickness/2.f), 0, 0);
1186 mLabelBounds.
Translate(mRECT.
L - mLabelBounds.
L + mStyle.frameThickness + mLabelOffset + cr, 0.f);
1190 void IVGroupControl::SetBoundsBasedOnGroup(
const char* groupName,
float padL,
float padT,
float padR,
float padB)
1192 mGroupName.Set(groupName);
1196 float halfLabelHeight = mLabelBounds.
H()/2.f;
1198 mRECT = unionRect.
GetPadded(padL, padT, padR, padB);
1203 IVColorSwatchControl::IVColorSwatchControl(
const IRECT& bounds,
const char* label, ColorChosenFunc func,
const IVStyle& style, ECellLayout layout,
1204 const std::initializer_list<EVColor>& colorIDs,
const std::initializer_list<const char*>& labelsForIDs)
1207 , mColorChosenFunc(func)
1209 , mColorIdForCells(colorIDs)
1211 assert(colorIDs.size() == labelsForIDs.size());
1214 mCellRects.Resize(static_cast<int>(mColorIdForCells.size()));
1215 mText.mAlign = mStyle.valueText.mAlign = EAlign::Far;
1217 for (
int i=0;i<colorIDs.size();i++)
1219 mLabels.Add(
new WDL_String(labelsForIDs.begin()[i]));
1231 for (
int i=0; i< mColorIdForCells.size(); i++)
1233 WDL_String* pStr = mLabels.Get(i);
1234 IRECT r = mCellRects.Get()[i];
1237 g.
DrawRect(i == mCellOver ? COLOR_GRAY : COLOR_DARK_GRAY, buttonBounds.
GetPadded(0.5f), &mBlend);
1239 if(pStr->GetLength())
1251 if(mLayout == ECellLayout::kGrid)
1256 else if (mLayout == ECellLayout::kHorizontal)
1259 columns =
static_cast<int>(mColorIdForCells.size());
1261 else if (mLayout == ECellLayout::kVertical)
1263 rows =
static_cast<int>(mColorIdForCells.size());
1267 for (
int i=0; i< mColorIdForCells.size(); i++)
1277 for (
int i=0; i<mColorIdForCells.size(); i++)
1279 if(mCellRects.Get()[i].Contains(x, y))
1301 for (
int i=0; i<mColorIdForCells.size(); i++)
1303 if(mCellRects.Get()[i].Contains(x, y))
1310 if(cellClicked > -1)
1312 EVColor vColorClicked = mColorIdForCells[cellClicked];
1316 if(mColorChosenFunc)
1317 mColorChosenFunc(cellClicked, result);
1322 #pragma mark - SVG CONTROLS 1334 g.
DrawSVG(mOnSVG, mRECT, &mBlend);
1336 g.
DrawSVG(mOffSVG, mRECT, &mBlend);
1339 ISVGKnobControl::ISVGKnobControl(
const IRECT& bounds,
const ISVG& svg,
int paramIdx)
1350 void ISVGKnobControl::SetSVG(
ISVG& svg)
1364 g.
DrawSVG(mSVGs[GetSelectedIdx()], mRECT, &mBlend);
1369 , mHandleSVG(handleSVG)
1370 , mTrackSVG(trackSVG)
1376 g.
DrawSVG(mTrackSVG, mTrackSVGBounds, &mBlend);
1382 auto trackAspectRatio = mTrackSVG.
W() / mTrackSVG.
H();
1383 auto handleAspectRatio = mHandleSVG.
W() / mHandleSVG.
H();
1384 auto handleOverTrackHeight = mHandleSVG.
H() / mTrackSVG.
H();
1386 IRECT handleBoundsAtMidPoint;
1388 if (mDirection == EDirection::Vertical)
1392 handleBoundsAtMidPoint = mRECT.
GetCentredInside(mRECT.
H() * handleAspectRatio * handleOverTrackHeight, mRECT.
H() * handleOverTrackHeight);
1393 mHandleBoundsAtMax = { handleBoundsAtMidPoint.
L, mTrackSVGBounds.
T, handleBoundsAtMidPoint.
R, mTrackSVGBounds.
T + handleBoundsAtMidPoint.
H() };
1394 mTrackBounds = mTrackSVGBounds.
GetPadded(0, -handleBoundsAtMidPoint.
H(), 0, 0);
1399 auto handleHeight = mTrackSVGBounds.
H() * handleOverTrackHeight;
1400 handleBoundsAtMidPoint = mRECT.
GetCentredInside(handleHeight * handleAspectRatio, handleHeight);
1401 auto halfHeight = handleBoundsAtMidPoint.
H() / 2.f;
1402 mHandleBoundsAtMax = { mTrackSVGBounds.
R - handleBoundsAtMidPoint.
W(), mTrackSVGBounds.
MH() - halfHeight, mTrackSVGBounds.
R, mTrackSVGBounds.
MH() + halfHeight };
1403 mTrackBounds = mTrackSVGBounds.
GetPadded(-handleBoundsAtMidPoint.
W(), 0, 0, 0);
1409 IRECT ISVGSliderControl::GetHandleBounds(
double value)
const 1414 IRECT r = mHandleBoundsAtMax;
1416 if (mDirection == EDirection::Vertical)
1418 float offs = (1.f - (float) value) * mTrackBounds.
H();
1424 float offs = (1.f - (float) value) * mTrackBounds.
W();
1432 #pragma mark - BITMAP CONTROLS 1434 IBButtonControl::IBButtonControl(
float x,
float y,
const IBitmap& bitmap, IActionFunction aF)
1438 AttachIControl(
this);
1441 IBButtonControl::IBButtonControl(
const IRECT& bounds,
const IBitmap& bitmap, IActionFunction aF)
1445 AttachIControl(
this);
1464 if (mBitmap.
N() > 1)
1475 IBSliderControl::IBSliderControl(
float x,
float y,
float trackLength,
const IBitmap& handleBitmap,
const IBitmap& trackBitmap,
int paramIdx, EDirection dir,
double gearing)
1477 dir == EDirection::Vertical ? handleBitmap.
W() : trackLength,
1478 dir == EDirection::Vertical ? trackLength : handleBitmap.
H()),
1479 paramIdx, dir, gearing,
1480 float(dir == EDirection::Vertical ? handleBitmap.
H() : handleBitmap.
W()))
1482 , mTrackBitmap(trackBitmap)
1487 IBSliderControl::IBSliderControl(
const IRECT& bounds,
const IBitmap& handleBitmap,
const IBitmap& trackBitmap,
int paramIdx, EDirection dir,
double gearing)
1488 :
ISliderControlBase(bounds, paramIdx, dir, gearing,
float(dir == EDirection::Vertical ? handleBitmap.
H() : handleBitmap.
W()))
1490 , mTrackBitmap(trackBitmap)
1497 if(mTrackBitmap.IsValid())
1500 g.
DrawBitmap(mBitmap, GetHandleBounds(), 1, &mBlend);
1503 IRECT IBSliderControl::GetHandleBounds(
double value)
const 1508 IRECT r(mTrackBounds.L, mTrackBounds.T, mBitmap);
1510 if (mDirection == EDirection::Vertical)
1511 r.
Translate(0.f, (1.f - static_cast<float>(value)) * (mTrackBounds.H() -
static_cast<float>(mBitmap.
H())));
1513 r.
Translate(static_cast<float>(value) * (mTrackBounds.W() -
static_cast<float>(mBitmap.
W())), 0.f);
1520 if (mDirection == EDirection::Vertical)
1522 if(mTrackBitmap.IsValid())
1526 const float halfWidth =
static_cast<float>(mBitmap.
W()) / 2.f;
1532 if(mTrackBitmap.IsValid())
1536 const float halfHeight =
static_cast<float>(mBitmap.
H()) / 2.f;
1546 const double angle = -130.0 +
GetValue() * 260.0;
1550 IBTextControl::IBTextControl(
const IRECT& bounds,
const IBitmap& bitmap,
const IText& text,
const char* str,
int charWidth,
int charHeight,
int charOffset,
bool multiLine,
bool vCenter, EBlend blend)
1553 , mCharWidth(charWidth)
1554 , mCharHeight(charHeight)
1555 , mCharOffset(charOffset)
1556 , mMultiLine(multiLine)
1564 g.
DrawBitmapedText(mBitmap, mRECT, mText, &mBlend, mStr.Get(), mVCentre, mMultiLine, mCharWidth, mCharHeight, mCharOffset);
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.
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 Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
bool Contains(const IRECT &rhs) const
Returns true if this IRECT completely contains rhs.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
virtual void PathMoveTo(float x, float y)=0
Move the current point in the current path.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
const char * GetName() const
Returns the parameter's name.
IRECT SubRect(EDirection layoutDir, int numSlices, int sliceIdx) const
Get a new rectangle which is a "slice" of this rectangle.
void OnMouseOver(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouseover event on this control.
void StartLayer(IControl *pOwner, const IRECT &r, bool cacheable=false)
Create an IGraphics layer.
The lowest level base class of an IGraphics control.
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)
Constructs an IVPlotControl.
void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
Used to manage a rectangular area, independent of draw class/platform.
virtual void DrawGrid(const IColor &color, const IRECT &bounds, float gridSizeH, float gridSizeV, const IBlend *pBlend=0, float thickness=1.f)
Draw a grid to the graphics context.
const char * GetSelectedLabelStr() const
returns the label string on the selected tab
void SetColor(EVColor colorIdx, const IColor &color)
Set one of the IVColors that style the IVControl.
virtual void DrawValue(IGraphics &g, bool mouseOver)
Draw the IVControl value text.
virtual void DrawRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
Draw a rectangle to the graphics context.
A basic control to display some text.
virtual void PathArc(float cx, float cy, float r, float a1, float a2, EWinding winding=EWinding::CW)=0
Add an arc to the current path.
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 OnMouseOver(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouseover event on this control.
void OnMouseOver(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouseover event on this control.
void DisablePrompt(bool disable)
Disable/enable default prompt for user input.
Used to manage mouse modifiers i.e.
A base class for switch controls.
virtual void PathLineTo(float x, float y)=0
Add a line to the current path from the current point to the specified location.
bool mMouseIsOver
if mGraphics::mHandleMouseOver = true, this will be true when the mouse is over control.
virtual void DrawData(const IColor &color, const IRECT &bounds, float *normYPoints, int nPoints, float *normXPoints=nullptr, const IBlend *pBlend=0, float thickness=1.f)
Draw a line between a collection of normalized points.
virtual bool IsHit(float x, float y) const override
Hit test the control.
virtual void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
void Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
void Draw(IGraphics &g) override
Draw the control to the graphics context.
IRECT FracRectHorizontal(float frac, bool rhs=false) const
Returns a new IRECT with a width that is multiplied by frac.
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 Draw(IGraphics &g) override
Draw the control to the graphics context.
IPlug's parameter class.
void Translate(float x, float y)
Translate this rectangle.
IRECT FracRect(EDirection layoutDir, float frac, bool fromTopOrRight=false) const
Get a new rectangle which is a fraction of this rectangle.
virtual void SetValueToDefault(int valIdx=kNoValIdx)
Set one or all of the control's values to the default value of the associated parameter.
float GetRoundedCornerRadius(const IRECT &bounds) const
Get the radius of rounded corners for a rectangle, based on the style roundness factor.
void OnMouseOver(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouseover event on this control.
IControl * SetActionFunction(IActionFunction actionFunc)
Set an Action Function for this control.
void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
static IRECT MakeXYWH(float l, float t, float w, float h)
Create a new IRECT with the given position and size.
IRECT GetVPadded(float padding) const
Get a copy of this IRECT padded in the Y-axis N.B.
A vector "tab" multi switch control.
virtual void PathStroke(const IPattern &pattern, float thickness, const IStrokeOptions &options=IStrokeOptions(), const IBlend *pBlend=0)=0
Stroke the current current path.
virtual void DrawRoundRect(const IColor &color, const IRECT &bounds, float cornerRadius=5.f, const IBlend *pBlend=0, float thickness=1.f)
Draw a rounded rectangle to the graphics context.
Used to manage color data, independent of draw class/platform.
IRECT GetTranslated(float x, float y) const
Get a translated copy of this rectangle.
void HPad(float padding)
Pad this IRECT in the X-axis N.B.
A base interface to be combined with IControl for bitmap-based controls "IBControls", managing an IBitmap.
void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
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 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.
void OnInit() override
Called just prior to when the control is attached, after its delegate and graphics member variable se...
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
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)
Constructs a vector tab switch control, linked to a parameter.
IControl * SetAnimationEndActionFunction(IActionFunction actionFunc)
Set an Action Function to be called at the end of an animation.
void OnMouseOut() override
Implement this method to respond to a mouseout event on this control.
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.
ISVGSwitchControl(const IRECT &bounds, const std::initializer_list< ISVG > &svgs, int paramIdx=kNoParameter, IActionFunction aF=nullptr)
Constructs a SVG switch control.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
IBSwitchControl(float x, float y, const IBitmap &bitmap, int paramIdx=kNoParameter)
Constructs a bitmap switch control.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
virtual int GetValIdxForPos(float x, float y) const
Check to see which of the control's values relates to this x and y coordinate.
IRECT GetFromLeft(float amount) const
Get a subrect of this IRECT bounded in X by the left edge and 'amount'.
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...
IRECT DrawPressableTriangle(IGraphics &g, const IRECT &bounds, bool pressed, bool mouseOver, float angle, bool disabled)
Draw a triangle-shaped vector button.
bool IsHit(float x, float y) const override
Hit test the control.
void SetDirty(bool push, int valIdx=kNoValIdx) override
Mark the control as dirty, i.e.
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.
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.
IBitmapBase(const IBitmap &bitmap)
IBitmapBase Constructor.
IRECT GetMidHPadded(float padding) const
Get a copy of this IRECT where its width = 2 * padding but the center point on the X-axis has not cha...
void OnResize() override
Called when IControl is constructed or resized using SetRect().
virtual void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
void DrawRadialLine(const IColor &color, float cx, float cy, float angle, float rMin, float rMax, const IBlend *pBlend=0, float thickness=1.f)
Draw a radial line to the graphics context, useful for pointers on dials.
IText is used to manage font and text/text entry style for a piece of text on the UI...
void Offset(float l, float t, float r, float b)
Offset each field of the rectangle.
bool CheckLayer(const ILayerPtr &layer)
Test to see if a layer needs drawing, for instance if the control's bounds were changed.
void OnInit() override
Called just prior to when the control is attached, after its delegate and graphics member variable se...
const IColor & GetColor(EVColor color) const
Get value of a specific EVColor in the IVControl.
virtual void DrawSVG(const ISVG &svg, const IRECT &bounds, const IBlend *pBlend=0)
Draw an SVG image to the graphics context.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
IControl(const IRECT &bounds, int paramIdx=kNoParameter, IActionFunction actionFunc=nullptr)
Constructor.
void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
A collection of IControls for common UI widgets, such as knobs, sliders, switches.
static IRECT LinearInterpolateBetween(const IRECT &start, const IRECT &dest, float progress)
Get a rectangle that is a linear interpolation between start and dest
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
void PathClipRegion(const IRECT r=IRECT())
Clip the current path to a particular region.
void AddPlotFunc(const IColor &color, const IPlotFunc &func)
add a new function to the plot
The lowest level base class of an IGraphics context.
IVectorBase(const IVStyle &style, bool labelInWidget=false, bool valueInWidget=false)
IVectorBase Constructor.
void SetAnimation(IAnimationFunction func)
Set the animation function.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
virtual void DrawPressableShape(IGraphics &g, EVShape shape, const IRECT &bounds, bool pressed, bool mouseOver, bool disabled)
Call one of the DrawPressableShape methods.
void DrawValue(IGraphics &g, bool mouseOver) override
Draw the IVControl value text.
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 OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
ISVGSliderControl(const IRECT &bounds, const ISVG &handleSvg, const ISVG &trackSVG, int paramIdx=kNoParameter, EDirection dir=EDirection::Vertical, double gearing=DEFAULT_GEARING)
Constructs an ISVGSliderControl.
void GetDisplay(WDL_String &display, bool withDisplayText=true) const
Get the current textual display for the current parameter value.
void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
void Draw(IGraphics &g) override
Draw the control to the graphics context.
virtual void FillRoundRect(const IColor &color, const IRECT &bounds, float cornerRadius=5.f, const IBlend *pBlend=0)
Fill a rounded rectangle with a color.
virtual void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
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 OnMouseDblClick(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse double click event on this control.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
void OnResize() override
Called when IControl is constructed or resized using SetRect().
void Constrain(float &x, float &y) const
Ensure the point (x,y) is inside this IRECT.
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.
IAnimationFunction GetAnimationFunction()
Get the control's animation function, if it exists.
A base class for knob/dial controls, to handle mouse action and Sender.
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 PathClear()=0
Clear the stack of path drawing commands.
IRECT Union(const IRECT &rhs) const
Create a new IRECT that is a union of this IRECT and rhs.
void OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
void DrawLayer(const ILayerPtr &layer, const IBlend *pBlend=nullptr)
Draw a layer to the main IGraphics context.
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.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
IRECT GetFromRight(float amount) const
Get a subrect of this IRECT bounded in X by 'amount' and the right edge.
void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
virtual int GetButtonForPoint(float x, float y) const
virtual void DrawBitmap(const IBitmap &bitmap, const IRECT &bounds, int srcX, int srcY, const IBlend *pBlend=0)=0
Draw a bitmap (raster) image to the graphics context.
void DrawHorizontalLine(const IColor &color, const IRECT &bounds, float y, const IBlend *pBlend=0, float thickness=1.f)
Draw a horizontal line, within a rectangular region of the graphics context.
IRECT GetGridCell(int row, int col, int nRows, int nColumns) const
Get a subrect (by row, column) of this IRECT which is a cell in a grid of size (nRows * nColumns) ...
A base class for slider/fader controls, to handle mouse action and Sender.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
bool IsHit(float x, float y) const override
Hit test the control.
void ForControlInGroup(const char *group, std::function< void(IControl *pControl)> func)
For all standard controls in the main control stack that are linked to a group, execute a function...
double GetValue(int valIdx=0) const
Get the control's value.
void SetDirty(bool push, int valIdx=kNoValIdx) override
Mark the control as dirty, i.e.
void SetTargetRECT(const IRECT &bounds)
Set the rectangular mouse tracking target area, within the graphics context for this control...
float L
Left side of the rectangle (X)
void Draw(IGraphics &g) override
Draw the control to the graphics context.
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 DrawRotatedBitmap(const IBitmap &bitmap, float destCentreX, float destCentreY, double angle, const IBlend *pBlend=0)
Draw a bitmap (raster) image to the graphics context with rotation.
virtual void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
void SetDirty(bool push, int valIdx=kNoValIdx) override
Mark the control as dirty, i.e.
ILayerPtr EndLayer()
End an IGraphics layer.
IRECT GetHPadded(float padding) const
Get a copy of this IRECT padded in the X-axis N.B.
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.
void DrawBitmapedText(const IBitmap &bitmap, const IRECT &bounds, IText &text, IBlend *pBlend, const char *str, bool vCenter=true, bool multiline=false, int charWidth=6, int charHeight=12, int charOffset=0)
Draws mono spaced bitmap text.
void OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
void OnMouseDblClick(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse double click event on this control.
void DrawVerticalLine(const IColor &color, const IRECT &bounds, float x, const IBlend *pBlend=0, float thickness=1.f)
Draw a vertical line, within a rectangular region of the graphics context.
void OnInit() override
Called just prior to when the control is attached, after its delegate and graphics member variable se...
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.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
IRECT GetPadded(float padding) const
Get a copy of this IRECT with each value padded by padding N.B.
void DrawWidget(IGraphics &g) override
Draw the IVControl main widget (override)
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.
virtual void SetValue(double value, int valIdx=0)
Set one of the control's values.
void OnMouseOver(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouseover event on this control.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
bool IsHit(float x, float y) const override
Hit test the control.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
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!
virtual void DrawRotatedSVG(const ISVG &svg, float destCentreX, float destCentreY, float width, float height, double angle, const IBlend *pBlend=0)
Draw an SVG image to the graphics context with rotation.
virtual void DrawArc(const IColor &color, float cx, float cy, float r, float a1, float a2, const IBlend *pBlend=0, float thickness=1.f)
Draw an arc to the graphics context.
virtual bool PromptForColor(IColor &color, const char *str="", IColorPickerHandlerFunc func=nullptr)=0
Create a platform color chooser dialog.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
void OnMouseOver(float x, float y, const IMouseMod &mod) override
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 Draw(IGraphics &g) override
Draw the control to the graphics context.
void SetDirty(bool push, int valIdx=kNoValIdx) override
Mark the control as dirty, i.e.
void AttachIControl(IControl *pControl)
Call in the constructor of your IBControl to link the IBitmapBase and IControl.
float T
Top of the rectangle (Y)
void OnInit() override
Called just prior to when the control is attached, after its delegate and graphics member variable se...
void OnInit() override
Called just prior to when the control is attached, after its delegate and graphics member variable se...
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.
float B
Bottom of the rectangle (Y + H)
void OnResize() override
Called when IControl is constructed or resized using SetRect().
void Draw(IGraphics &g) override
Draw the control to the graphics context.
IRECT GetMidVPadded(float padding) const
Get a copy of this IRECT where its height = 2 * padding but the center point on the Y-axis has not ch...
virtual IRECT GetKnobDragBounds() override
Get the area for which mouse deltas will be used to calculate the amount dragging changes the control...