iPlug2 - C++ Audio Plug-in Framework
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 #ifdef IGRAPHICS_IMGUI
53 #include "IGraphicsImGui.h"
54 #endif
55 
56 #include "nanosvg.h"
57 
58 #include <stack>
59 #include <memory>
60 #include <vector>
61 #include <unordered_map>
62 
63 #ifdef FillRect
64 #undef FillRect
65 #endif
66 
67 #ifdef DrawText
68 #undef DrawText
69 #endif
70 
71 #ifdef LoadBitmap
72 #undef LoadBitmap
73 #endif
74 
75 BEGIN_IPLUG_NAMESPACE
76 class IParam;
77 BEGIN_IGRAPHICS_NAMESPACE
78 class IControl;
79 class IPopupMenuControl;
80 class ITextEntryControl;
82 class IFPSDisplayControl;
83 class IBubbleControl;
84 
86 class IGraphics
87 #ifdef AAX_API
88 : public IPlugAAXView_Interface
89 #endif
90 {
91 public:
92 #pragma mark - Drawing API implementation
93 
95  virtual void BeginFrame();
96 
98  virtual void OnViewInitialized(void* pContext) {};
99 
101  virtual void OnViewDestroyed() {};
102 
104  virtual void EndFrame() {};
105 
110  virtual void DrawSVG(const ISVG& svg, const IRECT& bounds, const IBlend* pBlend = 0);
111 
120  virtual void DrawRotatedSVG(const ISVG& svg, float destCentreX, float destCentreY, float width, float height, double angle, const IBlend* pBlend = 0);
121 
128  virtual void DrawBitmap(const IBitmap& bitmap, const IRECT& bounds, int srcX, int srcY, const IBlend* pBlend = 0) = 0;
129 
134  virtual void DrawFittedBitmap(const IBitmap& bitmap, const IRECT& bounds, const IBlend* pBlend = 0);
135 
142  virtual void DrawRotatedBitmap(const IBitmap& bitmap, float destCentreX, float destCentreY, double angle, const IBlend* pBlend = 0);
143 
149  virtual void DrawPoint(const IColor& color, float x, float y, const IBlend* pBlend = 0);
150 
159  virtual void DrawLine(const IColor& color, float x1, float y1, float x2, float y2, const IBlend* pBlend = 0, float thickness = 1.f);
160 
169  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);
170 
181  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);
182 
188  virtual void DrawRect(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0, float thickness = 1.f);
189 
196  virtual void DrawRoundRect(const IColor& color, const IRECT& bounds, float cornerRadius = 5.f, const IBlend* pBlend = 0, float thickness = 1.f);
197 
207  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);
208 
218  virtual void DrawArc(const IColor& color, float cx, float cy, float r, float a1, float a2, const IBlend* pBlend = 0, float thickness = 1.f);
219 
227  virtual void DrawCircle(const IColor& color, float cx, float cy, float r, const IBlend* pBlend = 0, float thickness = 1.f);
228 
234  virtual void DrawEllipse(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0, float thickness = 1.f);
235 
245  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);
246 
254  virtual void DrawConvexPolygon(const IColor& color, float* x, float* y, int nPoints, const IBlend* pBlend = 0, float thickness = 1.f);
255 
261  virtual void DrawDottedRect(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0, float thickness = 1.f, float dashLen = 2.f);
262 
272  virtual void FillTriangle(const IColor& color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend* pBlend = 0);
273 
278  virtual void FillRect(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0);
279 
285  virtual void FillRoundRect(const IColor& color, const IRECT& bounds, float cornerRadius = 5.f, const IBlend* pBlend = 0);
286 
295  virtual void FillRoundRect(const IColor& color, const IRECT& bounds, float cRTL, float cRTR, float cRBR, float cRBL, const IBlend* pBlend = 0);
296 
303  virtual void FillCircle(const IColor& color, float cx, float cy, float r, const IBlend* pBlend = 0);
304 
309  virtual void FillEllipse(const IColor& color, const IRECT& bounds, const IBlend* pBlend = 0);
310 
319  virtual void FillEllipse(const IColor& color, float x, float y, float r1, float r2, float angle = 0.0, const IBlend* pBlend = 0);
320 
329  virtual void FillArc(const IColor& color, float cx, float cy, float r, float a1, float a2, const IBlend* pBlend = 0);
330 
337  virtual void FillConvexPolygon(const IColor& color, float* x, float* y, int nPoints, const IBlend* pBlend = 0);
338 
343  void DrawText(const IText& text, const char* str, const IRECT& bounds, const IBlend* pBlend = 0);
344 
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 
362  virtual IColor GetPoint(int x, int y) = 0;
363 
366  virtual void* GetDrawContext() = 0;
367 
369  virtual const char* GetDrawingAPIStr() = 0;
370 
376  virtual IBitmap ScaleBitmap(const IBitmap& inBitmap, const char* cacheName, int targetScale);
377 
381  virtual void RetainBitmap(const IBitmap& bitmap, const char* cacheName);
382 
385  virtual void ReleaseBitmap(const IBitmap& bitmap);
386 
391  IBitmap GetScaledBitmap(IBitmap& inBitmap);
392 
394  virtual bool BitmapExtSupported(const char* ext) = 0;
395 
397  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*/ }
398 
399 #pragma mark - Base implementation - drawing helpers
400 
406  void DrawBitmap(const IBitmap& bitmap, const IRECT& bounds, int frame = 1, const IBlend* pBlend = 0);
407 
419  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);
420 
427  void DrawVerticalLine(const IColor& color, const IRECT& bounds, float x, const IBlend* pBlend = 0, float thickness = 1.f);
428 
435  void DrawHorizontalLine(const IColor& color, const IRECT& bounds, float y, const IBlend* pBlend = 0, float thickness = 1.f);
436 
444  void DrawVerticalLine(const IColor& color, float xi, float yLo, float yHi, const IBlend* pBlend = 0, float thickness = 1.f);
445 
453  void DrawHorizontalLine(const IColor& color, float yi, float xLo, float xHi, const IBlend* pBlend = 0, float thickness = 1.f);
454 
464  void DrawRadialLine(const IColor& color, float cx, float cy, float angle, float rMin, float rMax, const IBlend* pBlend = 0, float thickness = 1.f);
465 
473  virtual void DrawGrid(const IColor& color, const IRECT& bounds, float gridSizeH, float gridSizeV, const IBlend* pBlend = 0, float thickness = 1.f);
474 
483  virtual void DrawData(const IColor& color, const IRECT& bounds, float* normYPoints, int nPoints, float* normXPoints = nullptr, const IBlend* pBlend = 0, float thickness = 1.f);
484 
489  virtual bool LoadFont(const char* fontID, const char* fileNameOrResID);
490 
496  virtual bool LoadFont(const char* fontID, void* pData, int dataSize);
497 
503  bool LoadFont(const char* fontID, const char* fontName, ETextStyle style);
504 
505 #pragma mark - Layer management
506 
511  void StartLayer(IControl* pOwner, const IRECT& r, bool cacheable = false);
512 
515  void ResumeLayer(ILayerPtr& layer);
516 
520 
524  bool CheckLayer(const ILayerPtr& layer);
525 
529  void DrawLayer(const ILayerPtr& layer, const IBlend* pBlend = nullptr);
530 
535  void DrawFittedLayer(const ILayerPtr& layer, const IRECT& bounds, const IBlend* pBlend);
536 
540  void DrawRotatedLayer(const ILayerPtr& layer, double angle);
541 
545  void ApplyLayerDropShadow(ILayerPtr& layer, const IShadow& shadow);
546 
547 protected:
551  virtual void GetLayerBitmapData(const ILayerPtr& layer, RawBitmapData& data) = 0;
552 
557  virtual void ApplyShadowMask(ILayerPtr& layer, RawBitmapData& mask, const IShadow& shadow) = 0;
558 
560  virtual void UpdateLayer() {}
561 
564  void PushLayer(ILayer* pLayer);
565 
568  ILayer* PopLayer();
569 
570 #pragma mark - Drawing API path support
571 public:
573  virtual void PathClear() = 0;
574 
576  virtual void PathClose() = 0;
577 
583  void PathLine(float x1, float y1, float x2, float y2)
584  {
585  PathMoveTo(x1, y1);
586  PathLineTo(x2, y2);
587  }
588 
595  void PathRadialLine(float cx, float cy, float angle, float rMin, float rMax);
596 
604  void PathTriangle(float x1, float y1, float x2, float y2, float x3, float y3);
605 
608  void PathRect(const IRECT& bounds);
609 
616  void PathRoundRect(const IRECT& bounds, float ctl, float ctr, float cbl, float cbr);
617 
621  void PathRoundRect(const IRECT& bounds, float cornerRadius = 5.f);
622 
629  virtual void PathArc(float cx, float cy, float r, float a1, float a2, EWinding winding = EWinding::CW) = 0;
630 
635  void PathCircle(float cx, float cy, float r);
636 
639  void PathEllipse(const IRECT& bounds);
640 
647  void PathEllipse(float x, float y, float r1, float r2, float angle = 0.0);
648 
653  void PathConvexPolygon(float* x, float* y, int nPoints);
654 
658  virtual void PathMoveTo(float x, float y) = 0;
659 
663  virtual void PathLineTo(float x, float y) = 0;
664 
667  virtual void PathSetWinding(bool clockwise) {};
668 
676  virtual void PathCubicBezierTo(float c1x, float c1y, float c2x, float c2y, float x2, float y2) = 0;
677 
683  virtual void PathQuadraticBezierTo(float cx, float cy, float x2, float y2) = 0;
684 
690  virtual void PathStroke(const IPattern& pattern, float thickness, const IStrokeOptions& options = IStrokeOptions(), const IBlend* pBlend = 0) = 0;
691 
696  virtual void PathFill(const IPattern& pattern, const IFillOptions& options = IFillOptions(), const IBlend* pBlend = 0) = 0;
697 
699  void PathTransformSave();
700 
702  void PathTransformRestore();
703 
706  void PathTransformReset(bool clearStates = false);
707 
711  void PathTransformTranslate(float x, float y);
712 
716  void PathTransformScale(float x, float y);
717 
720  void PathTransformScale(float scale);
721 
724  void PathTransformRotate(float angle);
725 
729  void PathTransformSkew(float xAngle, float yAngle);
730 
733  void PathTransformMatrix(const IMatrix& matrix);
734 
737  void PathClipRegion(const IRECT r = IRECT());
738 
739  virtual void PathTransformSetMatrix(const IMatrix& matrix) = 0;
740 
741  void DoTextRotation(const IText& text, const IRECT& bounds, const IRECT& rect)
742  {
743  if (!text.mAngle)
744  return;
745 
746  IRECT rotated = rect;
747  double tx, ty;
748 
749  CalculateTextRotation(text, bounds, rotated, tx, ty);
750  PathTransformTranslate(static_cast<float>(tx), static_cast<float>(ty));
751  PathTransformRotate(text.mAngle);
752  }
753 
754 private:
755  IPattern GetSVGPattern(const NSVGpaint& paint, float opacity);
756 
757  void DoDrawSVG(const ISVG& svg, const IBlend* pBlend = nullptr);
758 
761  void PrepareRegion(const IRECT& bounds)
762  {
763  PathTransformReset(true);
764  PathClear();
765  SetClipRegion(bounds);
766  mClipRECT = bounds;
767  }
768 
771  virtual void CompleteRegion(const IRECT& bounds) {}
772 
773  virtual void SetClipRegion(const IRECT& r) = 0;
774 
775 public:
776 #pragma mark - Platform implementation
777 
781  virtual void AttachPlatformView(const IRECT& r, void* pView) {};
782 
785  virtual void RemovePlatformView(void* pView) {};
786 
790  virtual void GetMouseLocation(float& x, float&y) const = 0;
791 
795  virtual void HideMouseCursor(bool hide = true, bool lock = true) = 0;
796 
800  virtual void MoveMouseCursor(float x, float y) = 0;
801 
805  virtual ECursor SetMouseCursor(ECursor cursorType = ECursor::ARROW)
806  {
807  ECursor oldCursorType = mCursorType;
808  mCursorType = cursorType;
809  return oldCursorType;
810  }
811 
813  virtual void ForceEndUserEdit() = 0;
814 
818  virtual void* OpenWindow(void* pParentWnd) = 0;
819 
821  virtual void CloseWindow() = 0;
822 
825  virtual void* GetWindow() = 0;
826 
828  virtual bool WindowIsOpen() { return GetWindow(); }
829 
833  virtual bool GetTextFromClipboard(WDL_String& str) = 0;
834 
838  virtual bool SetTextInClipboard(const char* str) = 0;
839 
841  virtual void UpdateTooltips() = 0;
842 
848  virtual EMsgBoxResult ShowMessageBox(const char* str, const char* caption, EMsgBoxType type, IMsgBoxCompletionHanderFunc completionHandler = nullptr) = 0;
849 
855  virtual void PromptForFile(WDL_String& fileName, WDL_String& path, EFileAction action = EFileAction::Open, const char* extensions = 0) = 0;
856 
859  virtual void PromptForDirectory(WDL_String& dir) = 0;
860 
866  virtual bool PromptForColor(IColor& color, const char* str = "", IColorPickerHandlerFunc func = nullptr) = 0;
867 
874  virtual bool OpenURL(const char* url, const char* msgWindowTitle = 0, const char* confirmMsg = 0, const char* errMsgOnFailure = 0) = 0;
875 
877  virtual const char* GetPlatformAPIStr() { return ""; }
878 
882  virtual bool RevealPathInExplorerOrFinder(WDL_String& path, bool select = false) { return false; }
883 
886  virtual void SetWinModuleHandle(void* pHinstance) {}
887 
889  virtual void* GetWinModuleHandle() { return nullptr; }
890 
894  void SetPlatformContext(void* pContext) { mPlatformContext = pContext; }
895 
898  void* GetPlatformContext() { return mPlatformContext; }
899 
903  virtual void ClientToScreen(float& x, float& y) {};
904 
909  virtual PlatformFontPtr LoadPlatformFont(const char* fontID, const char* fileNameOrResID) = 0;
910 
916  virtual PlatformFontPtr LoadPlatformFont(const char* fontID, void* pData, int dataSize) = 0;
917 
923  virtual PlatformFontPtr LoadPlatformFont(const char* fontID, const char* fontName, ETextStyle style) = 0;
924 
928  virtual void CachePlatformFont(const char* fontID, const PlatformFontPtr& font) = 0;
929 
931  virtual const char* GetBundleID() { return ""; }
932 
933 protected:
934  /* Implemented on Windows to store previously active GLContext and HDC for restoring, calls GetDC */
935  virtual void ActivateGLContext() {};
936 
937  /* Implemented on Windows to restore previous GL context calls ReleaseDC */
938  virtual void DeactivateGLContext() {};
939 
945  virtual void CreatePlatformTextEntry(int paramIdx, const IText& text, const IRECT& bounds, int length, const char* str) = 0;
946 
952  virtual IPopupMenu* CreatePlatformPopupMenu(IPopupMenu& menu, const IRECT& bounds, bool& isAsync) = 0;
953 
954 #pragma mark - Base implementation
955 public:
956  IGraphics(IGEditorDelegate& dlg, int w, int h, int fps = DEFAULT_FPS, float scale = 1.);
957 
958  virtual ~IGraphics();
959 
960  IGraphics(const IGraphics&) = delete;
961  IGraphics& operator=(const IGraphics&) = delete;
962 
965  void SetScreenScale(float scale);
966 
968  void SetTranslation(float x, float y) { mXTranslation = x; mYTranslation = y; }
969 
973  bool IsDirty(IRECTList& rects);
974 
977  void Draw(IRECTList& rects);
978 
983  void PromptUserInput(IControl& control, const IRECT& bounds, int valIdx = 0);
984 
990  void CreatePopupMenu(IControl& control, IPopupMenu& menu, const IRECT& bounds, int valIdx = 0);
991 
997  void CreatePopupMenu(IControl& control, IPopupMenu& menu, float x, float y, int valIdx = 0)
998  {
999  return CreatePopupMenu(control, menu, IRECT(x, y, x, y), valIdx);
1000  }
1001 
1008  void CreateTextEntry(IControl& control, const IText& text, const IRECT& bounds, const char* str = "", int valIdx = 0);
1009 
1012  void SetControlValueAfterTextEdit(const char* str);
1013 
1017 
1021  void SetScaleConstraints(float lo, float hi)
1022  {
1023  mMinScale = std::min(lo, hi);
1024  mMaxScale = std::max(lo, hi);
1025  }
1026 
1033  void Resize(int w, int h, float scale, bool needsPlatformResize = true);
1034 
1037  void SetStrictDrawing(bool strict);
1038 
1039  /* Enables layout on resize. This means IGEditorDelegate:LayoutUI() will be called when the GUI is resized */
1040  void SetLayoutOnResize(bool layoutOnResize);
1041 
1044  int Width() const { return mWidth; }
1045 
1048  int Height() const { return mHeight; }
1049 
1052  int WindowWidth() const { return static_cast<int>(static_cast<float>(mWidth) * mDrawScale); }
1053 
1056  int WindowHeight() const { return static_cast<int>(static_cast<float>(mHeight) * mDrawScale); }
1057 
1060  int FPS() const { return mFPS; }
1061 
1064  float GetDrawScale() const { return mDrawScale; }
1065 
1068  float GetScreenScale() const { return mScreenScale; }
1069 
1072  int GetRoundedScreenScale() const { return static_cast<int>(std::ceil(GetScreenScale())); }
1073 
1076  float GetTotalScale() const { return mDrawScale * mScreenScale; }
1077 
1082 
1085  IGEditorDelegate* GetDelegate() { return mDelegate; }
1086 
1088  IPopupMenu& GetPromptMenu() { return mPromptPopupMenu; }
1089 
1091  bool IsInPlatformTextEntry() { return mInTextEntry != nullptr && !mTextEntryControl; }
1092 
1094  IControl* GetControlInTextEntry() { return mInTextEntry; }
1095 
1097  inline bool TooltipsEnabled() const { return mEnableTooltips; }
1098 
1100  EUIResizerMode GetResizerMode() const { return mGUISizeMode; }
1101 
1103  bool GetResizingInProcess() const { return mResizingInProcess; }
1104 
1107  bool EnableMultiTouch(bool enable)
1108  {
1110  {
1111  mEnableMultiTouch = enable;
1112  return true;
1113  }
1114  else
1115  mEnableMultiTouch = false;
1116 
1117  return false;
1118  }
1119 
1121  bool MultiTouchEnabled() const { return mEnableMultiTouch; }
1122 
1124  virtual bool PlatformSupportsMultiTouch() const { return false; }
1125 
1127  void EnableTooltips(bool enable);
1128 
1130  void AssignParamNameToolTips();
1131 
1133  inline void ShowControlBounds(bool enable) { mShowControlBounds = enable; SetAllControlsDirty(); }
1134 
1136  inline void ShowAreaDrawn(bool enable) { mShowAreaDrawn = enable; if(!enable) SetAllControlsDirty(); }
1137 
1139  bool ShowAreaDrawnEnabled() const { return mShowAreaDrawn; }
1140 
1142  bool ShowControlBoundsEnabled() const { return mShowControlBounds; }
1143 
1146  void EnableLiveEdit(bool enable);
1147 
1149  bool LiveEditEnabled() const { return mLiveEdit != nullptr; }
1150 
1154  IRECT GetBounds() const { return IRECT(0.f, 0.f, (float) Width(), (float) Height()); }
1155 
1158  void SetDisplayTickFunc(IDisplayTickFunc func) { mDisplayTickFunc = func; }
1159 
1162  void SetKeyHandlerFunc(IKeyHandlerFunc func) { mKeyHandlerFunc = func; }
1163 
1166  void SetQwertyMidiKeyHandlerFunc(std::function<void(const IMidiMsg& msg)> func = nullptr);
1167 
1171  void AttachImGui(std::function<void(IGraphics*)> drawFunc, std::function<void()> setupFunc = nullptr);
1172 
1174  bool RespondsToGesture(float x, float y);
1175 
1177  void OnGestureRecognized(const IGestureInfo& info);
1178 
1181  virtual float GetPlatformWindowScale() const { return 1.f; }
1182 
1183 private:
1184  /* NO-OP to create ImGui when IGRAPHICS_IMGUI is defined */
1185  virtual void CreatePlatformImGui() {}
1186 
1188  virtual void PlatformResize(bool parentHasResized) {}
1189 
1191  virtual void DrawResize() {}
1192 
1196  void Draw(const IRECT& bounds, float scale);
1197 
1202  void DrawControl(IControl* pControl, const IRECT& bounds, float scale);
1203 
1210  void DoCreatePopupMenu(IControl& control, IPopupMenu& menu, const IRECT& bounds, int valIdx, bool isContext);
1211 
1213  void StartDragResize() { mResizingInProcess = true; }
1214 
1216  void EndDragResize();
1217 
1218 #pragma mark - Control management
1219 public:
1222  void ForAllControlsFunc(std::function<void(IControl* pControl)> func);
1223 
1227  template<typename T, typename... Args>
1228  void ForAllControls(T method, Args... args);
1229 
1232  void ForStandardControlsFunc(std::function<void(IControl* pControl)> func);
1233 
1238  template<typename T, typename... Args>
1239  void ForMatchingControls(T method, int paramIdx, Args... args);
1240 
1244  void ForControlWithParam(int paramIdx, std::function<void(IControl* pControl)> func);
1245 
1249  void ForControlInGroup(const char* group, std::function<void(IControl* pControl)> func);
1250 
1253  void AttachBackground(const char* fileName);
1254 
1257  void AttachSVGBackground(const char* fileName);
1258 
1261  void AttachPanelBackground(const IPattern& color);
1262 
1265  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);
1266 
1270  void AttachCornerResizer(ICornerResizerControl* pControl, EUIResizerMode sizeMode = EUIResizerMode::Scale, bool layoutOnResize = false);
1271 
1275  void AttachPopupMenuControl(const IText& text = DEFAULT_TEXT, const IRECT& bounds = IRECT());
1276 
1278  void RemovePopupMenuControl();
1279 
1281  void AttachTextEntryControl();
1282 
1284  void RemoveTextEntryControl();
1285 
1287  void AttachBubbleControl(const IText& text = DEFAULT_TEXT);
1288 
1290  void AttachBubbleControl(IBubbleControl* pControl);
1291 
1292  /* Called by controls to display text in the bubble control */
1293  void ShowBubbleControl(IControl* pCaller, float x, float y, const char* str, EDirection dir = EDirection::Horizontal, IRECT minimumContentBounds = IRECT());
1294 
1297  void ShowFPSDisplay(bool enable);
1298 
1300  bool ShowingFPSDisplay() { return mPerfDisplay != nullptr; }
1301 
1307  IControl* AttachControl(IControl* pControl, int ctrlTag = kNoTag, const char* group = "");
1308 
1311  IControl* GetControl(int idx) { return mControls.Get(idx); }
1312 
1315  int GetControlIdx(IControl* pControl) const { return mControls.Find(pControl); }
1316 
1320  int GetIdxOfTaggedControl(int ctrlTag) const
1321  {
1322  IControl* pControl = GetControlWithTag(ctrlTag);
1323  return pControl ? GetControlIdx(pControl) : -1;
1324  }
1325 
1328  IControl* GetControlWithTag(int ctrlTag) const;
1329 
1333  int GetControlTag(const IControl* pControl) const
1334  {
1335  for (auto itr = mCtrlTags.begin(); itr != mCtrlTags.end(); ++itr)
1336  {
1337  if (itr->second == pControl)
1338  return itr->first;
1339  }
1340 
1341  return kNoTag;
1342  }
1343 
1345  bool ControlIsCaptured() const { return mCapturedMap.size() > 0; }
1346 
1349  bool ControlIsCaptured(IControl* pControl) const
1350  {
1351  return std::find_if(std::begin(mCapturedMap), std::end(mCapturedMap), [pControl](auto&& press) { return press.second == pControl; }) != mCapturedMap.end();
1352  }
1353 
1355  void GetTouches(IControl* pControl, std::vector<ITouchID>& touchesOnThisControl) const
1356  {
1357  for (auto i = mCapturedMap.begin(), j = mCapturedMap.end(); i != j; ++i)
1358  if (i->second == pControl)
1359  touchesOnThisControl.push_back(i->first);
1360  }
1361 
1362  /* Get the first control in the control list, the background */
1363  IControl* GetBackgroundControl() { return GetControl(0); }
1364 
1366  IPopupMenuControl* GetPopupMenuControl() { return mPopupControl.get(); }
1367 
1369  ITextEntryControl* GetTextEntryControl() { return mTextEntryControl.get(); }
1370 
1372  IBubbleControl* GetBubbleControl(int i = 0) { return mBubbleControls.Get(i); }
1373 
1375  int NBubbleControls() const { return mBubbleControls.GetSize(); }
1376 
1379  void StyleAllVectorControls(const IVStyle& style);
1380 
1384  void UpdatePeers(IControl* pCaller, int callerValIdx);
1385 
1387  int NControls() const { return mControls.GetSize(); }
1388 
1390  void RemoveControlWithTag(int ctrlTag);
1391 
1393  void RemoveControls(int fromIdx);
1394 
1396  void RemoveControl(int idx);
1397 
1399  void RemoveControl(IControl* pControl);
1400 
1402  void RemoveAllControls();
1403 
1407  void HideControl(int paramIdx, bool hide);
1408 
1412  void DisableControl(int paramIdx, bool diable);
1413 
1415  void SetAllControlsDirty();
1416 
1418  void SetAllControlsClean();
1419 
1424  void SetControlPosition(int idx, float x, float y);
1425 
1430  void SetControlSize(int idx, float w, float h);
1431 
1435  void SetControlBounds(int idx, const IRECT& r);
1436 
1437 private:
1443  int GetMouseControlIdx(float x, float y, bool mouseOver = false);
1444 
1452  IControl* GetMouseControl(float x, float y, bool capture, bool mouseOver = false, ITouchID touchID = 0);
1453 
1454 #pragma mark - Event handling
1455 public:
1457  void OnMouseDown(const std::vector<IMouseInfo>& points);
1458 
1460  void OnMouseUp(const std::vector<IMouseInfo>& points);
1461 
1463  void OnMouseDrag(const std::vector<IMouseInfo>& points);
1464 
1466  void OnTouchCancelled(const std::vector<IMouseInfo>& points);
1467 
1472  bool OnMouseDblClick(float x, float y, const IMouseMod& mod);
1473 
1478  void OnMouseWheel(float x, float y, const IMouseMod& mod, float delta);
1479 
1484  bool OnKeyDown(float x, float y, const IKeyPress& key);
1485 
1490  bool OnKeyUp(float x, float y, const IKeyPress& key);
1491 
1496  bool OnMouseOver(float x, float y, const IMouseMod& mod);
1497 
1499  void OnMouseOut();
1500 
1502  void OnSetCursor() { SetMouseCursor(mCursorType); }
1503 
1507  void OnDrop(const char* str, float x, float y);
1508 
1510  void OnGUIIdle();
1511 
1513  void OnDragResize(float x, float y);
1514 
1516  void EnableMouseOver(bool enable) { mEnableMouseOver = enable; }
1517 
1519  void ReleaseMouseCapture();
1520 
1522  bool CanEnableMouseOver() const { return mEnableMouseOver; }
1523 
1525  inline int GetMouseOver() const { return mMouseOverIdx; }
1526 
1530  void GetMouseDownPoint(float& x, float&y) const { x = mMouseDownX; y = mMouseDownY; }
1531 
1534  void SetTabletInput(bool tablet) { mTabletInput = tablet; }
1535 #pragma mark - Plug-in API Specific
1536 
1542  int GetParamIdxForPTAutomation(float x, float y);
1543 
1547 
1552  void SetPTParameterHighlight(int paramIdx, bool isHighlighted, int color);
1553 
1560  void PopupHostContextMenuForParam(int controlIdx, int paramIdx, float x, float y);
1561 
1568  void PopupHostContextMenuForParam(IControl* pControl, int paramIdx, float x, float y);
1569 
1570 #pragma mark - Resource/File Loading
1571 
1573  const char* GetSharedResourcesSubPath() const { return mSharedResourcesSubPath.Get(); }
1574 
1576  void SetSharedResourcesSubPath(const char* sharedResourcesSubPath) { mSharedResourcesSubPath.Set(sharedResourcesSubPath); }
1577 
1584  virtual IBitmap LoadBitmap(const char* fileNameOrResID, int nStates = 1, bool framesAreHorizontal = false, int targetScale = 0);
1585 
1594  virtual IBitmap LoadBitmap(const char *name, const void* pData, int dataSize, int nStates = 1, bool framesAreHorizontal = false, int targetScale = 0);
1595 
1599  virtual ISVG LoadSVG(const char* fileNameOrResID, const char* units = "px", float dpi = 72.f);
1600 
1608  virtual ISVG LoadSVG(const char* name, const void* pData, int dataSize, const char* units = "px", float dpi = 72.f);
1609 
1614  virtual WDL_TypedBuf<uint8_t> LoadResource(const char* fileNameOrResID, const char* fileType);
1615 
1618  virtual void AttachGestureRecognizer(EGestureType type); //TODO: should be protected?
1619 
1624  void AttachGestureRecognizerToRegion(const IRECT& bounds, EGestureType type, IGestureFunc func);
1625 
1627  void ClearGestureRegions();
1628 
1629 protected:
1636  virtual APIBitmap* LoadAPIBitmap(const char* fileNameOrResID, int scale, EResourceLocation location, const char* ext) = 0;
1637 
1644  virtual APIBitmap* LoadAPIBitmap(const char* name, const void* pData, int dataSize, int scale) = 0;
1645 
1653  virtual APIBitmap* CreateAPIBitmap(int width, int height, int scale, double drawScale, bool cacheable = false) = 0;
1654 
1659  virtual bool LoadAPIFont(const char* fontID, const PlatformFontPtr& font) = 0;
1660 
1662  virtual bool AssetsLoaded() { return true; }
1663 
1665  virtual int AlphaChannel() const = 0;
1666 
1668  virtual bool FlippedBitmap() const = 0;
1669 
1673  inline void SearchNextScale(int& sourceScale, int targetScale);
1674 
1682  EResourceLocation SearchImageResource(const char* fileName, const char* type, WDL_String& result, int targetScale, int& sourceScale);
1683 
1689  APIBitmap* SearchBitmapInCache(const char* fileName, int targetScale, int& sourceScale);
1690 
1696  virtual float DoMeasureText(const IText& text, const char* str, IRECT& bounds) const = 0;
1697 
1703  virtual void DoDrawText(const IText& text, const char* str, const IRECT& bounds, const IBlend* pBlend = nullptr) = 0;
1704 
1709  void DoMeasureTextRotation(const IText& text, const IRECT& bounds, IRECT& rect) const;
1710 
1717  void CalculateTextRotation(const IText& text, const IRECT& bounds, IRECT& rect, double& tx, double& ty) const;
1718 
1720  virtual float GetBackingPixelScale() const { return GetScreenScale() * GetDrawScale(); };
1721 
1722  IMatrix GetTransformMatrix() const { return mTransform; }
1723 #pragma mark -
1724 
1725 private:
1726  void ClearMouseOver()
1727  {
1728  mMouseOver = nullptr;
1729  mMouseOverIdx = -1;
1730  }
1731 
1732  WDL_PtrList<IControl> mControls;
1733  std::unordered_map<int, IControl*> mCtrlTags;
1734 
1735  // Order (front-to-back) ToolTip / PopUp / TextEntry / LiveEdit / Corner / PerfDisplay
1736  std::unique_ptr<ICornerResizerControl> mCornerResizer;
1737  WDL_PtrList<IBubbleControl> mBubbleControls;
1738  std::unique_ptr<IPopupMenuControl> mPopupControl;
1739  std::unique_ptr<IFPSDisplayControl> mPerfDisplay;
1740  std::unique_ptr<ITextEntryControl> mTextEntryControl;
1741  std::unique_ptr<IControl> mLiveEdit;
1742 
1743  IPopupMenu mPromptPopupMenu;
1744 
1745  WDL_String mSharedResourcesSubPath;
1746 
1747  ECursor mCursorType = ECursor::ARROW;
1748  int mWidth;
1749  int mHeight;
1750  int mFPS;
1751  float mScreenScale = 1.f; // the scaling of the display that the UI is currently on e.g. 2 for retina
1752  float mDrawScale = 1.f; // scale deviation from default width and height i.e stretching the UI by dragging bottom right hand corner
1753 
1754  int mIdleTicks = 0;
1755 
1756  std::vector<EGestureType> mRegisteredGestures; // All the types of gesture registered with the graphics context
1757  IRECTList mGestureRegions; // Rectangular regions linked to gestures (excluding IControls)
1758  std::unordered_map<int, IGestureFunc> mGestureRegionFuncs; // Map of gesture region index to gesture function
1759  std::unordered_map<ITouchID, IControl*> mCapturedMap; // associative array of touch ids to control pointers, the same control can be touched multiple times
1760  IControl* mMouseOver = nullptr;
1761  IControl* mInTextEntry = nullptr;
1762  IControl* mInPopupMenu = nullptr;
1763  void* mPlatformContext = nullptr;
1764  bool mIsContextMenu = false;
1765  int mTextEntryValIdx = kNoValIdx;
1766  int mPopupMenuValIdx = kNoValIdx;
1767  int mMouseOverIdx = -1;
1768  float mMouseDownX = -1.f;
1769  float mMouseDownY = -1.f;
1770  float mMinScale;
1771  float mMaxScale;
1772  int mLastClickedParam = kNoParameter;
1773  bool mEnableMouseOver = false;
1774  bool mStrict = false;
1775  bool mEnableTooltips = false;
1776  bool mShowControlBounds = false;
1777  bool mShowAreaDrawn = false;
1778  bool mResizingInProcess = false;
1779  bool mLayoutOnResize = false;
1780  bool mEnableMultiTouch = false;
1781  EUIResizerMode mGUISizeMode = EUIResizerMode::Scale;
1782  double mPrevTimestamp = 0.;
1783  IKeyHandlerFunc mKeyHandlerFunc = nullptr;
1784  IDisplayTickFunc mDisplayTickFunc = nullptr;
1785 
1786 protected:
1787  IGEditorDelegate* mDelegate;
1788  bool mCursorHidden = false;
1789  bool mCursorLock = false;
1790  bool mTabletInput = false;
1791  float mCursorX = -1.f;
1792  float mCursorY = -1.f;
1793  float mXTranslation = 0.f;
1794  float mYTranslation = 0.f;
1795 
1796  friend class IGraphicsLiveEdit;
1797  friend class ICornerResizerControl;
1798  friend class ITextEntryControl;
1799 
1800  std::stack<ILayer*> mLayers;
1801 
1802  IRECT mClipRECT;
1803  IMatrix mTransform;
1804  std::stack<IMatrix> mTransformStates;
1805 
1806 #ifdef IGRAPHICS_IMGUI
1807 public:
1808  std::unique_ptr<ImGuiRenderer> mImGuiRenderer;
1809 #endif
1810 };
1811 
1812 END_IGRAPHICS_NAMESPACE
1813 END_IPLUG_NAMESPACE
bool LiveEditEnabled() const
Definition: IGraphics.h:1149
int FPS() const
Gets the drawing frame rate.
Definition: IGraphics.h:1060
virtual IColor GetPoint(int x, int y)=0
Get the color at an X, Y location in the graphics context.
void PathRect(const IRECT &bounds)
Add a rectangle to the current path.
Definition: IGraphics.cpp:2613
virtual bool RevealPathInExplorerOrFinder(WDL_String &path, bool select=false)
Definition: IGraphics.h:882
IRECT GetPixelSnapped() const
void PathConvexPolygon(float *x, float *y, int nPoints)
Add a convex polygon to the current path.
Definition: IGraphics.cpp:2673
virtual void PathMoveTo(float x, float y)=0
Move the current point in the current path.
int NBubbleControls() const
Definition: IGraphics.h:1375
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:2397
Used to manage a list of rectangular areas and optimize them for drawing to the screen.
virtual void PathClose()=0
Close the path that is being specified.
void ShowAreaDrawn(bool enable)
Definition: IGraphics.h:1136
void StartLayer(IControl *pOwner, const IRECT &r, bool cacheable=false)
Create an IGraphics layer.
Definition: IGraphics.cpp:1954
bool ShowAreaDrawnEnabled() const
Definition: IGraphics.h:1139
int GetRoundedScreenScale() const
Gets the screen/display scaling factor, rounded up.
Definition: IGraphics.h:1072
The lowest level base class of an IGraphics control.
Definition: IControl.h:42
A Text entry widget drawn by IGraphics.
void OnMouseDrag(const std::vector< IMouseInfo > &points)
Called when the platform class sends drag events.
Definition: IGraphics.cpp:1128
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.
Definition: IGraphics.cpp:2410
void SetControlSize(int idx, float w, float h)
Resize a control, redrawing the interface correctly.
Definition: IGraphics.cpp:216
void * GetPlatformContext()
Get the platform level draw context - an HDC or CGContextRef.
Definition: IGraphics.h:898
void DrawRotatedLayer(const ILayerPtr &layer, double angle)
Draw a layer to the main IGraphics context, with rotation.
Definition: IGraphics.cpp:2042
virtual bool FlippedBitmap() const =0
void PathTransformTranslate(float x, float y)
Apply a translation transform to the current path.
Definition: IGraphics.cpp:2708
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:2475
void RemoveTextEntryControl()
Remove the IGraphics text entry, use platform text entry if available.
Definition: IGraphics.cpp:372
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 AttachTextEntryControl()
Attach a control for text entry, to override platform text entry.
Definition: IGraphics.cpp:363
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:2496
Used to manage composite/blend operations, independent of draw class/platform.
User-facing bitmap abstraction that you use to manage bitmap data, independant of draw class/platform...
void ApplyLayerDropShadow(ILayerPtr &layer, const IShadow &shadow)
Applies a drop shadow directly onto a layer.
Definition: IGraphics.cpp:2052
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:805
Encapsulates a MIDI message and provides helper functions.
Definition: IPlugMidi.h:30
virtual APIBitmap * CreateAPIBitmap(int width, int height, int scale, double drawScale, bool cacheable=false)=0
Creates a new API bitmap, either in memory or as a GPU texture.
void EnableTooltips(bool enable)
Definition: IGraphics.cpp:1500
bool MultiTouchEnabled() const
Definition: IGraphics.h:1121
Used to manage fill behaviour for path based drawing back ends.
void SetDisplayTickFunc(IDisplayTickFunc func)
Sets a function that is called at the frame rate, prior to checking for dirty controls.
Definition: IGraphics.h:1158
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:317
void CreateTextEntry(IControl &control, const IText &text, const IRECT &bounds, const char *str="", int valIdx=0)
Create a text entry box.
Definition: IGraphics.cpp:1900
void ReleaseMouseCapture()
Used to tell the graphics context to stop tracking mouse interaction with a control.
Definition: IGraphics.cpp:1285
void SetTranslation(float x, float y)
Called by some platform IGraphics classes in order to translate the graphics context, in response to e.g.
Definition: IGraphics.h:968
void SetScaleConstraints(float lo, float hi)
Definition: IGraphics.h:1021
virtual const char * GetPlatformAPIStr()
Definition: IGraphics.h:877
virtual bool GetTextFromClipboard(WDL_String &str)=0
Get text from the clipboard.
void ResumeLayer(ILayerPtr &layer)
If a layer already exists, continue drawing to it.
Definition: IGraphics.cpp:1964
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:2517
Used to manage mouse modifiers i.e.
virtual void PathLineTo(float x, float y)=0
Add a line to the current path from the current point to the specified location.
virtual void BeginFrame()
Called at the beginning of drawing.
Definition: IGraphics.cpp:823
void OnGUIIdle()
This is an idle timer tick call on the GUI thread, only active if USE_IDLE_CALLS is defined...
Definition: IGraphics.cpp:1472
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:232
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.
Definition: IGraphics.cpp:2436
void PathTransformSave()
Save the current affine transform of the current path.
Definition: IGraphics.cpp:2681
void ForAllControls(T method, Args...args)
For all controls, including the "special controls" call a method.
Definition: IGraphics.cpp:532
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:886
bool ControlIsCaptured(IControl *pControl) const
Check to see if the control is already captured.
Definition: IGraphics.h:1349
virtual PlatformFontPtr LoadPlatformFont(const char *fontID, const char *fileNameOrResID)=0
Load a font from disk or resource in a platform format.
void PopupHostContextMenuForParam(int controlIdx, int paramIdx, float x, float y)
[VST3 primarily] In VST3 plug-ins this enable support for the IContextMenu interface, which allows the host to add contextual options to e.g.
Definition: IGraphics.cpp:1467
void PathTransformMatrix(const IMatrix &matrix)
Apply an arbitary affine transform matrix to the current path.
Definition: IGraphics.cpp:2737
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.
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:291
float GetScreenScale() const
Gets the screen/display scaling factor, e.g.
Definition: IGraphics.h:1068
void SetSharedResourcesSubPath(const char *sharedResourcesSubPath)
Sets the name of the shared resources subpath.
Definition: IGraphics.h:1576
EUIResizerMode GetResizerMode() const
Definition: IGraphics.h:1100
virtual void CreatePlatformTextEntry(int paramIdx, const IText &text, const IRECT &bounds, int length, const char *str)=0
virtual bool BitmapExtSupported(const char *ext)=0
Checks a file extension and reports whether this drawing API supports loading that extension...
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:2584
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:277
void DisableControl(int paramIdx, bool diable)
Disable or enable controls linked to a specific parameter.
Definition: IGraphics.cpp:461
Common paths useful for plug-ins.
virtual void OnViewInitialized(void *pContext)
Called after platform view initialization, so that drawing classes can e.g.
Definition: IGraphics.h:98
IPlug&#39;s parameter class.
IControl * GetControl(int idx)
Definition: IGraphics.h:1311
void HideControl(int paramIdx, bool hide)
Hide controls linked to a specific parameter.
Definition: IGraphics.cpp:456
void OnMouseUp(const std::vector< IMouseInfo > &points)
Called when the platform class sends mouse up events.
Definition: IGraphics.cpp:1014
void SetControlPosition(int idx, float x, float y)
Reposition a control, redrawing the interface correctly.
Definition: IGraphics.cpp:208
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:2457
void RemoveControlWithTag(int ctrlTag)
Remove controls from the control list with a particular tag.
Definition: IGraphics.cpp:126
virtual void PathStroke(const IPattern &pattern, float thickness, const IStrokeOptions &options=IStrokeOptions(), const IBlend *pBlend=0)=0
Stroke the current current path.
int WindowHeight() const
Gets the height of the graphics context including draw scaling.
Definition: IGraphics.h:1056
virtual const char * GetBundleID()
Get the bundle ID on macOS and iOS, returns emtpy string on other OSs.
Definition: IGraphics.h:931
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:2482
void CalculateTextRotation(const IText &text, const IRECT &bounds, IRECT &rect, double &tx, double &ty) const
Definition: IGraphics.cpp:2212
Used to manage color data, independent of draw class/platform.
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:349
virtual bool PlatformSupportsMultiTouch() const
Definition: IGraphics.h:1124
virtual bool AssetsLoaded()
Specialized in IGraphicsCanvas drawing backend.
Definition: IGraphics.h:1662
virtual void CloseWindow()=0
Close the platform view for this graphics context.
Used to describe a particular gesture.
virtual void RemovePlatformView(void *pView)
Remove a previously attached platform view from the IGraphics view.
Definition: IGraphics.h:785
int GetLastClickedParamForPTAutomation()
[AAX only]
Definition: IGraphics.cpp:1395
virtual void PromptForDirectory(WDL_String &dir)=0
Create a platform file prompt dialog to choose a directory path for opening/saving a directory...
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:631
Used to manage stroke behaviour for path based drawing back ends.
virtual void AttachGestureRecognizer(EGestureType type)
Registers a gesture recognizer with the graphics context.
Definition: IGraphics.cpp:2355
virtual IPopupMenu * CreatePlatformPopupMenu(IPopupMenu &menu, const IRECT &bounds, bool &isAsync)=0
Calls the platform backend to create the platform popup menu.
void SetKeyHandlerFunc(IKeyHandlerFunc func)
Set a function that is called when key presses are not intercepted by any controls.
Definition: IGraphics.h:1162
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:2320
void CreatePopupMenu(IControl &control, IPopupMenu &menu, float x, float y, int valIdx=0)
Shows a pop up/contextual menu at point.
Definition: IGraphics.h:997
User-facing SVG abstraction that you use to manage SVG data ISVG doesn&#39;t actually own the image data...
void SetStrictDrawing(bool strict)
Enables strict drawing mode.
Definition: IGraphics.cpp:907
bool ShowControlBoundsEnabled() const
Definition: IGraphics.h:1142
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:1851
void OnDrop(const char *str, float x, float y)
Definition: IGraphics.cpp:1279
void SetScreenScale(float scale)
Called by the platform IGraphics class when moving to a new screen to set DPI.
Definition: IGraphics.cpp:79
void RemoveControls(int fromIdx)
Remove controls from the control list above a particular index, (frees memory).
Definition: IGraphics.cpp:133
virtual int AlphaChannel() const =0
void GetTouches(IControl *pControl, std::vector< ITouchID > &touchesOnThisControl) const
Populate a vector with the touchIDs active on pControl.
Definition: IGraphics.h:1355
void PushLayer(ILayer *pLayer)
Push a layer on to the stack.
Definition: IGraphics.cpp:1982
virtual void * GetWinModuleHandle()
Definition: IGraphics.h:889
void SetAllControlsDirty()
Calls SetDirty() on every control.
Definition: IGraphics.cpp:543
void OnMouseDown(const std::vector< IMouseInfo > &points)
Called when the platform class sends mouse down events.
Definition: IGraphics.cpp:913
virtual void UpdateLayer()
Implemented by a graphics backend to prepare for drawing to the layer at the top of the stack...
Definition: IGraphics.h:560
IPlug logging a.k.a tracing functionality.
virtual bool SetTextInClipboard(const char *str)=0
Set text in the clipboard.
void PathTransformRestore()
Restore the affine transform of the current path, to the previously saved state.
Definition: IGraphics.cpp:2686
bool OnKeyDown(float x, float y, const IKeyPress &key)
Definition: IGraphics.cpp:1223
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:2363
virtual APIBitmap * LoadAPIBitmap(const char *fileNameOrResID, int scale, EResourceLocation location, const char *ext)=0
Drawing API method to load a bitmap, called internally.
void RemoveControl(int idx)
Remove a control at a particular index, (frees memory).
Definition: IGraphics.cpp:161
void ForAllControlsFunc(std::function< void(IControl *pControl)> func)
For all controls, including the "special controls" call a method.
Definition: IGraphics.cpp:501
IControl * GetControlInTextEntry()
Definition: IGraphics.h:1094
IControl * GetControlWithTag(int ctrlTag) const
Definition: IGraphics.cpp:441
virtual void OnViewDestroyed()
Called after a platform view is destroyed, so that drawing classes can e.g.
Definition: IGraphics.h:101
An editor delegate base class for a SOMETHING that uses IGraphics for it&#39;s UI.
int GetControlTag(const IControl *pControl) const
Get the tag given to a control.
Definition: IGraphics.h:1333
virtual void MoveMouseCursor(float x, float y)=0
Force move the mouse cursor to a specific position.
void SetPlatformContext(void *pContext)
Set the platform draw context Used in order to set the platform level draw context - CGContextRef con...
Definition: IGraphics.h:894
void DoMeasureTextRotation(const IText &text, const IRECT &bounds, IRECT &rect) const
Definition: IGraphics.cpp:2204
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:1937
void EnableLiveEdit(bool enable)
Live edit mode allows you to relocate controls at runtime in debug builds.
Definition: IGraphics.cpp:1506
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:1694
void PathEllipse(const IRECT &bounds)
Add an ellipse to the current path, specifying the rectangular region.
Definition: IGraphics.cpp:2661
int Height() const
Gets the height of the graphics context.
Definition: IGraphics.h:1048
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:1874
An editor delegate base class for a SOMETHING that uses IGraphics for it&#39;s UI.
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:284
void RemovePopupMenuControl()
Remove the IGraphics popup menu, use platform popup menu if available.
Definition: IGraphics.cpp:358
A base control for a pop-up menu/drop-down list that stays within the bounds of the IGraphics context...
void ForStandardControlsFunc(std::function< void(IControl *pControl)> func)
For all standard controls in the main control stack perform a function.
Definition: IGraphics.cpp:495
ILayer * PopLayer()
Pop a layer off the stack.
Definition: IGraphics.cpp:1991
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:764
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:104
A class for setting the contents of a pop up menu.
IText is used to manage font and text/text entry style for a piece of text on the UI...
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:781
virtual void PromptForFile(WDL_String &fileName, WDL_String &path, EFileAction action=EFileAction::Open, const char *extensions=0)=0
Create a platform file prompt dialog to choose a file/directory path for opening/saving a file/direct...
virtual bool LoadAPIFont(const char *fontID, const PlatformFontPtr &font)=0
Drawing API method to load a font from a PlatformFontPtr, called internally.
bool CheckLayer(const ILayerPtr &layer)
Test to see if a layer needs drawing, for instance if the control&#39;s bounds were changed.
Definition: IGraphics.cpp:2009
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:2510
const char * GetSharedResourcesSubPath() const
Gets the name of the shared resources subpath.
Definition: IGraphics.h:1573
bool OnKeyUp(float x, float y, const IKeyPress &key)
Definition: IGraphics.cpp:1251
float GetDrawScale() const
Gets the graphics context scaling factor.
Definition: IGraphics.h:1064
void StyleAllVectorControls(const IVStyle &style)
Helper method to style all of the controls which inherit IVectorBase.
Definition: IGraphics.cpp:1890
bool OnMouseOver(float x, float y, const IMouseMod &mod)
Definition: IGraphics.cpp:1091
virtual void DrawSVG(const ISVG &svg, const IRECT &bounds, const IBlend *pBlend=0)
Draw an SVG image to the graphics context.
Definition: IGraphics.cpp:2762
void AssignParamNameToolTips()
Call this method in order to create tool tips for every IControl that show the associated parameter&#39;s...
Definition: IGraphics.cpp:553
void RemoveAllControls()
Removes all regular IControls from the control list, as well as special controls (frees memory)...
Definition: IGraphics.cpp:188
IPlug Constant definitions, Types, magic numbers.
void SetAllControlsClean()
Calls SetClean() on every control.
Definition: IGraphics.cpp:548
virtual void * GetWindow()=0
Get a pointer to the platform view e.g.
virtual void PathFill(const IPattern &pattern, const IFillOptions &options=IFillOptions(), const IBlend *pBlend=0)=0
Fill the current current path.
void PathTransformSkew(float xAngle, float yAngle)
Apply a skew transform to the current path.
Definition: IGraphics.cpp:2731
virtual void RetainBitmap(const IBitmap &bitmap, const char *cacheName)
Adds an IBitmap to the cache/static storage.
Definition: IGraphics.cpp:1813
void Draw(IRECTList &rects)
Called by the platform class indicating a number of rectangles in the UI that need to redraw...
Definition: IGraphics.cpp:880
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:1640
Performance display meter, based on code from NanoVG This is a special control that lives outside the...
virtual void GetLayerBitmapData(const ILayerPtr &layer, RawBitmapData &data)=0
Get the contents of a layers pixels as bitmap data.
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:1493
void OnGestureRecognized(const IGestureInfo &info)
Called by platform class when a gesture is recognized.
Definition: IGraphics.cpp:2340
void SetPTParameterHighlight(int paramIdx, bool isHighlighted, int color)
[AAX only] See AAX_CEffectGUI::SetControlHighlightInfo()
Definition: IGraphics.cpp:1402
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:2575
void PathClipRegion(const IRECT r=IRECT())
Clip the current path to a particular region.
Definition: IGraphics.cpp:2743
void AttachImGui(std::function< void(IGraphics *)> drawFunc, std::function< void()> setupFunc=nullptr)
Set functions to draw DearImGui widgets on top of the IGraphics context (only relevant when IGRAPHICS...
void OnMouseWheel(float x, float y, const IMouseMod &mod, float delta)
Definition: IGraphics.cpp:1208
virtual void ReleaseBitmap(const IBitmap &bitmap)
Releases an IBitmap from the cache/static storage.
Definition: IGraphics.cpp:1807
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:1172
void GetMouseDownPoint(float &x, float &y) const
Get the x, y position of the last mouse down message.
Definition: IGraphics.h:1530
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:397
The lowest level base class of an IGraphics context.
Definition: IGraphics.h:86
Used to specify properties of a drop-shadow to a layer.
void SearchNextScale(int &sourceScale, int targetScale)
Utility used by SearchImageResource/SearchBitmapInCache.
Definition: IGraphics.cpp:1840
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:583
IRECT GetBounds() const
Returns an IRECT that represents the entire UI bounds This is useful for programatically arranging UI...
Definition: IGraphics.h:1154
A class for setting the contents of a pop up menu.
A control for resizing the plug-in window by clicking and dragging in the bottom right-hand corner Th...
void PathTransformScale(float x, float y)
Apply a scale transform to the current path, with independant x, y scales.
Definition: IGraphics.cpp:2714
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:564
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:2554
void PathCircle(float cx, float cy, float r)
Add a circle to the current path.
Definition: IGraphics.cpp:2666
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:2547
void OnMouseOut()
Called when the mouse leaves the graphics context.
Definition: IGraphics.cpp:1118
void Resize(int w, int h, float scale, bool needsPlatformResize=true)
Definition: IGraphics.cpp:91
void OnTouchCancelled(const std::vector< IMouseInfo > &points)
Called when the platform class sends touch cancel events.
Definition: IGraphics.cpp:1066
void ForControlWithParam(int paramIdx, std::function< void(IControl *pControl)> func)
For all standard controls in the main control stack that are linked to a specific parameter...
Definition: IGraphics.cpp:466
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:2591
void ClearGestureRegions()
Remove all gesture recognizers linked to regions.
Definition: IGraphics.cpp:2370
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:2526
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&#39;...
Definition: IGraphics.cpp:2030
void PathTransformRotate(float angle)
Apply a rotation transform to the current path.
Definition: IGraphics.cpp:2725
A control to enable live modification of control layout in an IGraphics context in debug builds This ...
virtual void PathSetWinding(bool clockwise)
NanoVG only.
Definition: IGraphics.h:667
virtual void ClientToScreen(float &x, float &y)
Convert an x, y position in the view to screen coordinates.
Definition: IGraphics.h:903
int GetParamIdxForPTAutomation(float x, float y)
[AAX only] This can be called by the ProTools API class (e.g.
Definition: IGraphics.cpp:1388
virtual void HideMouseCursor(bool hide=true, bool lock=true)=0
Call to hide/show the mouse cursor.
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:2252
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:2468
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:2752
void ShowFPSDisplay(bool enable)
Shows a control to display the frame rate of drawing.
Definition: IGraphics.cpp:422
void SetControlBounds(int idx, const IRECT &r)
Set a controls target and draw rect to r, redrawing the interface correctly.
Definition: IGraphics.cpp:224
virtual void PathClear()=0
Clear the stack of path drawing commands.
void DrawLayer(const ILayerPtr &layer, const IBlend *pBlend=nullptr)
Draw a layer to the main IGraphics context.
Definition: IGraphics.cpp:2022
virtual float GetBackingPixelScale() const
Definition: IGraphics.h:1720
float GetTotalScale() const
Gets the combined draw and screen/display scaling factor.
Definition: IGraphics.h:1076
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:2622
virtual void DoDrawText(const IText &text, const char *str, const IRECT &bounds, const IBlend *pBlend=nullptr)=0
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:1819
bool GetResizingInProcess() const
Definition: IGraphics.h:1103
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:1593
bool TooltipsEnabled() const
Definition: IGraphics.h:1097
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.
int GetControlIdx(IControl *pControl) const
Definition: IGraphics.h:1315
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 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:747
virtual void GetMouseLocation(float &x, float &y) const =0
Get the x, y position of the mouse cursor.
virtual void ForceEndUserEdit()=0
Call to force end text entry (will cancel any half input text.
A base class interface for a bitmap abstraction around the different drawing back end bitmap represen...
bool EnableMultiTouch(bool enable)
Enable/disable multi touch, if platform supports it.
Definition: IGraphics.h:1107
virtual void * GetDrawContext()=0
Gets a void pointer to underlying drawing context, for the IGraphics backend See draw class implement...
bool ShowingFPSDisplay()
Definition: IGraphics.h:1300
int NControls() const
Definition: IGraphics.h:1387
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...
Definition: IGraphics.cpp:480
bool CanEnableMouseOver() const
Definition: IGraphics.h:1522
void AttachBubbleControl(const IText &text=DEFAULT_TEXT)
Attach the default control to show text as a control changes.
Definition: IGraphics.cpp:337
IGEditorDelegate * GetDelegate()
Gets a pointer to the delegate class that handles communication to and from this graphics context...
Definition: IGraphics.h:1085
int Width() const
Gets the width of the graphics context.
Definition: IGraphics.h:1044
int WindowWidth() const
Gets the width of the graphics context including draw scaling.
Definition: IGraphics.h:1052
void EnableMouseOver(bool enable)
Definition: IGraphics.h:1516
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:2385
IBubbleControl * GetBubbleControl(int i=0)
Definition: IGraphics.h:1372
virtual void * OpenWindow(void *pParentWnd)=0
Open a new platform view for this graphics context.
ILayerPtr EndLayer()
End an IGraphics layer.
Definition: IGraphics.cpp:1977
void PathTransformReset(bool clearStates=false)
Reset the affine transform of the current path, to the default state.
Definition: IGraphics.cpp:2696
void OnDragResize(float x, float y)
Called by ICornerResizerControl as the corner is dragged to resize.
Definition: IGraphics.cpp:1478
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:675
virtual float GetPlatformWindowScale() const
Returns a scaling factor for resizing parent windows via the host/plugin API.
Definition: IGraphics.h:1181
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:778
A special control to draw contextual info as a slider etc is moved If used in the main IControl stack...
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 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:740
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:298
IPopupMenuControl * GetPopupMenuControl()
Definition: IGraphics.h:1366
void OnSetCursor()
Called when the mouse enters the graphics context, to update the cursor to mCursorType.
Definition: IGraphics.h:1502
virtual float DoMeasureText(const IText &text, const char *str, IRECT &bounds) const =0
void PathRadialLine(float cx, float cy, float angle, float rMin, float rMax)
Add a radial line to the current path.
Definition: IGraphics.cpp:771
void ShowControlBounds(bool enable)
Definition: IGraphics.h:1133
IRECT GetPixelSnapped(IRECT &r) const
Gets the nearest backing pixel aligned rect to the input IRECT.
Definition: IGraphics.h:1081
int GetMouseOver() const
Definition: IGraphics.h:1525
void PathLine(float x1, float y1, float x2, float y2)
Add a line to the current path.
Definition: IGraphics.h:583
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:538
virtual bool WindowIsOpen()
Definition: IGraphics.h:828
ITextEntryControl * GetTextEntryControl()
Definition: IGraphics.h:1369
IPopupMenu & GetPromptMenu()
Definition: IGraphics.h:1088
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:2775
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:2503
virtual bool PromptForColor(IColor &color, const char *str="", IColorPickerHandlerFunc func=nullptr)=0
Create a platform color chooser dialog.
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:2568
virtual EMsgBoxResult ShowMessageBox(const char *str, const char *caption, EMsgBoxType type, IMsgBoxCompletionHanderFunc completionHandler=nullptr)=0
Pop up a modal platform message box dialog.
bool IsInPlatformTextEntry()
Definition: IGraphics.h:1091
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.
std::unique_ptr< ILayer > ILayerPtr
ILayerPtr is a managed pointer for transferring the ownership of layers.
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:252
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:2402
Used to store pattern information for gradients.
virtual bool LoadFont(const char *fontID, const char *fileNameOrResID)
Load a font to be used by the graphics context.
Definition: IGraphics.cpp:2153
Used to store transformation matrices.
Used for key press info, such as ASCII representation, virtual key (mapped to win32 codes) and modifi...
Definition: IPlugStructs.h:612
void SetTabletInput(bool tablet)
Set by the platform class if the mouse input is coming from a tablet/stylus.
Definition: IGraphics.h:1534
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:2540
A struct encapsulating a set of properties used to configure IVControls.
virtual float MeasureText(const IText &text, const char *str, IRECT &bounds) const
Measure the rectangular region that some text will occupy.
Definition: IGraphics.cpp:639
int GetIdxOfTaggedControl(int ctrlTag) const
Gets the index of a tagged control.
Definition: IGraphics.h:1320
bool ControlIsCaptured() const
Check to see if any control is captured.
Definition: IGraphics.h:1345
void PathTriangle(float x1, float y1, float x2, float y2, float x3, float y3)
Add a triangle to the current path.
Definition: IGraphics.cpp:2605
virtual const char * GetDrawingAPIStr()=0
An abstraction that is used to store a temporary raster image/framebuffer.
virtual void UpdateTooltips()=0
Call this if you modify control tool tips at runtime.