20 #include "IPlugWebView.h" 23 BEGIN_IGRAPHICS_NAMESPACE
27 using onReadyFunc = std::function<void(IWebViewControl* pWebView)>;
28 using onMessageFunc = std::function<void(IWebViewControl* pWebView, const char* jsonMsg)>;
46 IWebViewControl(
const IRECT& bounds,
bool opaque, onReadyFunc readyFunc, onMessageFunc msgFunc =
nullptr,
const char* dllPath =
"",
const char* tmpPath =
"")
49 , mOnReadyFunc(readyFunc)
50 , mOnMessageFunc(msgFunc)
53 SetWebViewPaths(dllPath, tmpPath);
60 mPlatformView =
nullptr;
74 void OnWebViewReady()
override 80 void OnMessageFromWebView(
const char* json)
override 83 mOnMessageFunc(
this, json);
97 void* mPlatformView =
nullptr;
98 onReadyFunc mOnReadyFunc;
99 onMessageFunc mOnMessageFunc;
102 END_IGRAPHICS_NAMESPACE
The lowest level base class of an IGraphics control.
Used to manage a rectangular area, independent of draw class/platform.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
A control that allows the embedding of HTML UI inside an IGraphics context using a platform-native we...
virtual void RemovePlatformView(void *pView)
Remove a previously attached platform view from the IGraphics view.
This file contains the base IControl implementation, along with some base classes for specific types ...
virtual void AttachPlatformView(const IRECT &r, void *pView)
Add an OS view as a sub-view, on top of the IGraphics view.
The lowest level base class of an IGraphics context.
void OnAttached() override
Called after the control has been attached, and its delegate and graphics member variable set...
void OnRescale() override
Implement to do something when graphics is scaled globally (e.g.
float GetTotalScale() const
Gets the combined draw and screen/display scaling factor.
float L
Left side of the rectangle (X)
IWebViewControl(const IRECT &bounds, bool opaque, onReadyFunc readyFunc, onMessageFunc msgFunc=nullptr, const char *dllPath="", const char *tmpPath="")
Constructs am IWebViewControl.
void OnResize() override
Called when IControl is constructed or resized using SetRect().
float T
Top of the rectangle (Y)