59 void draw(CDrawContext *iContext)
override;
63 void setOffsetPercentTag(ParamID offsetPercentTag);
67 void setZoomPercentTag(ParamID zoomPercentTag);
75 void setScrollbarColor(
const CColor &iColor) { fScrollbarColor = iColor; needsRecomputing(); }
79 void setScrollbarMinSize(CCoord iScrollbarMinSize) { fScrollbarMinSize = iScrollbarMinSize; needsRecomputing();}
83 void setScrollbarGutterSpacing(CCoord iScrollbarGutterSpacing) { fScrollbarGutterSpacing = iScrollbarGutterSpacing; needsRecomputing();}
113 double getOffsetPercent()
const;
114 void setOffsetPercent(
double iOffsetPercent);
117 double getZoomPercent()
const;
118 void setZoomPercent(
double iZoomPercent);
124 void setViewSize(
const CRect &rect,
bool invalid)
override;
127 void registerParameters()
override;
130 void onParameterChange(ParamID iParamID)
override;
133 CMouseEventResult onMouseDown(CPoint &where,
const CButtonState &buttons)
override;
136 CMouseEventResult onMouseMoved(CPoint &where,
const CButtonState &buttons)
override;
139 CMouseEventResult onMouseUp(CPoint &where,
const CButtonState &buttons)
override;
142 CMouseEventResult onMouseCancel()
override;
145 enum class DragType { kNone, kScroll, kZoomLeft, kZoomRight, kStretchLeft, kStretchRight };
162 bool isFull()
const {
return fMinCenter == fMaxCenter; }
167 bool isMinLeft()
const {
return fCenter == fMinCenter; }
175 CCoord
getHeight()
const {
return fViewSize.getHeight(); }
178 CCoord
getWidth()
const {
return fHalfWidth * 2.0; }
210 fCenter =
Utils::clamp(fCenter + iDeltaX, fMinCenter, fMaxCenter);
216 fCenter =
Utils::clamp(iNewCenter, fMinCenter, fMaxCenter);
224 bool stretch(CCoord iDeltaX,
DragType iDragType);
235 virtual void drawLeftHandle(CDrawContext *iContext);
238 virtual void drawRightHandle(CDrawContext *iContext);
241 virtual void drawScrollbar(CDrawContext *iContext);
250 ZoomBox computeZoomBox()
const;
253 CCoord getScrollbarWidth()
const;
257 bool fNeedsRecomputing{
true};
267 CColor fScrollbarColor{kWhiteCColor};
268 CCoord fScrollbarMinSize{-1};
269 CCoord fScrollbarGutterSpacing{1};
271 CColor fZoomHandlesColor{kWhiteCColor};
272 CCoord fZoomHandlesSize{-1};
276 bool fEnableZoomDoubleClick{
true};
296 explicit Creator(
char const *iViewName =
nullptr,
char const *iDisplayName =
nullptr) :
Inherit from this class to provide the factory for a custom view.
Definition: CustomViewCreator.h:1314
static T clamp(const U &iValue, const T &iLower, const T &iUpper)
Make sure that the value remains within its bounds.
Definition: Misc.h:33
CCoord RelativeCoord
Definition: DrawContext.h:72
std::unique_ptr< typename GUIOptionalParam< T >::EditorType > GUIOptionalParamEditor
Definition: GUIOptionalParam.h:187
Class you should inherit from if you want to write a custom view.
Definition: CustomView.h:60
static double mapValueDP(double iValue, double iFromLow, double iFromHigh, double iToLow, double iToHigh, bool iClamp=true)
Convenient shortcut for single precision.
Definition: Lerp.h:220
CRect AbsoluteRect
Definition: DrawContext.h:77
Margin is a similar concept to css: used to create space around elements, outside of any defined bord...
Definition: LookAndFeel.h:32
Definition: CustomController.h:24
Definition: DrawContext.h:79
constexpr ParamID UNDEFINED_PARAM_ID
Constant used throughout the code to test whether the ParamID represents a valid id or an undefined o...
Definition: Types.h:47