iPlug2 - C++ Audio Plug-in Framework
IGraphicsIOS.h
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 
13 #include "IGraphics_select.h"
14 
15 BEGIN_IPLUG_NAMESPACE
16 BEGIN_IGRAPHICS_NAMESPACE
17 
18 extern void GetScreenDimensions(int& width, int& height);
19 
20 extern float GetScaleForScreen(int width, int height);
21 
24 class IGraphicsIOS final : public IGRAPHICS_DRAW_CLASS
25 {
26 public:
27  IGraphicsIOS(IGEditorDelegate& dlg, int w, int h, int fps, float scale);
28  virtual ~IGraphicsIOS();
29 
30  void SetBundleID(const char* bundleID) { mBundleID.Set(bundleID); }
31 
32  void* OpenWindow(void* pWindow) override;
33  void CloseWindow() override;
34  bool WindowIsOpen() override;
35  void PlatformResize(bool parentHasResized) override;
36  void AttachPlatformView(const IRECT& r, void* pView) override;
37  void RemovePlatformView(void* pView) override;
38 
39  void GetMouseLocation(float& x, float&y) const override;
40 
41  EMsgBoxResult ShowMessageBox(const char* str, const char* caption, EMsgBoxType type, IMsgBoxCompletionHanderFunc completionHandler) override;
42  void ForceEndUserEdit() override;
43 
44  const char* GetPlatformAPIStr() override;
45 
46  void UpdateTooltips() override {};
47 
48  void PromptForFile(WDL_String& fileName, WDL_String& path, EFileAction action, const char* ext) override;
49  void PromptForDirectory(WDL_String& dir) override;
50  bool PromptForColor(IColor& color, const char* str, IColorPickerHandlerFunc func) override;
51 
52  void HideMouseCursor(bool hide, bool lock) override {}; // NOOP
53  void MoveMouseCursor(float x, float y) override {}; // NOOP
54 
55  bool OpenURL(const char* url, const char* msgWindowTitle, const char* confirmMsg, const char* errMsgOnFailure) override;
56 
57  void* GetWindow() override;
58 
59  const char* GetBundleID() override { return mBundleID.Get(); }
60  static int GetUserOSVersion();
61 
62  bool GetTextFromClipboard(WDL_String& str) override;
63  bool SetTextInClipboard(const char* str) override;
64 
65  void CreatePlatformImGui() override;
66 
67  void LaunchBluetoothMidiDialog(float x, float y);
68 
69  void AttachGestureRecognizer(EGestureType type) override;
70 
71  bool PlatformSupportsMultiTouch() const override { return true; }
72 
73 protected:
74  PlatformFontPtr LoadPlatformFont(const char* fontID, const char* fileNameOrResID) override;
75  PlatformFontPtr LoadPlatformFont(const char* fontID, const char* fontName, ETextStyle style) override;
76  PlatformFontPtr LoadPlatformFont(const char* fontID, void* pData, int dataSize) override;
77  void CachePlatformFont(const char* fontID, const PlatformFontPtr& font) override;
78 
79  IPopupMenu* CreatePlatformPopupMenu(IPopupMenu& menu, const IRECT& bounds, bool& isAsync) override;
80  void CreatePlatformTextEntry(int paramIdx, const IText& text, const IRECT& bounds, int length, const char* str) override;
81 
82 private:
83  void* mView = nullptr;
84  void* mImGuiView = nullptr;
85 
86  WDL_String mBundleID;
87 };
88 
89 END_IGRAPHICS_NAMESPACE
90 END_IPLUG_NAMESPACE
Used to manage a rectangular area, independent of draw class/platform.
Used for choosing a drawing backend.
Used to manage color data, independent of draw class/platform.
An editor delegate base class for a SOMETHING that uses IGraphics for it's UI.
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...
IGraphics platform class for IOS.
Definition: IGraphicsIOS.h:24