iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
IGraphics.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5
6 See LICENSE.txt for more info.
7
8 ==============================================================================
9*/
10
11#pragma once
12
33#ifndef NO_IGRAPHICS
34#if defined(IGRAPHICS_NANOVG) + defined(IGRAPHICS_CANVAS) + defined(IGRAPHICS_SKIA) != 1
35#error Either NO_IGRAPHICS or one and only one choice of graphics library must be defined!
36#endif
37#endif
38
39#ifdef AAX_API
40#include "IPlugAAX_view_interface.h"
41#endif
42
43#include "IPlugConstants.h"
44#include "IPlugLogger.h"
45#include "IPlugPaths.h"
46
47#include "IGraphicsConstants.h"
48#include "IGraphicsStructs.h"
49#include "IGraphicsPopupMenu.h"
51
52#include "nanosvg.h"
53
54#include <stack>
55#include <memory>
56#include <vector>
57#include <unordered_map>
58
59#ifdef FillRect
60#undef FillRect
61#endif
62
63#ifdef DrawText
64#undef DrawText
65#endif
66
67#ifdef LoadBitmap
68#undef LoadBitmap
69#endif
70
71BEGIN_IPLUG_NAMESPACE
72class IParam;
73BEGIN_IGRAPHICS_NAMESPACE
74class IControl;
79class IBubbleControl;
80
83#ifdef AAX_API
84: public IPlugAAXView_Interface
85#endif
86{
87public:
88#pragma mark - Drawing API implementation
89
91 virtual void BeginFrame();
92
94 virtual void OnViewInitialized(void* pContext) {};
95
97 virtual void OnViewDestroyed() {};
98
100 virtual void EndFrame() {};
101
108 virtual void DrawSVG(const ISVG& svg, const IRECT& bounds, const IBlend* pBlend = 0, const IColor* pStrokeColor = nullptr, const IColor* pFillColor = nullptr);
109
118 virtual void DrawRotatedSVG(const ISVG& svg, float destCentreX, float destCentreY, float width, float height, double angle, const IBlend* pBlend = 0);
119
126 virtual void DrawBitmap(const IBitmap& bitmap, const IRECT& bounds, int srcX, int srcY, const IBlend* pBlend = 0) = 0;
127
132 virtual void DrawFittedBitmap(const IBitmap& bitmap, const IRECT& bounds, const IBlend* pBlend = 0);
133
140 virtual void DrawRotatedBitmap(const IBitmap& bitmap, float destCentreX, float destCentreY, double angle, const IBlend* pBlend = 0);
141
147 virtual void DrawPoint(const IColor& color, float x, float y, const IBlend* pBlend = 0);
148
157 virtual void DrawLine(const IColor& color, float x1, float y1, float x2, float y2, const IBlend* pBlend = 0, float thickness = 1.f);
158
167 virtual void DrawDottedLine(const IColor& color, float x1, float y1, float x2, float y2, const IBlend* pBlend = 0, float thickness = 1.f, float dashLen = 2.f);
168
179 virtual void DrawTriangle(const IColor& color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend* pBlend = 0, float thickness = 1.f);
180
186 virtual void DrawRect(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0, float thickness = 1.f);
187
194 virtual void DrawRoundRect(const IColor& color, const IRECT& bounds, float cornerRadius = 5.f, const IBlend* pBlend = 0, float thickness = 1.f);
195
205 virtual void DrawRoundRect(const IColor& color, const IRECT& bounds, float cRTL, float cRTR, float cRBR, float cRBL, const IBlend* pBlend = 0, float thickness = 1.f);
206
216 virtual void DrawArc(const IColor& color, float cx, float cy, float r, float a1, float a2, const IBlend* pBlend = 0, float thickness = 1.f);
217
225 virtual void DrawCircle(const IColor& color, float cx, float cy, float r, const IBlend* pBlend = 0, float thickness = 1.f);
226
232 virtual void DrawEllipse(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0, float thickness = 1.f);
233
243 virtual void DrawEllipse(const IColor& color, float x, float y, float r1, float r2, float angle = 0.0, const IBlend* pBlend = 0, float thickness = 1.f);
244
252 virtual void DrawConvexPolygon(const IColor& color, float* x, float* y, int nPoints, const IBlend* pBlend = 0, float thickness = 1.f);
253
259 virtual void DrawDottedRect(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0, float thickness = 1.f, float dashLen = 2.f);
260
270 virtual void FillTriangle(const IColor& color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend* pBlend = 0);
271
276 virtual void FillRect(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0);
277
283 virtual void FillRoundRect(const IColor& color, const IRECT& bounds, float cornerRadius = 5.f, const IBlend* pBlend = 0);
284
293 virtual void FillRoundRect(const IColor& color, const IRECT& bounds, float cRTL, float cRTR, float cRBR, float cRBL, const IBlend* pBlend = 0);
294
301 virtual void FillCircle(const IColor& color, float cx, float cy, float r, const IBlend* pBlend = 0);
302
307 virtual void FillEllipse(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0);
308
317 virtual void FillEllipse(const IColor& color, float x, float y, float r1, float r2, float angle = 0.0, const IBlend* pBlend = 0);
318
327 virtual void FillArc(const IColor& color, float cx, float cy, float r, float a1, float a2, const IBlend* pBlend = 0);
328
335 virtual void FillConvexPolygon(const IColor& color, float* x, float* y, int nPoints, const IBlend* pBlend = 0);
336
342 void DrawText(const IText& text, const char* str, const IRECT& bounds, const IBlend* pBlend = 0);
343
350 void DrawText(const IText& text, const char* str, float x, float y, const IBlend* pBlend = 0);
351
356 virtual float MeasureText(const IText& text, const char* str, IRECT& bounds) const;
357
363 virtual void DrawMultiLineText(const IText& text, const char* str, const IRECT& bounds, const IBlend* pBlend = 0) { DrawText(text, "Unsupported", bounds, pBlend); }
364
369 virtual IColor GetPoint(int x, int y) = 0;
370
373 virtual void* GetDrawContext() = 0;
374
376 virtual const char* GetDrawingAPIStr() = 0;
377
383 virtual IBitmap ScaleBitmap(const IBitmap& inBitmap, const char* cacheName, int targetScale);
384
388 virtual void RetainBitmap(const IBitmap& bitmap, const char* cacheName);
389
392 virtual void ReleaseBitmap(const IBitmap& bitmap);
393
399
401 virtual bool BitmapExtSupported(const char* ext) = 0;
402
404 virtual void DrawFastDropShadow(const IRECT& innerBounds, const IRECT& outerBounds, float xyDrop = 5.f, float roundness = 0.f, float blur = 10.f, IBlend* pBlend = nullptr) { /* NO-OP*/ }
405
406#pragma mark - Base implementation - drawing helpers
407
413 void DrawBitmap(const IBitmap& bitmap, const IRECT& bounds, int frame = 1, const IBlend* pBlend = 0);
414
426 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);
427
435 void DrawLineAcross(const IColor& color, const IRECT& bounds, EDirection dir, float pos, const IBlend* pBlend = 0, float thickness = 1.f);
436
443 void DrawVerticalLine(const IColor& color, const IRECT& bounds, float x, const IBlend* pBlend = 0, float thickness = 1.f);
444
451 void DrawHorizontalLine(const IColor& color, const IRECT& bounds, float y, const IBlend* pBlend = 0, float thickness = 1.f);
452
460 void DrawVerticalLine(const IColor& color, float xi, float yLo, float yHi, const IBlend* pBlend = 0, float thickness = 1.f);
461
469 void DrawHorizontalLine(const IColor& color, float yi, float xLo, float xHi, const IBlend* pBlend = 0, float thickness = 1.f);
470
480 void DrawRadialLine(const IColor& color, float cx, float cy, float angle, float rMin, float rMax, const IBlend* pBlend = 0, float thickness = 1.f);
481
489 virtual void DrawGrid(const IColor& color, const IRECT& bounds, float gridSizeH, float gridSizeV, const IBlend* pBlend = 0, float thickness = 1.f);
490
500 virtual void DrawData(const IColor& color, const IRECT& bounds, float* normYPoints, int nPoints, float* normXPoints = nullptr, const IBlend* pBlend = 0, float thickness = 1.f, const IColor* pFillColor = nullptr);
501
506 virtual bool LoadFont(const char* fontID, const char* fileNameOrResID);
507
513 virtual bool LoadFont(const char* fontID, void* pData, int dataSize);
514
520 bool LoadFont(const char* fontID, const char* fontName, ETextStyle style);
521
522#pragma mark - Layer management
523
528 void StartLayer(IControl* pOwner, const IRECT& r, bool cacheable = false);
529
532 void ResumeLayer(ILayerPtr& layer);
533
537
541 bool CheckLayer(const ILayerPtr& layer);
542
546 void DrawLayer(const ILayerPtr& layer, const IBlend* pBlend = nullptr);
547
552 void DrawFittedLayer(const ILayerPtr& layer, const IRECT& bounds, const IBlend* pBlend);
553
557 void DrawRotatedLayer(const ILayerPtr& layer, double angle);
558
562 virtual void ApplyLayerDropShadow(ILayerPtr& layer, const IShadow& shadow);
563
568 virtual void GetLayerBitmapData(const ILayerPtr& layer, RawBitmapData& data) = 0;
569
570protected:
575 virtual void ApplyShadowMask(ILayerPtr& layer, RawBitmapData& mask, const IShadow& shadow) = 0;
576
578 virtual void UpdateLayer() {}
579
582 void PushLayer(ILayer* pLayer);
583
586 ILayer* PopLayer();
587
588#pragma mark - Drawing API path support
589public:
591 virtual void PathClear() = 0;
592
594 virtual void PathClose() = 0;
595
601 void PathLine(float x1, float y1, float x2, float y2)
602 {
603 PathMoveTo(x1, y1);
604 PathLineTo(x2, y2);
605 }
606
613 void PathRadialLine(float cx, float cy, float angle, float rMin, float rMax);
614
622 void PathTriangle(float x1, float y1, float x2, float y2, float x3, float y3);
623
626 void PathRect(const IRECT& bounds);
627
634 void PathRoundRect(const IRECT& bounds, float ctl, float ctr, float cbl, float cbr);
635
639 void PathRoundRect(const IRECT& bounds, float cornerRadius = 5.f);
640
647 virtual void PathArc(float cx, float cy, float r, float a1, float a2, EWinding winding = EWinding::CW) = 0;
648
653 void PathCircle(float cx, float cy, float r);
654
657 void PathEllipse(const IRECT& bounds);
658
665 void PathEllipse(float x, float y, float r1, float r2, float angle = 0.0);
666
671 void PathConvexPolygon(float* x, float* y, int nPoints);
672
676 virtual void PathMoveTo(float x, float y) = 0;
677
681 virtual void PathLineTo(float x, float y) = 0;
682
685 virtual void PathSetWinding(bool clockwise) {};
686
694 virtual void PathCubicBezierTo(float c1x, float c1y, float c2x, float c2y, float x2, float y2) = 0;
695
701 virtual void PathQuadraticBezierTo(float cx, float cy, float x2, float y2) = 0;
702
708 virtual void PathStroke(const IPattern& pattern, float thickness, const IStrokeOptions& options = IStrokeOptions(), const IBlend* pBlend = 0) = 0;
709
714 virtual void PathFill(const IPattern& pattern, const IFillOptions& options = IFillOptions(), const IBlend* pBlend = 0) = 0;
715
717 void PathTransformSave();
718
721
724 void PathTransformReset(bool clearStates = false);
725
729 void PathTransformTranslate(float x, float y);
730
734 void PathTransformScale(float x, float y);
735
738 void PathTransformScale(float scale);
739
742 void PathTransformRotate(float angle);
743
747 void PathTransformSkew(float xAngle, float yAngle);
748
751 void PathTransformMatrix(const IMatrix& matrix);
752
755 void PathClipRegion(const IRECT r = IRECT());
756
757 virtual void PathTransformSetMatrix(const IMatrix& matrix) = 0;
758
759 void DoTextRotation(const IText& text, const IRECT& bounds, const IRECT& rect)
760 {
761 if (!text.mAngle)
762 return;
763
764 IRECT rotated = rect;
765 double tx, ty;
766
767 CalculateTextRotation(text, bounds, rotated, tx, ty);
768 PathTransformTranslate(static_cast<float>(tx), static_cast<float>(ty));
769 PathTransformRotate(text.mAngle);
770 }
771
772private:
773 IPattern GetSVGPattern(const NSVGpaint& paint, float opacity);
774
775 void DoDrawSVG(const ISVG& svg, const IBlend* pBlend = nullptr, const IColor* pStrokeColor = nullptr, const IColor* pFillColor = nullptr);
776
779 void PrepareRegion(const IRECT& bounds)
780 {
781 PathTransformReset(true);
782 PathClear();
783 SetClipRegion(bounds);
784 mClipRECT = bounds;
785 }
786
789 virtual void CompleteRegion(const IRECT& bounds) {}
790
791 virtual void SetClipRegion(const IRECT& r) = 0;
792
793public:
794#pragma mark - Platform implementation
795
799 virtual void AttachPlatformView(const IRECT& r, void* pView) {};
800
803 virtual void RemovePlatformView(void* pView) {};
804
808 virtual void HidePlatformView(void* pView, bool hide) {};
809
813 virtual void GetMouseLocation(float& x, float&y) const = 0;
814
818 virtual void HideMouseCursor(bool hide = true, bool lock = true) = 0;
819
823 virtual void MoveMouseCursor(float x, float y) = 0;
824
828 virtual ECursor SetMouseCursor(ECursor cursorType = ECursor::ARROW)
829 {
830 ECursor oldCursorType = mCursorType;
831 mCursorType = cursorType;
832 return oldCursorType;
833 }
834
836 virtual void ForceEndUserEdit() = 0;
837
841 virtual void* OpenWindow(void* pParentWnd) = 0;
842
844 virtual void CloseWindow() = 0;
845
848 virtual void* GetWindow() = 0;
849
851 virtual bool WindowIsOpen() { return GetWindow(); }
852
856 virtual bool GetTextFromClipboard(WDL_String& str) = 0;
857
861 virtual bool SetTextInClipboard(const char* str) = 0;
862
866 virtual bool SetFilePathInClipboard(const char* path) { return false; }
867
872 virtual bool InitiateExternalFileDragDrop(const char* path, const IRECT& iconBounds) { return false; };
873
875 virtual void UpdateTooltips() = 0;
876
883 virtual EMsgBoxResult ShowMessageBox(const char* str, const char* title, EMsgBoxType type, IMsgBoxCompletionHandlerFunc completionHandler = nullptr) = 0;
884
891 virtual void PromptForFile(WDL_String& fileName, WDL_String& path, EFileAction action = EFileAction::Open, const char* ext = "", IFileDialogCompletionHandlerFunc completionHandler = nullptr) = 0;
892
896 virtual void PromptForDirectory(WDL_String& dir, IFileDialogCompletionHandlerFunc completionHandler = nullptr) = 0;
897
903 virtual bool PromptForColor(IColor& color, const char* str = "", IColorPickerHandlerFunc func = nullptr) = 0;
904
911 virtual bool OpenURL(const char* url, const char* msgWindowTitle = 0, const char* confirmMsg = 0, const char* errMsgOnFailure = 0) = 0;
912
914 virtual const char* GetPlatformAPIStr() { return ""; }
915
919 virtual bool RevealPathInExplorerOrFinder(WDL_String& path, bool select = false) { return false; }
920
923 virtual void SetWinModuleHandle(void* pHinstance) {}
924
926 virtual void* GetWinModuleHandle() { return nullptr; }
927
931 void SetPlatformContext(void* pContext) { mPlatformContext = pContext; }
932
935 void* GetPlatformContext() { return mPlatformContext; }
936
940 virtual void ClientToScreen(float& x, float& y) {};
941
946 virtual PlatformFontPtr LoadPlatformFont(const char* fontID, const char* fileNameOrResID) = 0;
947
953 virtual PlatformFontPtr LoadPlatformFont(const char* fontID, void* pData, int dataSize) = 0;
954
960 virtual PlatformFontPtr LoadPlatformFont(const char* fontID, const char* fontName, ETextStyle style) = 0;
961
965 virtual void CachePlatformFont(const char* fontID, const PlatformFontPtr& font) = 0;
966
968 virtual const char* GetBundleID() const { return ""; }
969
971 virtual const char* GetAppGroupID() const { return ""; }
972
973 // An RAII helper to manage the IGraphics GL context
975 {
976 public:
977 ScopedGLContext(IGraphics* pGraphics)
978 : mIGraphics(*pGraphics) { mIGraphics.ActivateGLContext(); }
979 ~ScopedGLContext() { mIGraphics.DeactivateGLContext(); }
980 private:
981 IGraphics& mIGraphics;
982 };
983
984protected:
985 /* Activate the context for the view (GL only) */
986 virtual void ActivateGLContext() {};
987
988 /* Deactivate the context for the view (GL only) */
989 virtual void DeactivateGLContext() {};
990
997 virtual void CreatePlatformTextEntry(int paramIdx, const IText& text, const IRECT& bounds, int length, const char* str) = 0;
998
1004 virtual IPopupMenu* CreatePlatformPopupMenu(IPopupMenu& menu, const IRECT bounds, bool& isAsync) = 0;
1005
1006#pragma mark - Base implementation
1007public:
1008 IGraphics(IGEditorDelegate& dlg, int w, int h, int fps = DEFAULT_FPS, float scale = 1.);
1009
1010 virtual ~IGraphics();
1011
1012 IGraphics(const IGraphics&) = delete;
1013 IGraphics& operator=(const IGraphics&) = delete;
1014
1017 void SetScreenScale(float scale);
1018
1020 void SetTranslation(float x, float y) { mXTranslation = x; mYTranslation = y; }
1021
1025 bool IsDirty(IRECTList& rects);
1026
1029 void Draw(IRECTList& rects);
1030
1035 void PromptUserInput(IControl& control, const IRECT& bounds, int valIdx = 0);
1036
1042 void CreatePopupMenu(IControl& control, IPopupMenu& menu, const IRECT& bounds, int valIdx = 0);
1043
1049 void CreatePopupMenu(IControl& control, IPopupMenu& menu, float x, float y, int valIdx = 0)
1050 {
1051 return CreatePopupMenu(control, menu, IRECT(x, y, x, y), valIdx);
1052 }
1053
1060 void CreateTextEntry(IControl& control, const IText& text, const IRECT& bounds, const char* str = "", int valIdx = 0);
1061
1064 void SetControlValueAfterTextEdit(const char* str);
1065
1069
1073 void DeleteFromPopupMenu(IPopupMenu* pMenu, int itemIdx);
1074
1078 void SetScaleConstraints(float lo, float hi);
1079
1086 void Resize(int w, int h, float scale, bool needsPlatformResize = true);
1087
1090 void SetStrictDrawing(bool strict);
1091
1092 /* Enables layout on resize. This means IGEditorDelegate:LayoutUI() will be called when the GUI is resized */
1093 void SetLayoutOnResize(bool layoutOnResize);
1094
1097 int Width() const { return mWidth; }
1098
1101 int Height() const { return mHeight; }
1102
1105 int WindowWidth() const { return static_cast<int>(static_cast<float>(mWidth) * mDrawScale); }
1106
1109 int WindowHeight() const { return static_cast<int>(static_cast<float>(mHeight) * mDrawScale); }
1110
1113 int FPS() const { return mFPS; }
1114
1117 float GetDrawScale() const { return mDrawScale; }
1118
1121 float GetScreenScale() const { return mScreenScale; }
1122
1125 int GetRoundedScreenScale() const { return static_cast<int>(std::ceil(GetScreenScale())); }
1126
1129 float GetTotalScale() const { return mDrawScale * mScreenScale; }
1130
1135
1138 IGEditorDelegate* GetDelegate() { return mDelegate; }
1139
1141 IPopupMenu& GetPromptMenu() { return mPromptPopupMenu; }
1142
1144 bool IsInPlatformTextEntry() { return mInTextEntry != nullptr && !mTextEntryControl; }
1145
1147 IControl* GetControlInTextEntry() { return mInTextEntry; }
1148
1150 void ClearInTextEntryControl() { mInTextEntry = nullptr; }
1151
1153 inline bool TooltipsEnabled() const { return mEnableTooltips; }
1154
1156 EUIResizerMode GetResizerMode() const { return mGUISizeMode; }
1157
1159 bool GetResizingInProcess() const { return mResizingInProcess; }
1160
1163 bool EnableMultiTouch(bool enable)
1164 {
1166 {
1167 mEnableMultiTouch = enable;
1168 return true;
1169 }
1170 else
1171 mEnableMultiTouch = false;
1172
1173 return false;
1174 }
1175
1177 bool MultiTouchEnabled() const { return mEnableMultiTouch; }
1178
1180 virtual bool PlatformSupportsMultiTouch() const { return false; }
1181
1183 void EnableTooltips(bool enable);
1184
1187
1189 inline void ShowControlBounds(bool enable) { mShowControlBounds = enable; SetAllControlsDirty(); }
1190
1192 inline void ShowAreaDrawn(bool enable) { mShowAreaDrawn = enable; if(!enable) SetAllControlsDirty(); }
1193
1195 bool ShowAreaDrawnEnabled() const { return mShowAreaDrawn; }
1196
1198 bool ShowControlBoundsEnabled() const { return mShowControlBounds; }
1199
1202 void EnableLiveEdit(bool enable);
1203
1205 bool LiveEditEnabled() const { return mLiveEdit != nullptr; }
1206
1210 IRECT GetBounds() const { return IRECT(0.f, 0.f, (float) Width(), (float) Height()); }
1211
1214 void SetDisplayTickFunc(IDisplayTickFunc func) { mDisplayTickFunc = func; }
1215
1218 void SetUIAppearanceChangedFunc(IUIAppearanceChangedFunc func) { mAppearanceChangedFunc = func; }
1219
1222 void SetKeyHandlerFunc(IKeyHandlerFunc func) { mKeyHandlerFunc = func; }
1223
1226 void SetQwertyMidiKeyHandlerFunc(std::function<void(const IMidiMsg& msg)> func = nullptr);
1227
1229 bool RespondsToGesture(float x, float y);
1230
1232 void OnGestureRecognized(const IGestureInfo& info);
1233
1236 virtual float GetPlatformWindowScale() const { return 1.f; }
1237
1238private:
1239
1241 virtual void PlatformResize(bool parentHasResized) {}
1242
1244 virtual void DrawResize() {}
1245
1249 void Draw(const IRECT& bounds, float scale);
1250
1255 void DrawControl(IControl* pControl, const IRECT& bounds, float scale);
1256
1263 void DoCreatePopupMenu(IControl& control, IPopupMenu& menu, const IRECT& bounds, int valIdx, bool isContext);
1264
1266 void StartDragResize() { mResizingInProcess = true; }
1267
1269 void EndDragResize();
1270
1271#pragma mark - Control management
1272public:
1275 void ForAllControlsFunc(IControlFunction func);
1276
1280 template<typename T, typename... Args>
1281 void ForAllControls(T method, Args... args);
1282
1285 void ForStandardControlsFunc(IControlFunction func);
1286
1291 template<typename T, typename... Args>
1292 void ForMatchingControls(T method, int paramIdx, Args... args);
1293
1297 void ForControlWithParam(int paramIdx, IControlFunction func);
1298
1302 void ForControlWithParam(const std::initializer_list<int>& params, IControlFunction func);
1303
1307 void ForControlInGroup(const char* group, IControlFunction func);
1308
1311 void AttachBackground(const char* fileName);
1312
1315 void AttachSVGBackground(const char* fileName);
1316
1319 void AttachPanelBackground(const IPattern& color);
1320
1323 void AttachCornerResizer(EUIResizerMode sizeMode = EUIResizerMode::Scale, bool layoutOnResize = false, const IColor& color = COLOR_TRANSLUCENT, const IColor& mouseOverColor = COLOR_BLACK, const IColor& dragColor = COLOR_BLACK, float size = 20.f);
1324
1328 void AttachCornerResizer(ICornerResizerControl* pControl, EUIResizerMode sizeMode = EUIResizerMode::Scale, bool layoutOnResize = false);
1329
1333 void AttachPopupMenuControl(const IText& text = DEFAULT_TEXT, const IRECT& bounds = IRECT());
1334
1337
1340
1343
1345 void AttachBubbleControl(const IText& text = DEFAULT_TEXT);
1346
1348 void AttachBubbleControl(IBubbleControl* pControl);
1349
1350 /* Called by controls to display text in the bubble control */
1351 void ShowBubbleControl(IControl* pCaller, float x, float y, const char* str, EDirection dir = EDirection::Horizontal, IRECT minimumContentBounds = IRECT());
1352
1353 /* Sets the region of the IGraphics context that should be used for the FPS display */
1354 void SetFPSDisplayBounds(const IRECT& bounds) { mPerfDisplayBounds = bounds; }
1355
1358 void ShowFPSDisplay(bool enable);
1359
1361 bool ShowingFPSDisplay() { return mPerfDisplay != nullptr; }
1362
1368 IControl* AttachControl(IControl* pControl, int ctrlTag = kNoTag, const char* group = "");
1369
1373 IControl* GetControl(int idx) { return mControls.Get(idx); }
1374
1378 int GetControlIdx(IControl* pControl) const { return mControls.Find(pControl); }
1379
1383 int GetIdxOfTaggedControl(int ctrlTag) const
1384 {
1385 IControl* pControl = GetControlWithTag(ctrlTag);
1386 return pControl ? GetControlIdx(pControl) : -1;
1387 }
1388
1392 IControl* GetControlWithTag(int ctrlTag) const;
1393
1397 int GetControlTag(const IControl* pControl) const
1398 {
1399 for (auto itr = mCtrlTags.begin(); itr != mCtrlTags.end(); ++itr)
1400 {
1401 if (itr->second == pControl)
1402 return itr->first;
1403 }
1404
1405 return kNoTag;
1406 }
1407
1411 IControl* GetControlWithParamIdx(int paramIdx);
1412
1414 bool ControlIsCaptured() const { return mCapturedMap.size() > 0; }
1415
1418 bool ControlIsCaptured(IControl* pControl) const
1419 {
1420 return std::find_if(std::begin(mCapturedMap), std::end(mCapturedMap), [pControl](auto&& press) { return press.second == pControl; }) != mCapturedMap.end();
1421 }
1422
1424 void GetTouches(IControl* pControl, std::vector<ITouchID>& touchesOnThisControl) const
1425 {
1426 for (auto i = mCapturedMap.begin(), j = mCapturedMap.end(); i != j; ++i)
1427 if (i->second == pControl)
1428 touchesOnThisControl.push_back(i->first);
1429 }
1430
1431 /* Get the first control in the control list, the background */
1432 IControl* GetBackgroundControl() { return GetControl(0); }
1433
1435 IPopupMenuControl* GetPopupMenuControl() { return mPopupControl.get(); }
1436
1438 ITextEntryControl* GetTextEntryControl() { return mTextEntryControl.get(); }
1439
1441 IBubbleControl* GetBubbleControl(int i = 0) { return mBubbleControls.Get(i); }
1442
1444 int NBubbleControls() const { return mBubbleControls.GetSize(); }
1445
1448 void StyleAllVectorControls(const IVStyle& style);
1449
1453 void UpdatePeers(IControl* pCaller, int callerValIdx);
1454
1456 int NControls() const { return mControls.GetSize(); }
1457
1459 void RemoveControlWithTag(int ctrlTag);
1460
1462 void RemoveControls(int fromIdx);
1463
1465 void RemoveControl(int idx);
1466
1468 void RemoveControl(IControl* pControl);
1469
1471 void RemoveAllControls();
1472
1476 void HideControl(int paramIdx, bool hide);
1477
1481 void DisableControl(int paramIdx, bool diable);
1482
1484 void SetAllControlsDirty();
1485
1487 void SetAllControlsClean();
1488
1493 void SetControlPosition(IControl* pControl, float x, float y);
1494
1499 void SetControlSize(IControl* pControl, float w, float h);
1500
1504 void SetControlBounds(IControl* pControl, const IRECT& r);
1505
1506private:
1512 int GetMouseControlIdx(float x, float y, bool mouseOver = false);
1513
1521 IControl* GetMouseControl(float x, float y, bool capture, bool mouseOver = false, ITouchID touchID = 0);
1522
1523#pragma mark - Event handling
1524public:
1526 void OnMouseDown(const std::vector<IMouseInfo>& points);
1527
1529 void OnMouseUp(const std::vector<IMouseInfo>& points);
1530
1532 void OnMouseDrag(const std::vector<IMouseInfo>& points);
1533
1535 void OnTouchCancelled(const std::vector<IMouseInfo>& points);
1536
1541 bool OnMouseDblClick(float x, float y, const IMouseMod& mod);
1542
1548 bool OnMouseWheel(float x, float y, const IMouseMod& mod, float delta);
1549
1554 bool OnKeyDown(float x, float y, const IKeyPress& key);
1555
1560 bool OnKeyUp(float x, float y, const IKeyPress& key);
1561
1566 bool OnMouseOver(float x, float y, const IMouseMod& mod);
1567
1569 void OnMouseOut();
1570
1572 void OnSetCursor() { SetMouseCursor(mCursorType); }
1573
1577 void OnDrop(const char* str, float x, float y);
1578
1582 void OnDropMultiple(const std::vector<const char*>& paths, float x, float y);
1583
1585 void OnGUIIdle();
1586
1588 void OnDragResize(float x, float y);
1589
1592 void OnAppearanceChanged(EUIAppearance appearance);
1593
1596 virtual EUIAppearance GetUIAppearance() const { return EUIAppearance::Light; }
1597
1599 void EnableMouseOver(bool enable) { mEnableMouseOver = enable; }
1600
1602 void ReleaseMouseCapture();
1603
1605 bool MouseOverEnabled() const { return mEnableMouseOver; }
1606
1608 inline int GetMouseOver() const { return mMouseOverIdx; }
1609
1613 void GetMouseDownPoint(float& x, float&y) const { x = mMouseDownX; y = mMouseDownY; }
1614
1617 void SetTabletInput(bool tablet) { mTabletInput = tablet; }
1618#pragma mark - Plug-in API Specific
1619
1625 int GetParamIdxForPTAutomation(float x, float y);
1626
1630
1635 void SetPTParameterHighlight(int paramIdx, bool isHighlighted, int color);
1636
1643 void PopupHostContextMenuForParam(int controlIdx, int paramIdx, float x, float y);
1644
1651 void PopupHostContextMenuForParam(IControl* pControl, int paramIdx, float x, float y);
1652
1653#pragma mark - Resource/File Loading
1654
1656 const char* GetSharedResourcesSubPath() const { return mSharedResourcesSubPath.Get(); }
1657
1659 void SetSharedResourcesSubPath(const char* sharedResourcesSubPath) { mSharedResourcesSubPath.Set(sharedResourcesSubPath); }
1660
1667 virtual IBitmap LoadBitmap(const char* fileNameOrResID, int nStates = 1, bool framesAreHorizontal = false, int targetScale = 0);
1668
1677 virtual IBitmap LoadBitmap(const char *name, const void* pData, int dataSize, int nStates = 1, bool framesAreHorizontal = false, int targetScale = 0);
1678
1682 virtual ISVG LoadSVG(const char* fileNameOrResID, const char* units = "px", float dpi = 72.f);
1683
1691 virtual ISVG LoadSVG(const char* name, const void* pData, int dataSize, const char* units = "px", float dpi = 72.f);
1692
1697 virtual WDL_TypedBuf<uint8_t> LoadResource(const char* fileNameOrResID, const char* fileType);
1698
1701 virtual void AttachGestureRecognizer(EGestureType type);
1702
1707 void AttachGestureRecognizerToRegion(const IRECT& bounds, EGestureType type, IGestureFunc func);
1708
1710 void ClearGestureRegions();
1711
1712protected:
1719 virtual APIBitmap* LoadAPIBitmap(const char* fileNameOrResID, int scale, EResourceLocation location, const char* ext) = 0;
1720
1727 virtual APIBitmap* LoadAPIBitmap(const char* name, const void* pData, int dataSize, int scale) = 0;
1728
1736 virtual APIBitmap* CreateAPIBitmap(int width, int height, float scale, double drawScale, bool cacheable = false) = 0;
1737
1742 virtual bool LoadAPIFont(const char* fontID, const PlatformFontPtr& font) = 0;
1743
1745 virtual bool AssetsLoaded() { return true; }
1746
1748 virtual int AlphaChannel() const = 0;
1749
1751 virtual bool FlippedBitmap() const = 0;
1752
1760 EResourceLocation SearchImageResource(const char* fileName, const char* type, WDL_String& result, int targetScale, int& sourceScale);
1761
1767 APIBitmap* SearchBitmapInCache(const char* fileName, int targetScale, int& sourceScale);
1768
1774 virtual float DoMeasureText(const IText& text, const char* str, IRECT& bounds) const = 0;
1775
1781 virtual void DoDrawText(const IText& text, const char* str, const IRECT& bounds, const IBlend* pBlend = nullptr) = 0;
1782
1787 void DoMeasureTextRotation(const IText& text, const IRECT& bounds, IRECT& rect) const;
1788
1795 void CalculateTextRotation(const IText& text, const IRECT& bounds, IRECT& rect, double& tx, double& ty) const;
1796
1798 virtual float GetBackingPixelScale() const { return GetScreenScale() * GetDrawScale(); };
1799
1800 IMatrix GetTransformMatrix() const { return mTransform; }
1801#pragma mark -
1802
1803private:
1804 void ClearMouseOver()
1805 {
1806 mMouseOver = nullptr;
1807 mMouseOverIdx = -1;
1808 }
1809
1810 WDL_PtrList<IControl> mControls;
1811 std::unordered_map<int, IControl*> mCtrlTags;
1812
1813 // Order (front-to-back) ToolTip / PopUp / TextEntry / LiveEdit / Corner / PerfDisplay
1814 std::unique_ptr<ICornerResizerControl> mCornerResizer;
1815 WDL_PtrList<IBubbleControl> mBubbleControls;
1816 std::unique_ptr<IPopupMenuControl> mPopupControl;
1817 std::unique_ptr<IFPSDisplayControl> mPerfDisplay;
1818 std::unique_ptr<ITextEntryControl> mTextEntryControl;
1819 std::unique_ptr<IControl> mLiveEdit;
1820
1821 IPopupMenu mPromptPopupMenu;
1822
1823 IRECT mPerfDisplayBounds;
1824
1825 WDL_String mSharedResourcesSubPath;
1826
1827 ECursor mCursorType = ECursor::ARROW;
1828 int mWidth;
1829 int mHeight;
1830 int mFPS;
1831 float mScreenScale = 1.f; // the scaling of the display that the UI is currently on e.g. 2 for retina
1832 float mDrawScale = 1.f; // scale deviation from default width and height i.e stretching the UI by dragging bottom right hand corner
1833
1834 int mIdleTicks = 0;
1835
1836 std::vector<EGestureType> mRegisteredGestures; // All the types of gesture registered with the graphics context
1837 IRECTList mGestureRegions; // Rectangular regions linked to gestures (excluding IControls)
1838 std::unordered_map<int, IGestureFunc> mGestureRegionFuncs; // Map of gesture region index to gesture function
1839 std::unordered_map<ITouchID, IControl*> mCapturedMap; // associative array of touch ids to control pointers, the same control can be touched multiple times
1840 IControl* mMouseOver = nullptr;
1841 IControl* mInTextEntry = nullptr;
1842 IControl* mInPopupMenu = nullptr;
1843 void* mPlatformContext = nullptr;
1844 bool mIsContextMenu = false;
1845 int mTextEntryValIdx = kNoValIdx;
1846 int mPopupMenuValIdx = kNoValIdx;
1847 int mMouseOverIdx = -1;
1848 float mMouseDownX = -1.f;
1849 float mMouseDownY = -1.f;
1850 float mMinScale;
1851 float mMaxScale;
1852 int mLastClickedParam = kNoParameter;
1853 bool mEnableMouseOver = false;
1854 bool mStrict = false;
1855 bool mEnableTooltips = false;
1856 bool mShowControlBounds = false;
1857 bool mShowAreaDrawn = false;
1858 bool mResizingInProcess = false;
1859 bool mLayoutOnResize = false;
1860 bool mEnableMultiTouch = false;
1861 EUIResizerMode mGUISizeMode = EUIResizerMode::Scale;
1862 double mPrevTimestamp = 0.;
1863 IKeyHandlerFunc mKeyHandlerFunc = nullptr;
1864 IDisplayTickFunc mDisplayTickFunc = nullptr;
1865 IUIAppearanceChangedFunc mAppearanceChangedFunc = nullptr;
1866
1867protected:
1868 IGEditorDelegate* mDelegate;
1869 bool mCursorHidden = false;
1870 bool mCursorLock = false;
1871 bool mTabletInput = false;
1872 float mCursorX = -1.f;
1873 float mCursorY = -1.f;
1874 float mXTranslation = 0.f;
1875 float mYTranslation = 0.f;
1876
1877 friend class IGraphicsLiveEdit;
1878 friend class ICornerResizerControl;
1879 friend class ITextEntryControl;
1880
1881 std::stack<ILayer*> mLayers;
1882
1883 IRECT mClipRECT;
1884 IMatrix mTransform;
1885 std::stack<IMatrix> mTransformStates;
1886};
1887
1888END_IGRAPHICS_NAMESPACE
1889END_IPLUG_NAMESPACE
IPlug Constant definitions, Types, magic numbers.
IPlug logging a.k.a tracing functionality.
Common paths useful for plug-ins.
A base class interface for a bitmap abstraction around the different drawing back end bitmap represen...
User-facing bitmap abstraction that you use to manage bitmap data, independant of draw class/platform...
A special control to draw contextual info as a slider etc is moved If used in the main IControl stack...
The lowest level base class of an IGraphics control.
Definition: IControl.h:49
A control for resizing the plug-in window by clicking and dragging in the bottom right-hand corner Th...
Performance display meter, based on code from NanoVG This is a special control that lives outside the...
An editor delegate base class that uses IGraphics for the UI.
The lowest level base class of an IGraphics context.
Definition: IGraphics.h:86
bool ControlIsCaptured() const
Check to see if any control is captured.
Definition: IGraphics.h:1414
void EnableTooltips(bool enable)
Definition: IGraphics.cpp:1543
void CreatePopupMenu(IControl &control, IPopupMenu &menu, float x, float y, int valIdx=0)
Shows a pop up/contextual menu at point.
Definition: IGraphics.h:1049
virtual float DoMeasureText(const IText &text, const char *str, IRECT &bounds) const =0
virtual bool SetFilePathInClipboard(const char *path)
Set a file path in the clipboard.
Definition: IGraphics.h:866
virtual void ClientToScreen(float &x, float &y)
Convert an x, y position in the view to screen coordinates.
Definition: IGraphics.h:940
void Resize(int w, int h, float scale, bool needsPlatformResize=true)
Definition: IGraphics.cpp:90
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.
Definition: IGraphics.cpp:2815
virtual void DrawRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
Draw a rectangle to the graphics context.
Definition: IGraphics.cpp:2515
virtual bool PlatformSupportsMultiTouch() const
Definition: IGraphics.h:1180
virtual void FillEllipse(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0)
Fill an ellipse within a rectangular region of the graphics context.
Definition: IGraphics.cpp:2631
ILayer * PopLayer()
Pop a layer off the stack.
Definition: IGraphics.cpp:2032
virtual void DrawConvexPolygon(const IColor &color, float *x, float *y, int nPoints, const IBlend *pBlend=0, float thickness=1.f)
Draw a convex polygon to the graphics context.
Definition: IGraphics.cpp:2536
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 DrawEllipse(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
Draw an ellipse within a rectangular region of the graphics context.
Definition: IGraphics.cpp:2566
virtual PlatformFontPtr LoadPlatformFont(const char *fontID, const char *fontName, ETextStyle style)=0
Load a system font in a platform format.
virtual void DrawFittedBitmap(const IBitmap &bitmap, const IRECT &bounds, const IBlend *pBlend=0)
Draw a bitmap (raster) image to the graphics context, scaling the image to fit the bounds.
Definition: IGraphics.cpp:2792
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.
Definition: IGraphics.cpp:727
void AttachPopupMenuControl(const IText &text=DEFAULT_TEXT, const IRECT &bounds=IRECT())
Attach a control for pop-up menus, to override platform style menus.
Definition: IGraphics.cpp:364
virtual void DrawPoint(const IColor &color, float x, float y, const IBlend *pBlend=0)
Fill a rectangle corresponding to a pixel on a 1:1 screen with a color.
Definition: IGraphics.cpp:2429
void RemoveControl(int idx)
Remove a control at a particular index, (frees memory).
Definition: IGraphics.cpp:167
void DeleteFromPopupMenu(IPopupMenu *pMenu, int itemIdx)
Called by IOS platform (or other supported platforms) in order to update a control with a deletion in...
Definition: IGraphics.cpp:280
virtual const char * GetBundleID() const
Get the bundle ID on macOS and iOS, returns emtpy string on other OSs.
Definition: IGraphics.h:968
void PathConvexPolygon(float *x, float *y, int nPoints)
Add a convex polygon to the current path.
Definition: IGraphics.cpp:2713
virtual void PathFill(const IPattern &pattern, const IFillOptions &options=IFillOptions(), const IBlend *pBlend=0)=0
Fill the current current path.
void SetTabletInput(bool tablet)
Set by the platform class if the mouse input is coming from a tablet/stylus.
Definition: IGraphics.h:1617
virtual float GetPlatformWindowScale() const
Returns a scaling factor for resizing parent windows via the host/plugin API.
Definition: IGraphics.h:1236
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.
Definition: IGraphics.cpp:683
float GetTotalScale() const
Gets the combined draw and screen/display scaling factor.
Definition: IGraphics.h:1129
int GetParamIdxForPTAutomation(float x, float y)
[AAX only] This can be called by the ProTools API class (e.g.
Definition: IGraphics.cpp:1398
virtual IColor GetPoint(int x, int y)=0
Get the color at an X, Y location in the graphics context.
void CreatePopupMenu(IControl &control, IPopupMenu &menu, const IRECT &bounds, int valIdx=0)
Shows a pop up/contextual menu in relation to a rectangular region of the graphics context.
Definition: IGraphics.cpp:1976
void CreateTextEntry(IControl &control, const IText &text, const IRECT &bounds, const char *str="", int valIdx=0)
Create a text entry box.
Definition: IGraphics.cpp:1939
virtual void PathClear()=0
Clear the stack of path drawing commands.
virtual bool InitiateExternalFileDragDrop(const char *path, const IRECT &iconBounds)
Initiate an drag-n-drop operation of an existing file, to be dropped outside of the current window.
Definition: IGraphics.h:872
virtual void MoveMouseCursor(float x, float y)=0
Force move the mouse cursor to a specific position.
virtual void * GetDrawContext()=0
Gets a void pointer to underlying drawing context, for the IGraphics backend See draw class implement...
virtual PlatformFontPtr LoadPlatformFont(const char *fontID, void *pData, int dataSize)=0
Load a font from data in memory.
void PathRoundRect(const IRECT &bounds, float ctl, float ctr, float cbl, float cbr)
Add a rounded rectangle to the current path, with independent corner roundness.
Definition: IGraphics.cpp:2662
void SetPTParameterHighlight(int paramIdx, bool isHighlighted, int color)
[AAX only] See AAX_CEffectGUI::SetControlHighlightInfo()
Definition: IGraphics.cpp:1412
virtual void PathClose()=0
Close the path that is being specified.
void PathTransformTranslate(float x, float y)
Apply a translation transform to the current path.
Definition: IGraphics.cpp:2748
void ClearInTextEntryControl()
Called when the text entry is dismissed, to reset mInTextEntry.
Definition: IGraphics.h:1150
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.
Definition: IGraphics.cpp:824
void PathRect(const IRECT &bounds)
Add a rectangle to the current path.
Definition: IGraphics.cpp:2653
virtual void RetainBitmap(const IBitmap &bitmap, const char *cacheName)
Adds an IBitmap to the cache/static storage.
Definition: IGraphics.cpp:1856
virtual void * GetWindow()=0
Get a pointer to the platform view e.g.
void ForMatchingControls(T method, int paramIdx, Args... args)
For all standard controls in the main control stack that are linked to a specific parameter,...
Definition: IGraphics.cpp:590
virtual void AttachPlatformView(const IRECT &r, void *pView)
Add an OS view as a sub-view, on top of the IGraphics view.
Definition: IGraphics.h:799
virtual void CreatePlatformTextEntry(int paramIdx, const IText &text, const IRECT &bounds, int length, const char *str)=0
Creates a platform native text entry field.
void ResumeLayer(ILayerPtr &layer)
If a layer already exists, continue drawing to it.
Definition: IGraphics.cpp:2005
ITextEntryControl * GetTextEntryControl()
Definition: IGraphics.h:1438
void PathTransformMatrix(const IMatrix &matrix)
Apply an arbitary affine transform matrix to the current path.
Definition: IGraphics.cpp:2777
void DrawRotatedLayer(const ILayerPtr &layer, double angle)
Draw a layer to the main IGraphics context, with rotation.
Definition: IGraphics.cpp:2083
virtual const char * GetAppGroupID() const
Get the app group ID on macOS and iOS, returns emtpy string on other OSs.
Definition: IGraphics.h:971
int FPS() const
Gets the drawing frame rate.
Definition: IGraphics.h:1113
void PathTransformScale(float x, float y)
Apply a scale transform to the current path, with independant x, y scales.
Definition: IGraphics.cpp:2754
virtual ECursor SetMouseCursor(ECursor cursorType=ECursor::ARROW)
Sets the mouse cursor to one of ECursor (implementations should return the result of the base impleme...
Definition: IGraphics.h:828
void PathLine(float x1, float y1, float x2, float y2)
Add a line to the current path.
Definition: IGraphics.h:601
virtual void DrawDottedRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f, float dashLen=2.f)
Draw a dotted rectangle to the graphics context.
Definition: IGraphics.cpp:2557
IControl * GetControlWithTag(int ctrlTag) const
Get the control with a particular tag.
Definition: IGraphics.cpp:461
virtual void PathSetWinding(bool clockwise)
NanoVG only.
Definition: IGraphics.h:685
virtual bool SetTextInClipboard(const char *str)=0
Set text in the clipboard.
virtual void HidePlatformView(void *pView, bool hide)
Hide a previously attached platform view from the IGraphics view.
Definition: IGraphics.h:808
void OnMouseDrag(const std::vector< IMouseInfo > &points)
Called when the platform class sends drag events.
Definition: IGraphics.cpp:1168
virtual void ReleaseBitmap(const IBitmap &bitmap)
Releases an IBitmap from the cache/static storage.
Definition: IGraphics.cpp:1850
void ShowControlBounds(bool enable)
Definition: IGraphics.h:1189
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.
Definition: IGraphics.cpp:2522
void SetUIAppearanceChangedFunc(IUIAppearanceChangedFunc func)
Sets a function that is called when the OS appearance (light/dark mode) is changed.
Definition: IGraphics.h:1218
void OnMouseOut()
Called when the mouse leaves the graphics context.
Definition: IGraphics.cpp:1158
void UpdatePeers(IControl *pCaller, int callerValIdx)
This method is called after interacting with a control, so that any other controls linked to the same...
Definition: IGraphics.cpp:616
void RemovePopupMenuControl()
Remove the IGraphics popup menu, use platform popup menu if available.
Definition: IGraphics.cpp:373
virtual float GetBackingPixelScale() const
Definition: IGraphics.h:1798
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.
Definition: IGraphics.cpp:2417
bool OnKeyDown(float x, float y, const IKeyPress &key)
Definition: IGraphics.cpp:1246
virtual int AlphaChannel() const =0
void AttachGestureRecognizerToRegion(const IRECT &bounds, EGestureType type, IGestureFunc func)
Attach a gesture recognizer to a rectangular region of the GUI, i.e.
Definition: IGraphics.cpp:2404
bool MultiTouchEnabled() const
Definition: IGraphics.h:1177
virtual const char * GetDrawingAPIStr()=0
int Width() const
Gets the width of the graphics context.
Definition: IGraphics.h:1097
virtual void SetWinModuleHandle(void *pHinstance)
Used on Windows to set the HINSTANCE module handle, which allows graphics APIs to load resources from...
Definition: IGraphics.h:923
virtual void EndFrame()
Called by some drawing API classes to finally blit the draw bitmap onto the screen or perform other c...
Definition: IGraphics.h:100
void DisableControl(int paramIdx, bool diable)
Disable or enable controls linked to a specific parameter.
Definition: IGraphics.cpp:496
virtual bool GetTextFromClipboard(WDL_String &str)=0
Get text from the clipboard.
void SetControlBounds(IControl *pControl, const IRECT &r)
Set a controls target and draw rect to r, redrawing the interface correctly.
Definition: IGraphics.cpp:228
void PathTriangle(float x1, float y1, float x2, float y2, float x3, float y3)
Add a triangle to the current path.
Definition: IGraphics.cpp:2645
void DoMeasureTextRotation(const IText &text, const IRECT &bounds, IRECT &rect) const
Definition: IGraphics.cpp:2245
void AttachTextEntryControl()
Attach a control for text entry, to override platform text entry.
Definition: IGraphics.cpp:378
void AttachCornerResizer(EUIResizerMode sizeMode=EUIResizerMode::Scale, bool layoutOnResize=false, const IColor &color=COLOR_TRANSLUCENT, const IColor &mouseOverColor=COLOR_BLACK, const IColor &dragColor=COLOR_BLACK, float size=20.f)
Attach the default control to scale or increase the UI size by dragging the plug-in bottom right-hand...
Definition: IGraphics.cpp:328
virtual void AttachGestureRecognizer(EGestureType type)
Registers a gesture recognizer with the graphics context.
Definition: IGraphics.cpp:2396
virtual APIBitmap * CreateAPIBitmap(int width, int height, float scale, double drawScale, bool cacheable=false)=0
Creates a new API bitmap, either in memory or as a GPU texture.
void OnMouseUp(const std::vector< IMouseInfo > &points)
Called when the platform class sends mouse up events.
Definition: IGraphics.cpp:1070
void PathTransformReset(bool clearStates=false)
Reset the affine transform of the current path, to the default state.
Definition: IGraphics.cpp:2736
void OnAppearanceChanged(EUIAppearance appearance)
Called by the platform class if the view changes to dark/light mode.
Definition: IGraphics.cpp:1530
virtual void * OpenWindow(void *pParentWnd)=0
Open a new platform view for this graphics context.
virtual void PromptForDirectory(WDL_String &dir, IFileDialogCompletionHandlerFunc completionHandler=nullptr)=0
Create a platform file prompt dialog to choose a directory path for opening/saving a directory.
void CalculateTextRotation(const IText &text, const IRECT &bounds, IRECT &rect, double &tx, double &ty) const
Definition: IGraphics.cpp:2253
bool IsInPlatformTextEntry()
Definition: IGraphics.h:1144
void SetTranslation(float x, float y)
Called by some platform IGraphics classes in order to translate the graphics context,...
Definition: IGraphics.h:1020
int GetIdxOfTaggedControl(int ctrlTag) const
Gets the index of a tagged control.
Definition: IGraphics.h:1383
virtual bool AssetsLoaded()
Specialized in IGraphicsCanvas drawing backend.
Definition: IGraphics.h:1745
virtual void PathStroke(const IPattern &pattern, float thickness, const IStrokeOptions &options=IStrokeOptions(), const IBlend *pBlend=0)=0
Stroke the current current path.
bool CheckLayer(const ILayerPtr &layer)
Test to see if a layer needs drawing, for instance if the control's bounds were changed.
Definition: IGraphics.cpp:2050
int WindowWidth() const
Gets the width of the graphics context including draw scaling.
Definition: IGraphics.h:1105
void Draw(IRECTList &rects)
Called by the platform class indicating a number of rectangles in the UI that need to redraw.
Definition: IGraphics.cpp:951
EResourceLocation SearchImageResource(const char *fileName, const char *type, WDL_String &result, int targetScale, int &sourceScale)
Search for a bitmap image resource matching the target scale.
Definition: IGraphics.cpp:1892
IControl * GetControlWithParamIdx(int paramIdx)
Get the first control with a parameter index that matches paramIdx.
Definition: IGraphics.cpp:476
virtual void OnViewDestroyed()
Called after a platform view is destroyed, so that drawing classes can e.g.
Definition: IGraphics.h:97
virtual void ApplyShadowMask(ILayerPtr &layer, RawBitmapData &mask, const IShadow &shadow)=0
Implemented by a graphics backend to apply a calculated shadow mask to a layer, according to the shad...
void EnableLiveEdit(bool enable)
Live edit mode allows you to relocate controls at runtime in debug builds.
Definition: IGraphics.cpp:1549
void PathTransformRestore()
Restore the affine transform of the current path, to the previously saved state.
Definition: IGraphics.cpp:2726
void SetControlValueAfterPopupMenu(IPopupMenu *pMenu)
Called by PopupMenuControl in order to update a control with a new value after returning from the non...
Definition: IGraphics.cpp:255
void DrawLayer(const ILayerPtr &layer, const IBlend *pBlend=nullptr)
Draw a layer to the main IGraphics context.
Definition: IGraphics.cpp:2063
void PushLayer(ILayer *pLayer)
Push a layer on to the stack.
Definition: IGraphics.cpp:2023
void ReleaseMouseCapture()
Used to tell the graphics context to stop tracking mouse interaction with a control.
Definition: IGraphics.cpp:1294
IRECT GetPixelSnapped(IRECT &r) const
Gets the nearest backing pixel aligned rect to the input IRECT.
Definition: IGraphics.h:1134
int GetLastClickedParamForPTAutomation()
[AAX only]
Definition: IGraphics.cpp:1405
void ForControlWithParam(int paramIdx, IControlFunction func)
For all standard controls in the main control stack that are linked to a specific parameter,...
Definition: IGraphics.cpp:501
bool ShowAreaDrawnEnabled() const
Definition: IGraphics.h:1195
void AttachBubbleControl(const IText &text=DEFAULT_TEXT)
Attach the default control to show text as a control changes.
Definition: IGraphics.cpp:352
IBubbleControl * GetBubbleControl(int i=0)
Definition: IGraphics.h:1441
EUIResizerMode GetResizerMode() const
Definition: IGraphics.h:1156
virtual void FillRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0)
Fill a rectangular region of the graphics context with a color.
Definition: IGraphics.cpp:2587
int GetRoundedScreenScale() const
Gets the screen/display scaling factor, rounded up.
Definition: IGraphics.h:1125
virtual void DrawFastDropShadow(const IRECT &innerBounds, const IRECT &outerBounds, float xyDrop=5.f, float roundness=0.f, float blur=10.f, IBlend *pBlend=nullptr)
NanoVG only.
Definition: IGraphics.h:404
virtual bool PromptForColor(IColor &color, const char *str="", IColorPickerHandlerFunc func=nullptr)=0
Create a platform color chooser dialog.
APIBitmap * SearchBitmapInCache(const char *fileName, int targetScale, int &sourceScale)
Search the static storage cache for a bitmap image resource matching the target scale.
Definition: IGraphics.cpp:1914
void * GetPlatformContext()
Get the platform level draw context - an HDC or CGContextRef.
Definition: IGraphics.h:935
virtual bool RevealPathInExplorerOrFinder(WDL_String &path, bool select=false)
Definition: IGraphics.h:919
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.
Definition: IGraphics.cpp:2434
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.
Definition: IGraphics.cpp:2543
void OnTouchCancelled(const std::vector< IMouseInfo > &points)
Called when the platform class sends touch cancel events.
Definition: IGraphics.cpp:1111
bool OnMouseOver(float x, float y, const IMouseMod &mod)
Definition: IGraphics.cpp:1136
virtual void UpdateTooltips()=0
Call this if you modify control tool tips at runtime.
void OnDragResize(float x, float y)
Called by ICornerResizerControl as the corner is dragged to resize.
Definition: IGraphics.cpp:1515
virtual PlatformFontPtr LoadPlatformFont(const char *fontID, const char *fileNameOrResID)=0
Load a font from disk or resource in a platform format.
void ForAllControlsFunc(IControlFunction func)
For all controls, including the "special controls" call a method.
Definition: IGraphics.cpp:553
int NBubbleControls() const
Definition: IGraphics.h:1444
void HideControl(int paramIdx, bool hide)
Hide controls linked to a specific parameter.
Definition: IGraphics.cpp:491
virtual bool LoadFont(const char *fontID, const char *fileNameOrResID)
Load a font to be used by the graphics context.
Definition: IGraphics.cpp:2194
void SetDisplayTickFunc(IDisplayTickFunc func)
Sets a function that is called at the frame rate, prior to checking for dirty controls.
Definition: IGraphics.h:1214
virtual bool BitmapExtSupported(const char *ext)=0
Checks a file extension and reports whether this drawing API supports loading that extension.
void RemoveAllControls()
Removes all regular IControls from the control list, as well as special controls (frees memory).
Definition: IGraphics.cpp:194
virtual void DrawCircle(const IColor &color, float cx, float cy, float r, const IBlend *pBlend=0, float thickness=1.f)
Draw a circle to the graphics context.
Definition: IGraphics.cpp:2550
bool LiveEditEnabled() const
Definition: IGraphics.h:1205
void OnMouseDown(const std::vector< IMouseInfo > &points)
Called when the platform class sends mouse down events.
Definition: IGraphics.cpp:984
void GetMouseDownPoint(float &x, float &y) const
Get the x, y position of the last mouse down message.
Definition: IGraphics.h:1613
int Height() const
Gets the height of the graphics context.
Definition: IGraphics.h:1101
void PathClipRegion(const IRECT r=IRECT())
Clip the current path to a particular region.
Definition: IGraphics.cpp:2783
void PathCircle(float cx, float cy, float r)
Add a circle to the current path.
Definition: IGraphics.cpp:2706
void PathRadialLine(float cx, float cy, float angle, float rMin, float rMax)
Add a radial line to the current path.
Definition: IGraphics.cpp:831
void PathTransformRotate(float angle)
Apply a rotation transform to the current path.
Definition: IGraphics.cpp:2765
bool GetResizingInProcess() const
Definition: IGraphics.h:1159
bool OnKeyUp(float x, float y, const IKeyPress &key)
Definition: IGraphics.cpp:1264
bool IsDirty(IRECTList &rects)
Called repeatedly at frame rate by the platform class to check what the graphics context says is dirt...
Definition: IGraphics.cpp:838
virtual void FillRoundRect(const IColor &color, const IRECT &bounds, float cornerRadius=5.f, const IBlend *pBlend=0)
Fill a rounded rectangle with a color.
Definition: IGraphics.cpp:2594
virtual void GetLayerBitmapData(const ILayerPtr &layer, RawBitmapData &data)=0
Get the contents of a layer as Raw RGBA bitmap data NOTE: you should only call this within IControl::...
bool RespondsToGesture(float x, float y)
Called by platform class to see if the point at x, y is linked to a gesture recognizer.
Definition: IGraphics.cpp:2361
virtual void PromptForFile(WDL_String &fileName, WDL_String &path, EFileAction action=EFileAction::Open, const char *ext="", IFileDialogCompletionHandlerFunc completionHandler=nullptr)=0
Create a platform file prompt dialog to choose a path for opening/saving a single file.
void ForAllControls(T method, Args... args)
For all controls, including the "special controls" call a method.
Definition: IGraphics.cpp:584
void ClearGestureRegions()
Remove all gesture recognizers linked to regions.
Definition: IGraphics.cpp:2411
void SetControlValueAfterTextEdit(const char *str)
Called by the platform class after returning from a text entry in order to update a control with a ne...
Definition: IGraphics.cpp:235
bool ControlIsCaptured(IControl *pControl) const
Check to see if the control is already captured.
Definition: IGraphics.h:1418
virtual void GetMouseLocation(float &x, float &y) const =0
Get the x, y position of the mouse cursor.
virtual void * GetWinModuleHandle()
Definition: IGraphics.h:926
int NControls() const
Definition: IGraphics.h:1456
virtual void UpdateLayer()
Implemented by a graphics backend to prepare for drawing to the layer at the top of the stack.
Definition: IGraphics.h:578
virtual void DrawData(const IColor &color, const IRECT &bounds, float *normYPoints, int nPoints, float *normXPoints=nullptr, const IBlend *pBlend=0, float thickness=1.f, const IColor *pFillColor=nullptr)
Draw a line between a collection of normalized points.
Definition: IGraphics.cpp:2468
void SetQwertyMidiKeyHandlerFunc(std::function< void(const IMidiMsg &msg)> func=nullptr)
A helper to set the IGraphics KeyHandlerFunc in order to make an instrument playable via QWERTY keys.
Definition: IGraphics.cpp:2293
void AttachSVGBackground(const char *fileName)
Attach an ISVGControl as the lowest IControl in the control stack to be the background for the graphi...
Definition: IGraphics.cpp:295
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.
Definition: IGraphics.cpp:2580
virtual void ApplyLayerDropShadow(ILayerPtr &layer, const IShadow &shadow)
Applies a drop shadow directly onto a layer.
Definition: IGraphics.cpp:2093
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.
Definition: IGraphics.cpp:2442
void SetSharedResourcesSubPath(const char *sharedResourcesSubPath)
Sets the name of the shared resources subpath.
Definition: IGraphics.h:1659
int GetMouseOver() const
Definition: IGraphics.h:1608
void SetAllControlsDirty()
Calls SetDirty() on every control.
Definition: IGraphics.cpp:595
virtual IBitmap ScaleBitmap(const IBitmap &inBitmap, const char *cacheName, int targetScale)
Returns a new IBitmap, an integer scaled version of the input, and adds it to the cache.
Definition: IGraphics.cpp:1862
IControl * GetControlInTextEntry()
Definition: IGraphics.h:1147
IBitmap GetScaledBitmap(IBitmap &inBitmap)
Get a version of the input bitmap from the cache that corresponds to the current screen scale For exa...
Definition: IGraphics.cpp:1536
void AttachPanelBackground(const IPattern &color)
Attach an IPanelControl as the lowest IControl in the control stack to fill the background with a sol...
Definition: IGraphics.cpp:302
virtual void FillConvexPolygon(const IColor &color, float *x, float *y, int nPoints, const IBlend *pBlend=0)
Fill a convex polygon with a color.
Definition: IGraphics.cpp:2608
bool OnMouseWheel(float x, float y, const IMouseMod &mod, float delta)
Definition: IGraphics.cpp:1236
void SetAllControlsClean()
Calls SetClean() on every control.
Definition: IGraphics.cpp:600
virtual void OnViewInitialized(void *pContext)
Called after platform view initialization, so that drawing classes can e.g.
Definition: IGraphics.h:94
void StyleAllVectorControls(const IVStyle &style)
Helper method to style all of the controls which inherit IVectorBase.
Definition: IGraphics.cpp:1929
virtual IPopupMenu * CreatePlatformPopupMenu(IPopupMenu &menu, const IRECT bounds, bool &isAsync)=0
Calls the platform backend to create the platform popup menu.
void RemoveControlWithTag(int ctrlTag)
Remove controls from the control list with a particular tag.
Definition: IGraphics.cpp:132
virtual void RemovePlatformView(void *pView)
Remove a previously attached platform view from the IGraphics view.
Definition: IGraphics.h:803
void GetTouches(IControl *pControl, std::vector< ITouchID > &touchesOnThisControl) const
Populate a vector with the touchIDs active on pControl.
Definition: IGraphics.h:1424
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.
Definition: IGraphics.cpp:800
virtual void PathMoveTo(float x, float y)=0
Move the current point in the current path.
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.
void PopupHostContextMenuForParam(int controlIdx, int paramIdx, float x, float y)
[VST3 primarily] In VST3 plug-ins this enable support for the IContextMenu interface,...
Definition: IGraphics.cpp:1504
virtual bool FlippedBitmap() const =0
void PromptUserInput(IControl &control, const IRECT &bounds, int valIdx=0)
Prompt for user input either using a text entry or pop up menu.
Definition: IGraphics.cpp:635
virtual const char * GetPlatformAPIStr()
Definition: IGraphics.h:914
void SetControlSize(IControl *pControl, float w, float h)
Resize a control, redrawing the interface correctly.
Definition: IGraphics.cpp:221
float GetScreenScale() const
Gets the screen/display scaling factor, e.g.
Definition: IGraphics.h:1121
virtual bool LoadAPIFont(const char *fontID, const PlatformFontPtr &font)=0
Drawing API method to load a font from a PlatformFontPtr, called internally.
bool ShowControlBoundsEnabled() const
Definition: IGraphics.h:1198
void OnDropMultiple(const std::vector< const char * > &paths, float x, float y)
Definition: IGraphics.cpp:1288
void AssignParamNameToolTips()
Call this method in order to create tool tips for every IControl that show the associated parameter's...
Definition: IGraphics.cpp:605
bool EnableMultiTouch(bool enable)
Enable/disable multi touch, if platform supports it.
Definition: IGraphics.h:1163
virtual ISVG LoadSVG(const char *fileNameOrResID, const char *units="px", float dpi=72.f)
Load an SVG from disk or from windows resource.
Definition: IGraphics.cpp:1636
virtual APIBitmap * LoadAPIBitmap(const char *fileNameOrResID, int scale, EResourceLocation location, const char *ext)=0
Drawing API method to load a bitmap, called internally.
virtual EMsgBoxResult ShowMessageBox(const char *str, const char *title, EMsgBoxType type, IMsgBoxCompletionHandlerFunc completionHandler=nullptr)=0
Pop up a modal platform message box dialog.
virtual void HideMouseCursor(bool hide=true, bool lock=true)=0
Call to hide/show the mouse cursor.
void SetScaleConstraints(float lo, float hi)
Sets the minimum and maximum (draw) scaling values.
Definition: IGraphics.cpp:126
virtual void PathQuadraticBezierTo(float cx, float cy, float x2, float y2)=0
Add a quadratic bezier to the current path from the current point to the specified location.
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.
Definition: IGraphics.cpp:807
void ForControlInGroup(const char *group, IControlFunction func)
For all standard controls in the main control stack that are linked to a group, execute a function.
Definition: IGraphics.cpp:532
virtual void DoDrawText(const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend=nullptr)=0
virtual EUIAppearance GetUIAppearance() const
Get the UI Appearance (Light/Dark mode)
Definition: IGraphics.h:1596
void PathTransformSave()
Save the current affine transform of the current path.
Definition: IGraphics.cpp:2721
virtual void FillArc(const IColor &color, float cx, float cy, float r, float a1, float a2, const IBlend *pBlend=0)
Fill an arc segment with a color.
Definition: IGraphics.cpp:2615
IPopupMenu & GetPromptMenu()
Definition: IGraphics.h:1141
void SetKeyHandlerFunc(IKeyHandlerFunc func)
Set a function that is called when key presses are not intercepted by any controls.
Definition: IGraphics.h:1222
virtual void DrawDottedLine(const IColor &color, float x1, float y1, float x2, float y2, const IBlend *pBlend=0, float thickness=1.f, float dashLen=2.f)
Draw a dotted line to the graphics context.
Definition: IGraphics.cpp:2497
virtual bool WindowIsOpen()
Definition: IGraphics.h:851
void RemoveTextEntryControl()
Remove the IGraphics text entry, use platform text entry if available.
Definition: IGraphics.cpp:387
void ShowFPSDisplay(bool enable)
Shows a control to display the frame rate of drawing.
Definition: IGraphics.cpp:437
virtual void PathLineTo(float x, float y)=0
Add a line to the current path from the current point to the specified location.
void DrawLineAcross(const IColor &color, const IRECT &bounds, EDirection dir, float pos, const IBlend *pBlend=0, float thickness=1.f)
Draw a horzional or vertical line, within a rectangular region of the graphics context.
Definition: IGraphics.cpp:792
int GetControlIdx(IControl *pControl) const
Get the index of a particular IControl in the control stack.
Definition: IGraphics.h:1378
const char * GetSharedResourcesSubPath() const
Gets the name of the shared resources subpath.
Definition: IGraphics.h:1656
IPopupMenuControl * GetPopupMenuControl()
Definition: IGraphics.h:1435
void PathTransformSkew(float xAngle, float yAngle)
Apply a skew transform to the current path.
Definition: IGraphics.cpp:2771
float GetDrawScale() const
Gets the graphics context scaling factor.
Definition: IGraphics.h:1117
void DrawFittedLayer(const ILayerPtr &layer, const IRECT &bounds, const IBlend *pBlend)
Draw a layer to the main IGraphics context, fitting it to a rectangle that is different to the layer'...
Definition: IGraphics.cpp:2071
virtual void DrawMultiLineText(const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend=0)
Draw some multi-line text to the graphics context in a specific rectangle (NanoVG only)
Definition: IGraphics.h:363
void RemoveControls(int fromIdx)
Remove controls from the control list above a particular index, (frees memory).
Definition: IGraphics.cpp:139
void AttachBackground(const char *fileName)
Attach an IBitmapControl as the lowest IControl in the control stack to be the background for the gra...
Definition: IGraphics.cpp:288
void SetStrictDrawing(bool strict)
Enables strict drawing mode.
Definition: IGraphics.cpp:978
bool ShowingFPSDisplay()
Definition: IGraphics.h:1361
bool MouseOverEnabled() const
Definition: IGraphics.h:1605
virtual void ForceEndUserEdit()=0
Call to force end text entry (will cancel any half input text.
void OnGUIIdle()
This is an idle timer tick call on the GUI thread, only active if USE_IDLE_CALLS is defined.
Definition: IGraphics.cpp:1509
IGEditorDelegate * GetDelegate()
Gets a pointer to the delegate class that handles communication to and from this graphics context.
Definition: IGraphics.h:1138
void ShowAreaDrawn(bool enable)
Definition: IGraphics.h:1192
IControl * GetControl(int idx)
Get the control at a certain index in the control stack.
Definition: IGraphics.h:1373
void StartLayer(IControl *pOwner, const IRECT &r, bool cacheable=false)
Create an IGraphics layer.
Definition: IGraphics.cpp:1995
int GetControlTag(const IControl *pControl) const
Get the tag given to a control.
Definition: IGraphics.h:1397
void OnGestureRecognized(const IGestureInfo &info)
Called by platform class when a gesture is recognized.
Definition: IGraphics.cpp:2381
virtual void CachePlatformFont(const char *fontID, const PlatformFontPtr &font)=0
Called to indicate that the platform should cache data about the platform font if needed.
bool OnMouseDblClick(float x, float y, const IMouseMod &mod)
Definition: IGraphics.cpp:1208
bool TooltipsEnabled() const
Definition: IGraphics.h:1153
virtual void DrawSVG(const ISVG &svg, const IRECT &bounds, const IBlend *pBlend=0, const IColor *pStrokeColor=nullptr, const IColor *pFillColor=nullptr)
Draw an SVG image to the graphics context.
Definition: IGraphics.cpp:2802
void ForStandardControlsFunc(IControlFunction func)
For all standard controls in the main control stack perform a function.
Definition: IGraphics.cpp:547
virtual void DrawTriangle(const IColor &color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend *pBlend=0, float thickness=1.f)
Draw a triangle to the graphics context.
Definition: IGraphics.cpp:2508
virtual void CloseWindow()=0
Close the platform view for this graphics context.
virtual void PathCubicBezierTo(float c1x, float c1y, float c2x, float c2y, float x2, float y2)=0
Add a cubic bezier to the current path from the current point to the specified location.
int WindowHeight() const
Gets the height of the graphics context including draw scaling.
Definition: IGraphics.h:1109
void PathEllipse(const IRECT &bounds)
Add an ellipse to the current path, specifying the rectangular region.
Definition: IGraphics.cpp:2701
virtual IBitmap LoadBitmap(const char *fileNameOrResID, int nStates=1, bool framesAreHorizontal=false, int targetScale=0)
Load a bitmap image from disk or from windows resource.
Definition: IGraphics.cpp:1737
void SetPlatformContext(void *pContext)
Set the platform draw context Used in order to set the platform level draw context - CGContextRef con...
Definition: IGraphics.h:931
virtual void BeginFrame()
Called at the beginning of drawing.
Definition: IGraphics.cpp:880
virtual void FillCircle(const IColor &color, float cx, float cy, float r, const IBlend *pBlend=0)
Fill a circle with a color.
Definition: IGraphics.cpp:2624
void OnSetCursor()
Called when the mouse enters the graphics context, to update the cursor to mCursorType.
Definition: IGraphics.h:1572
void SetControlPosition(IControl *pControl, float x, float y)
Reposition a control, redrawing the interface correctly.
Definition: IGraphics.cpp:214
void SetScreenScale(float scale)
Called by the platform IGraphics class when moving to a new screen to set DPI.
Definition: IGraphics.cpp:75
void EnableMouseOver(bool enable)
Definition: IGraphics.h:1599
virtual APIBitmap * LoadAPIBitmap(const char *name, const void *pData, int dataSize, int scale)=0
Drawing API method to load a bitmap from binary data, called internally.
ILayerPtr EndLayer()
End an IGraphics layer.
Definition: IGraphics.cpp:2018
virtual WDL_TypedBuf< uint8_t > LoadResource(const char *fileNameOrResID, const char *fileType)
Load a resource from the file system, the bundle, or a Windows resource, and returns its data.
Definition: IGraphics.cpp:1682
void OnDrop(const char *str, float x, float y)
Definition: IGraphics.cpp:1282
IRECT GetBounds() const
Returns an IRECT that represents the entire UI bounds This is useful for programatically arranging UI...
Definition: IGraphics.h:1210
IControl * AttachControl(IControl *pControl, int ctrlTag=kNoTag, const char *group="")
Attach an IControl to the graphics context and add it to the top of the control stack.
Definition: IGraphics.cpp:309
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.
virtual float MeasureText(const IText &text, const char *str, IRECT &bounds) const
Measure the rectangular region that some text will occupy.
Definition: IGraphics.cpp:691
A control to enable live modification of control layout in an IGraphics context in debug builds This ...
An abstraction that is used to store a temporary raster image/framebuffer.
IPlug's parameter class.
A base control for a pop-up menu/drop-down list that stays within the bounds of the IGraphics context...
A class for setting the contents of a pop up menu.
Used to manage a list of rectangular areas and optimize them for drawing to the screen.
A Text entry widget drawn by IGraphics.
std::unique_ptr< ILayer > ILayerPtr
ILayerPtr is a managed pointer for transferring the ownership of layers.
Used to describe a particular gesture.
Used to manage stroke behaviour for path based drawing back ends.
Used to manage composite/blend operations, independent of draw class/platform.
Used to manage color data, independent of draw class/platform.
Used to manage fill behaviour.
Used for key press info, such as ASCII representation, virtual key (mapped to win32 codes) and modifi...
Definition: IPlugStructs.h:616
Used to store transformation matrices.
Encapsulates a MIDI message and provides helper functions.
Definition: IPlugMidi.h:31
Used to manage mouse modifiers i.e.
Used to store pattern information for gradients.
Used to manage a rectangular area, independent of draw class/platform.
IRECT GetPixelSnapped() const
User-facing SVG abstraction that you use to manage SVG data ISVG doesn't actually own the image data.
Used to specify properties of a drop-shadow to a layer.
IText is used to manage font and text/text entry style for a piece of text on the UI,...
A struct encapsulating a set of properties used to configure IVControls.