21#include <vstgui4/vstgui/lib/cdrawcontext.h>
22#include <vstgui4/vstgui/lib/cview.h>
24#include <base/source/fstring.h>
32using namespace VSTGUI;
98 return fRect.getWidth();
107 return fRect.getHeight();
112 return x +
fRect.left;
117 return y +
fRect.top;
122 return x -
fRect.left;
127 return y -
fRect.top;
242 CRect size{x, y,
fDrawContext->getStringWidth(iText.getPlatformString()), iHeight};
260 template<
typename... Args>
264 auto s = Steinberg::String().printf(iFormat, std::forward<Args>(iArgs)...);
265 debugText(x, y, s.text8());
269 template<
typename... Args>
270 inline void debugTopLeft(
char const *iFormat, Args&& ...iArgs) { debugXY(0, 0, iFormat, std::forward<Args>(iArgs)...); }
273 template<
typename... Args>
274 inline void debugTopRight(
char const *iFormat, Args&& ...iArgs) { debugXY(-1, 0, iFormat, std::forward<Args>(iArgs)...); }
277 template<
typename... Args>
278 inline void debugBottomLeft(
char const *iFormat, Args&& ...iArgs) { debugXY(0, -1, iFormat, std::forward<Args>(iArgs)...); }
281 template<
typename... Args>
282 inline void debugBottomRight(
char const *iFormat, Args&& ...iArgs) { debugXY(-1, -1, iFormat, std::forward<Args>(iArgs)...); }
287 template<
typename... Args>
288 inline void debug(
char const *iFormat, Args&& ...iArgs) { debugTopLeft(iFormat, std::forward<Args>(iArgs)...); }
293 inline void debugText(
char const *iText) { debugText(0, 0, iText); }
307 CColor fDebugStringColor{kGreenCColor};
308 FontPtr fDebugStringFont{kNormalFontVerySmall};
void drawLine(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &color)
Definition DrawContext.h:176
void fillRect(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &iColor)
Definition DrawContext.h:193
void fillEllipse(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &iColor)
Definition DrawContext.h:222
void drawEllipse(RelativeRect const &iRect, CColor const &iStrokeColor)
Definition DrawContext.h:216
void drawRect(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &iStrokeColor)
Definition DrawContext.h:182
void drawEllipse(RelativeCoord x1, RelativeCoord y1, RelativeCoord x2, RelativeCoord y2, CColor const &iStrokeColor)
Definition DrawContext.h:211
void fillAndStrokeEllipse(RelativeRect const &iRect, CColor const &iFillColor, CColor const &iStrokeColor)
Definition DrawContext.h:233
void drawString(UTF8String const &iText, StringDrawContext &iSdc)
Definition DrawContext.h:248
void drawRect(RelativeRect const &iRect, CColor const &iStrokeColor)
Definition DrawContext.h:187
RelativeDrawContext(CView *iView, CDrawContext *iDrawContext)
Definition DrawContext.h:172
void drawString(UTF8String const &iText, RelativeCoord x, RelativeCoord y, RelativeCoord iHeight, StringDrawContext &iSdc)
Definition DrawContext.h:240
CDrawContext * fDrawContext
Definition DrawContext.h:303
void fillEllipse(RelativeRect const &iRect, CColor const &iColor)
Definition DrawContext.h:227
void fillRect(RelativeRect const &iRect, CColor const &iColor)
Definition DrawContext.h:198
void fillAndStrokeRect(RelativeRect const &iRect, CColor const &iFillColor, CColor const &iStrokeColor)
Definition DrawContext.h:204
Range getHorizontalRange() const
Definition DrawContext.h:101
RelativeView(AbsoluteRect const &iRect)
Definition DrawContext.h:87
RelativeCoord fromAbsoluteX(AbsoluteCoord x) const
Definition DrawContext.h:120
Range getVerticalRange() const
Definition DrawContext.h:103
RelativeRect getViewSize() const
Definition DrawContext.h:91
CCoord getWidth() const
Definition DrawContext.h:96
AbsolutePoint toAbsolutePoint(RelativePoint const &iPoint) const
Definition DrawContext.h:130
AbsoluteRect const & fRect
Definition DrawContext.h:163
RelativePoint fromAbsolutePoint(AbsolutePoint const &iPoint) const
Definition DrawContext.h:135
AbsolutePoint toAbsolutePoint(RelativeCoord x, RelativeCoord y) const
Definition DrawContext.h:152
CCoord getHeight() const
Definition DrawContext.h:105
AbsoluteRect toAbsoluteRect(RelativeRect const &iRect) const
Definition DrawContext.h:157
RelativePoint clampAbsolutePoint(AbsolutePoint const &iPoint) const
Convert the absolute point to a relative point while making sure it is clamped (constrained) within t...
Definition DrawContext.h:144
RelativeView(CView const *iView)
Definition DrawContext.h:83
AbsoluteCoord toAbsoluteY(RelativeCoord y) const
Definition DrawContext.h:115
RelativeCoord fromAbsoluteY(AbsoluteCoord y) const
Definition DrawContext.h:125
AbsoluteCoord toAbsoluteX(RelativeCoord x) const
Definition DrawContext.h:110
static T clamp(const U &iValue, const T &iLower, const T &iUpper)
Make sure that the value remains within its bounds.
Definition Misc.h:34
Definition DrawContext.cpp:25
CRect AbsoluteRect
Definition DrawContext.h:78
CRect RelativeRect
Definition DrawContext.h:77
CPoint AbsolutePoint
Definition DrawContext.h:76
CCoord RelativeCoord
Definition DrawContext.h:73
CPoint RelativePoint
Definition DrawContext.h:75
CCoord AbsoluteCoord
Definition DrawContext.h:74
CFontDesc * FontPtr
Definition Types.h:54
Utils::Range< CCoord > Range
Defines a Range.
Definition Types.h:64
DeprecatedCControlEnum
Implementation note: The CControlEnum enumeration has been removed from VSTGUI.
Definition DrawContext.h:43
@ kShadowText
Definition DrawContext.h:44
@ kNoTextStyle
Definition DrawContext.h:45
The context which contains the details on how the string should be drawn.
Definition DrawContext.h:51
void setStyle(Style iStyle)
Definition DrawContext.h:69
CHoriTxtAlign fHorizTxtAlign
Definition DrawContext.h:58
CPoint fShadowTextOffset
Definition DrawContext.h:65
Style
Definition DrawContext.h:53
bool fAntialias
Definition DrawContext.h:66
void addStyle(Style iStyle)
Definition DrawContext.h:70
constexpr bool hasStyle(Style iStyle) const
Definition DrawContext.h:68
FontPtr fFont
Definition DrawContext.h:61
CColor fFontColor
Definition DrawContext.h:62
int32_t fStyle
Should be a value provided by StringDrawContext::Style.
Definition DrawContext.h:60
CPoint fTextInset
Definition DrawContext.h:64
CColor fShadowColor
Definition DrawContext.h:63