29 using namespace VSTGUI;
47 void draw(CDrawContext *iContext)
override;
51 void setOffsetPercentTag(int32_t offsetPercentTag);
55 void setZoomPercentTag(int32_t zoomPercentTag);
63 void setScrollbarColor(
const CColor &iColor) { fScrollbarColor = iColor; needsRecomputing(); }
67 void setScrollbarMinSize(CCoord iScrollbarMinSize) { fScrollbarMinSize = iScrollbarMinSize; needsRecomputing();}
71 void setScrollbarGutterSpacing(CCoord iScrollbarGutterSpacing) { fScrollbarGutterSpacing = iScrollbarGutterSpacing; needsRecomputing();}
93 double getOffsetPercent()
const;
94 void setOffsetPercent(
double iOffsetPercent);
97 double getZoomPercent()
const;
98 void setZoomPercent(
double iZoomPercent);
104 void setViewSize(
const CRect &rect,
bool invalid)
override;
107 void registerParameters()
override;
110 void onParameterChange(ParamID iParamID)
override;
113 CMouseEventResult onMouseDown(CPoint &where,
const CButtonState &buttons)
override;
116 CMouseEventResult onMouseMoved(CPoint &where,
const CButtonState &buttons)
override;
119 CMouseEventResult onMouseUp(CPoint &where,
const CButtonState &buttons)
override;
122 CMouseEventResult onMouseCancel()
override;
125 enum class DragType { kNone, kScroll, kZoomLeft, kZoomRight, kStretchLeft, kStretchRight };
142 bool isFull()
const {
return fMinCenter == fMaxCenter; }
147 bool isMinLeft()
const {
return fCenter == fMinCenter; }
155 CCoord
getHeight()
const {
return fViewSize.getHeight(); }
158 CCoord
getWidth()
const {
return fHalfWidth * 2.0; }
190 fCenter =
Utils::clamp(fCenter + iDeltaX, fMinCenter, fMaxCenter);
196 fCenter =
Utils::clamp(iNewCenter, fMinCenter, fMaxCenter);
204 bool stretch(CCoord iDeltaX,
DragType iDragType);
215 virtual void drawLeftHandle(CDrawContext *iContext);
218 virtual void drawRightHandle(CDrawContext *iContext);
221 virtual void drawScrollbar(CDrawContext *iContext);
230 ZoomBox computeZoomBox()
const;
233 CCoord getScrollbarWidth()
const;
237 bool fNeedsRecomputing{
true};
247 CColor fScrollbarColor{kWhiteCColor};
248 CCoord fScrollbarMinSize{-1};
249 CCoord fScrollbarGutterSpacing{1};
251 CColor fZoomHandlesColor{kWhiteCColor};
252 CCoord fZoomHandlesSize{-1};
256 bool fEnableZoomDoubleClick{
true};
259 int32_t fOffsetPercentTag{-1};
261 double fOffsetPercentValue{};
265 int32_t fZoomPercentTag{-1};
267 double fZoomPercentValue{};
278 explicit Creator(
char const *iViewName =
nullptr,
char const *iDisplayName =
nullptr) :
Definition: CustomViewCreator.h:981
static T clamp(const U &iValue, const T &iLower, const T &iUpper)
Definition: Misc.h:33
std::unique_ptr< GUIRawVstParameter::Editor > GUIRawVstParamEditor
Definition: GUIRawVstParameter.h:291
Definition: GUIRawVstParameter.h:211
Definition: CustomView.h:100
static double mapValueDP(double iValue, double iFromLow, double iFromHigh, double iToLow, double iToHigh, bool iClamp=true)
Definition: Lerp.h:217
CCoord RelativeCoord
Definition: DrawContext.h:45
Definition: LookAndFeel.h:32
CRect AbsoluteRect
Definition: DrawContext.h:50
Definition: DrawContext.h:52