Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::format::Editor Class Referenceabstract

One editor instance in one native window. More...

#include <editor_host.hpp>

Public Member Functions

virtual ~Editor ()=default
virtual bool supports_parent (NativeParentKind kind) const =0
 Whether this editor can attach to a parent of kind.
virtual bool attach (const NativeParent &parent)=0
 Attach to and start drawing into parent.
virtual void detach ()=0
 Stop drawing and remove everything the editor added to its parent.
virtual void invalidate ()=0
 The host's window is already gone or about to be destroyed by the host itself.
virtual EditorSize size () const =0
 The editor's current size.
virtual bool set_size (const EditorSize &size)=0
 The host resized the window (or changed its scale).
virtual ViewSize size_hints () const
 Preferred, minimum and maximum size and the aspect ratio to hold.
virtual EditorSize adjust_size (const EditorSize &proposed) const
 The nearest size to proposed this editor accepts, for a host that negotiates during an interactive resize.
virtual void idle ()
 Main-thread tick from the host (a timer or the window's frame clock).
virtual void visibility_changed (bool)
 The editor's window became visible or hidden without being detached.
virtual void focus_changed (bool)
 The editor's window gained or lost keyboard focus.
virtual KeyDisposition offer_key (const EditorKeyEvent &)
 A key the host would otherwise act on itself, offered synchronously before it does.
virtual void parameter_highlight (state::ParamID, bool, std::uint32_t)
 The host highlights or un-highlights a parameter's control (for example while it is automation-enabled).
virtual EditorAutomation * automation ()
 The editor's automation surface, or null when it has none.

Detailed Description

One editor instance in one native window.

Lifecycle: the factory creates it unattached. The size members may be called before the first attach(): some hosts negotiate scale and size first and only then hand over a window, and some defer attaching until the host's size settles. The host then calls attach() with its window, any of the members below, and detach(); the editor may be attached again or destroyed. If the host's window is going away underneath the editor without an orderly detach, the host calls invalidate() instead.

Every member runs on the host's main thread.

Reaching the plug-in: an editor reaches parameter and visual state only through its EditorContext ports. Once the host has called invalidate(), or has begun closing the editor because its plug-in instance is going away (including a teardown off the main thread, where the instance is destroyed before the editor's close runs on the main thread), the editor must not use the Processor& it was created with: that processor may already be gone. Its ports are disconnected by then and refuse every call, so an editor that only uses its context stays safe.

Constructor & Destructor Documentation

◆ ~Editor()

virtual pulp::format::Editor::~Editor ( )
virtualdefault

Member Function Documentation

◆ adjust_size()

virtual EditorSize pulp::format::Editor::adjust_size ( const EditorSize & proposed) const
inlinevirtual

The nearest size to proposed this editor accepts, for a host that negotiates during an interactive resize.

Default: proposed.

◆ attach()

virtual bool pulp::format::Editor::attach ( const NativeParent & parent)
pure virtual

Attach to and start drawing into parent.

False if the editor cannot attach to it, in which case it stays unattached.

◆ automation()

virtual EditorAutomation * pulp::format::Editor::automation ( )
inlinevirtual

The editor's automation surface, or null when it has none.

Owned by the editor and valid while the editor lives.

◆ detach()

virtual void pulp::format::Editor::detach ( )
pure virtual

Stop drawing and remove everything the editor added to its parent.

The parent is still valid during the call. A no-op when not attached.

◆ focus_changed()

virtual void pulp::format::Editor::focus_changed ( bool )
inlinevirtual

The editor's window gained or lost keyboard focus.

◆ idle()

virtual void pulp::format::Editor::idle ( )
inlinevirtual

Main-thread tick from the host (a timer or the window's frame clock).

◆ invalidate()

virtual void pulp::format::Editor::invalidate ( )
pure virtual

The host's window is already gone or about to be destroyed by the host itself.

Release every reference to the parent without touching it and make no further host calls; the editor is detached afterwards and is normally destroyed next.

◆ offer_key()

virtual KeyDisposition pulp::format::Editor::offer_key ( const EditorKeyEvent & )
inlinevirtual

A key the host would otherwise act on itself, offered synchronously before it does.

Return consumed only when the editor needs the key (a focused text field, an open popup); otherwise forward so the host keeps its shortcuts, Space for transport in particular.

◆ parameter_highlight()

virtual void pulp::format::Editor::parameter_highlight ( state::ParamID ,
bool ,
std::uint32_t  )
inlinevirtual

The host highlights or un-highlights a parameter's control (for example while it is automation-enabled).

color_rgb is 0xRRGGBB.

◆ set_size()

virtual bool pulp::format::Editor::set_size ( const EditorSize & size)
pure virtual

The host resized the window (or changed its scale).

Returns false when the editor cannot take that size; the host then asks adjust_size().

◆ size()

virtual EditorSize pulp::format::Editor::size ( ) const
pure virtual

The editor's current size.

◆ size_hints()

virtual ViewSize pulp::format::Editor::size_hints ( ) const
inlinevirtual

Preferred, minimum and maximum size and the aspect ratio to hold.

Equal minimum and maximum mean a fixed-size editor. The default reports the current size as preferred and no bounds.

◆ supports_parent()

virtual bool pulp::format::Editor::supports_parent ( NativeParentKind kind) const
pure virtual

Whether this editor can attach to a parent of kind.

A host asks before choosing a windowing API.

◆ visibility_changed()

virtual void pulp::format::Editor::visibility_changed ( bool )
inlinevirtual

The editor's window became visible or hidden without being detached.


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/format/include/pulp/format/editor_host.hpp