DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
dspark::plugin::webview_ui::Editor< P > Class Template Reference

One embedded WebView editor instance for plugin class P. Owned by the format backends (the VST3 IPlugView object, the CLAP gui extension); plugin authors never touch this class - they only provide editorHtml() and friends. More...

#include <DSParkWebViewEditor.h>

Public Member Functions

void pump () noexcept
 
 Editor ()=default
 
 ~Editor ()
 
 Editor (const Editor &)=delete
 
Editoroperator= (const Editor &)=delete
 
bool create (void *parentWindow, const std::atomic< double > *shadows, const HostCallbacks &host) noexcept
 
void destroy () noexcept
 
void setBounds (int width, int height) noexcept
 
void setVisible (bool visible) noexcept
 
bool queryParentSize (int &width, int &height) const noexcept
 
bool created () const noexcept
 

Static Public Member Functions

static bool available () noexcept
 

Static Public Attributes

static constexpr bool kAvailable = (DSPARK_WEBVIEW_BACKEND != 0)
 

Detailed Description

template<typename P>
class dspark::plugin::webview_ui::Editor< P >

One embedded WebView editor instance for plugin class P. Owned by the format backends (the VST3 IPlugView object, the CLAP gui extension); plugin authors never touch this class - they only provide editorHtml() and friends.

Lifecycle (all on the host's main thread): create(parent, ...) builds the platform web engine inside the host window and loads the page; setBounds follows host resizes; destroy tears everything down. While alive, the page polls the wrapper's normalized shadows for DSP -> UI sync and pushes edits through HostCallbacks for UI -> DSP.

Definition at line 681 of file DSParkWebViewEditor.h.

Constructor & Destructor Documentation

◆ Editor() [1/2]

template<typename P >
dspark::plugin::webview_ui::Editor< P >::Editor ( )
default

◆ ~Editor()

template<typename P >
dspark::plugin::webview_ui::Editor< P >::~Editor ( )
inline

Definition at line 722 of file DSParkWebViewEditor.h.

◆ Editor() [2/2]

template<typename P >
dspark::plugin::webview_ui::Editor< P >::Editor ( const Editor< P > &  )
delete

Member Function Documentation

◆ available()

template<typename P >
static bool dspark::plugin::webview_ui::Editor< P >::available ( )
inlinestaticnoexcept

Runtime availability: kAvailable AND the platform engine can actually run here. On Linux that means WebKitGTK/GTK3 resolved through dlopen (first call loads it, later calls are free); elsewhere it equals kAvailable. The format backends gate their editor offer on this, so hosts on bare systems fall back to their generic UI cleanly.

Definition at line 697 of file DSParkWebViewEditor.h.

◆ create()

template<typename P >
bool dspark::plugin::webview_ui::Editor< P >::create ( void *  parentWindow,
const std::atomic< double > *  shadows,
const HostCallbacks host 
)
inlinenoexcept

Builds the web engine inside parentWindow (HWND on Windows, NSView* on macOS), loads the user page and starts the bridge. shadows is the wrapper's normalized shadow array (read-only here); host receives UI edits. Returns false when the engine is unavailable (the host then falls back to its generic editor).

Definition at line 734 of file DSParkWebViewEditor.h.

◆ created()

template<typename P >
bool dspark::plugin::webview_ui::Editor< P >::created ( ) const
inlinenoexcept

Definition at line 783 of file DSParkWebViewEditor.h.

◆ destroy()

template<typename P >
void dspark::plugin::webview_ui::Editor< P >::destroy ( )
inlinenoexcept

Tears the web engine down. Safe to call twice; never touches the host window.

Definition at line 746 of file DSParkWebViewEditor.h.

◆ operator=()

template<typename P >
Editor & dspark::plugin::webview_ui::Editor< P >::operator= ( const Editor< P > &  )
delete

◆ pump()

template<typename P >
void dspark::plugin::webview_ui::Editor< P >::pump ( )
inlinenoexcept

Gives the engine main-loop time from the HOST's run loop. On Linux the format backends call this at ~30 Hz (VST3 IRunLoop timer / CLAP timer-support) to iterate the GLib main context - a plugin must never spin its own GTK loop inside a host. No-op on Windows/macOS, where the host's native message loop already drives the engine.

Definition at line 713 of file DSParkWebViewEditor.h.

◆ queryParentSize()

template<typename P >
bool dspark::plugin::webview_ui::Editor< P >::queryParentSize ( int &  width,
int &  height 
) const
inlinenoexcept

Reads the CURRENT size of the host window we are embedded in (physical pixels on Windows). Lets the backends fit the page to whatever box the host actually created, even when its negotiation calls arrived in an unexpected order. Returns false where the parent cannot be queried (then the negotiated size is used as-is).

Note on DPI: the web engine applies the window's scale factor itself (CSS pixels are device-independent), so the page never needs zooming - the wrapper only converts logical <-> physical for host negotiation.

Definition at line 778 of file DSParkWebViewEditor.h.

◆ setBounds()

template<typename P >
void dspark::plugin::webview_ui::Editor< P >::setBounds ( int  width,
int  height 
)
inlinenoexcept

Resizes the embedded view to the host-given box (origin stays 0,0).

Definition at line 754 of file DSParkWebViewEditor.h.

◆ setVisible()

template<typename P >
void dspark::plugin::webview_ui::Editor< P >::setVisible ( bool  visible)
inlinenoexcept

Shows/hides the embedded view (CLAP hosts drive this explicitly).

Definition at line 761 of file DSParkWebViewEditor.h.

Member Data Documentation

◆ kAvailable

template<typename P >
constexpr bool dspark::plugin::webview_ui::Editor< P >::kAvailable = (DSPARK_WEBVIEW_BACKEND != 0)
staticconstexpr

True when this platform can embed a WebView editor (see file docs).

Definition at line 688 of file DSParkWebViewEditor.h.


The documentation for this class was generated from the following file: