Convenience wrapper layer implementing the creation and management of a choc::ui::WebView
. Still abstract, as setParams
is left up to the user to implement in a way they see fit.
More...
#include <mostlyharmless_WebviewBase.h>
Classes | |
struct | Options |
Contains a set of options to construct the internal webview with. More... | |
struct | Resource |
Tiny container struct for web resources. More... | |
Public Member Functions | |
WebviewBase (std::uint32_t initialWidth, std::uint32_t initialHeight, Colour backgroundColour) | |
~WebviewBase () noexcept override | |
void | setOptions (Options &&options) noexcept |
void | initialise () override |
void | destroy () override |
void | setSize (std::uint32_t width, std::uint32_t height) override |
void | getSize (std::uint32_t *width, std::uint32_t *height) override |
void | setParent (void *parentHandle) override |
void | show () override |
void | hide () override |
void | onParamEvent (events::ProcToGuiParamEvent event) override=0 |
![]() | |
virtual | ~IEditor () noexcept=default |
Protected Attributes | |
choc::ui::WebView * | m_internalWebview { nullptr } |
Convenience wrapper layer implementing the creation and management of a choc::ui::WebView
. Still abstract, as setParams
is left up to the user to implement in a way they see fit.
Provides a "clean slate" for a webview based gui, providing windowing, a handle to the internal choc webview, and not much else. If you want a more complete solution, consider deriving from (or directly using) WebviewEditor instead, which has opinionated parameter handling, etc. This class' raison d'etre, then, is for a situation where you have your own strong opinions about how events etc should be handled, but don't want to deal with windowing yourself.
The underlying choc::ui::WebView
can be accessed via the protected m_internalWebview
member. If you don't call setOptions
before initialise is called, then the internal webview will be constructed with some default options, namely:
mostly_harmless::gui::WebviewBase::WebviewBase | ( | std::uint32_t | initialWidth, |
std::uint32_t | initialHeight, | ||
Colour | backgroundColour ) |
|
overridenoexcept |
|
overridevirtual |
Called when the editor is closed.
Implements mostly_harmless::core::IEditor.
|
overridevirtual |
Queries the editor about the size of its window. Initially, the parent window's size depends entirely on this call.
width | A pointer to the width, to set. |
height | A pointer to the height, to set. |
Implements mostly_harmless::core::IEditor.
|
overridevirtual |
Called when the editor should hide.
Implements mostly_harmless::core::IEditor.
|
overridevirtual |
Called immediately after the gui has been created - use this to perform any post-creation initialisation.
Implements mostly_harmless::core::IEditor.
Reimplemented in mostly_harmless::gui::WebviewEditor.
|
overridepure virtual |
Called via the internal gui dispatch thread when a new parameter event is sent by the host - use this hook to sync the changes with the gui!
Implements mostly_harmless::core::IEditor.
Implemented in mostly_harmless::gui::WebviewEditor.
|
noexcept |
|
overridevirtual |
Use this function to add your custom window to the parent view.
parentHandle | A void* to the parent window's handle - the actual type is platform specific (HWND on Windows, NSView on macOS). |
Implements mostly_harmless::core::IEditor.
|
overridevirtual |
Called when the size of the parent window has been changed.
width | The new parent width. |
height | The new parent height. |
Implements mostly_harmless::core::IEditor.
|
overridevirtual |
Called when the editor should show.
Implements mostly_harmless::core::IEditor.
|
protected |