13#include <emscripten.h>
14#include <emscripten/val.h>
15#include <emscripten/bind.h>
16#include <emscripten/html5.h>
25using namespace emscripten;
28BEGIN_IGRAPHICS_NAMESPACE
30static val GetPreloadedImages()
32 return val::global(
"Browser")[
"preloadedImages"];
35extern void GetScreenDimensions(
int& width,
int& height);
61 void DrawResize()
override;
62 void PostResize()
override;
64 const char* GetPlatformAPIStr()
override {
return "WEB"; }
66 void HideMouseCursor(
bool hide,
bool lock)
override;
67 void MoveMouseCursor(
float x,
float y)
override { }
68 ECursor SetMouseCursor(ECursor cursorType)
override;
69 void GetMouseLocation(
float& x,
float&y)
const override;
71 void ForceEndUserEdit()
override {}
72 void* OpenWindow(
void* pParent)
override;
73 void CloseWindow()
override {}
74 void* GetWindow()
override {
return nullptr; }
75 bool WindowIsOpen()
override {
return GetWindow(); }
76 bool GetTextFromClipboard(WDL_String& str)
override { str.Set(mClipboardText.Get());
return true; }
77 bool SetTextInClipboard(
const char* str)
override { mClipboardText.Set(str);
return true; }
78 void UpdateTooltips()
override {}
79 EMsgBoxResult ShowMessageBox(
const char* str,
const char* title, EMsgBoxType type, IMsgBoxCompletionHandlerFunc completionHandler)
override;
81 void PromptForFile(WDL_String& filename, WDL_String& path, EFileAction action,
const char* ext, IFileDialogCompletionHandlerFunc completionHandler)
override;
82 void PromptForDirectory(WDL_String& path, IFileDialogCompletionHandlerFunc completionHandler)
override;
83 bool PromptForColor(
IColor& color,
const char* str, IColorPickerHandlerFunc func)
override;
84 bool OpenURL(
const char* url,
const char* msgWindowTitle,
const char* confirmMsg,
const char* errMsgOnFailure)
override;
86 bool PlatformSupportsMultiTouch()
const override {
return true; }
89 static void OnMainLoopTimer();
95 void CreatePlatformTextEntry(
int paramIdx,
const IText& text,
const IRECT& bounds,
int length,
const char* str)
override;
98 void RegisterCanvasEvents();
99 void UnregisterCanvasEvents();
101 PlatformFontPtr LoadPlatformFont(
const char* fontID,
const char* fileNameOrResID)
override;
102 PlatformFontPtr LoadPlatformFont(
const char* fontID,
const char* fontName, ETextStyle style)
override;
103 PlatformFontPtr LoadPlatformFont(
const char* fontID,
void* pData,
int dataSize)
override;
104 void CachePlatformFont(
const char* fontID,
const PlatformFontPtr& font)
override {}
106 WDL_String mClipboardText;
107 val mCanvas = val::undefined();
108 val mRootNode = val::undefined();
109 bool mInShadowDOM =
false;
110 std::string mCanvasSelector;
113END_IGRAPHICS_NAMESPACE
Used for choosing a drawing backend.
An editor delegate base class that uses IGraphics for the UI.
IGraphics platform class for the web.
bool IsInShadowDOM() const
Check if this instance is running inside Shadow DOM.
val GetCanvas() const
Get the canvas element for this instance.
Used to manage color data, independent of draw class/platform.
Used to manage a rectangular area, independent of draw class/platform.
IText is used to manage font and text/text entry style for a piece of text on the UI,...