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

#include <contract_editor_session.hpp>

Classes

struct  HostHooks
 What the adapter does for the editor's context. More...

Public Types

enum class  IdleSource : std::uint8_t { self_paced , host_driven }
 Who calls tick() while attached. More...

Public Member Functions

 ~ContractEditorSession ()
 ContractEditorSession (const ContractEditorSession &)=delete
ContractEditorSession & operator= (const ContractEditorSession &)=delete
Editor * editor () const
 The editor, or null after invalidate().
StateStoreParamPort * param_port () const
 This session's parameter port, or null after invalidate().
bool is_attached () const
bool attach (const NativeParent &parent)
 Attach the editor to parent and start the idle tick.
void detach ()
 Stop the tick, release every gesture this session holds, then detach the editor.
void close_for_owner ()
 The processor is going away while the host's window still exists: stop the tick, release every gesture, detach the editor if attached, then destroy it.
void invalidate ()
 The host's window is already gone: stop the tick, release every gesture, invalidate the editor and destroy it.
void use_self_paced_idle ()
 Tick from the session's own timer from now on, for an adapter whose host timer is unavailable.
IdleSource idle_source () const
 Who calls tick() while attached.
void tick ()
 One idle tick: Editor::idle() while attached.
bool register_with (ContractSessionRegistry &registry)
 Be closed by registry when its adapter instance goes away first.
void disconnect_owner ()
 The owner is going away on another thread: release every gesture, cut the port from the store and refuse the context's host hooks.
EditorSize size () const
 The editor's size, or its preferred size while it reports none.
ViewSize size_hints () const
 The editor's size hints (defaults when the editor is gone).
bool set_size (std::uint32_t width, std::uint32_t height)
 A host resize, keeping the scale the editor reports.
bool set_scale (double scale)
 A new content scale at the current size.
bool resizable () const
 False only for an editor whose hints fix its size (equal, non-zero minimum and maximum on both axes).
bool constrain (std::uint32_t &width, std::uint32_t &height) const
 Adjust a proposed size through the editor, then clamp it to the hints.
KeyDisposition offer_key (const EditorKeyEvent &event)
 Offer a key. Forward when not attached.
void focus_changed (bool focused)
void visibility_changed (bool visible)

Static Public Member Functions

static std::unique_ptr< ContractEditorSession > create (Processor &processor, state::StateStore &store, EditorFactory &factory, HostHooks hooks, IdleSource idle=IdleSource::self_paced)
 A session over a new editor from factory, or null when the factory does not offer the editor role or builds no editor.

Static Public Attributes

static constexpr int kIdleIntervalMs = 16
 Interval of the session's own idle tick while attached (about 60 Hz).

Friends

class ContractSessionRegistry

Member Enumeration Documentation

◆ IdleSource

enum class pulp::format::ContractEditorSession::IdleSource : std::uint8_t
strong

Who calls tick() while attached.

Enumerator
self_paced 

the session's own main-thread chain

host_driven 

the adapter, from a host timer

Constructor & Destructor Documentation

◆ ~ContractEditorSession()

pulp::format::ContractEditorSession::~ContractEditorSession ( )

◆ ContractEditorSession()

pulp::format::ContractEditorSession::ContractEditorSession ( const ContractEditorSession & )
delete

Member Function Documentation

◆ attach()

bool pulp::format::ContractEditorSession::attach ( const NativeParent & parent)

Attach the editor to parent and start the idle tick.

False when the session is already attached, the parent is empty or of no kind, or the editor refuses it.

◆ close_for_owner()

void pulp::format::ContractEditorSession::close_for_owner ( )

The processor is going away while the host's window still exists: stop the tick, release every gesture, detach the editor if attached, then destroy it.

Every later call is a refusal.

◆ constrain()

bool pulp::format::ContractEditorSession::constrain ( std::uint32_t & width,
std::uint32_t & height ) const

Adjust a proposed size through the editor, then clamp it to the hints.

False when nothing usable results.

◆ create()

std::unique_ptr< ContractEditorSession > pulp::format::ContractEditorSession::create ( Processor & processor,
state::StateStore & store,
EditorFactory & factory,
HostHooks hooks,
IdleSource idle = IdleSource::self_paced )
static

A session over a new editor from factory, or null when the factory does not offer the editor role or builds no editor.

◆ detach()

void pulp::format::ContractEditorSession::detach ( )

Stop the tick, release every gesture this session holds, then detach the editor.

A no-op when not attached.

◆ disconnect_owner()

void pulp::format::ContractEditorSession::disconnect_owner ( )

The owner is going away on another thread: release every gesture, cut the port from the store and refuse the context's host hooks.

Any thread. The editor stays attached, but is no longer ticked, until close_for_owner() runs on the main thread.

◆ editor()

Editor * pulp::format::ContractEditorSession::editor ( ) const
inline

The editor, or null after invalidate().

◆ focus_changed()

void pulp::format::ContractEditorSession::focus_changed ( bool focused)

◆ idle_source()

IdleSource pulp::format::ContractEditorSession::idle_source ( ) const
inline

Who calls tick() while attached.

◆ invalidate()

void pulp::format::ContractEditorSession::invalidate ( )

The host's window is already gone: stop the tick, release every gesture, invalidate the editor and destroy it.

Every later call is a refusal.

◆ is_attached()

bool pulp::format::ContractEditorSession::is_attached ( ) const
inline

◆ offer_key()

KeyDisposition pulp::format::ContractEditorSession::offer_key ( const EditorKeyEvent & event)

Offer a key. Forward when not attached.

◆ operator=()

ContractEditorSession & pulp::format::ContractEditorSession::operator= ( const ContractEditorSession & )
delete

◆ param_port()

StateStoreParamPort * pulp::format::ContractEditorSession::param_port ( ) const
inline

This session's parameter port, or null after invalidate().

◆ register_with()

bool pulp::format::ContractEditorSession::register_with ( ContractSessionRegistry & registry)

Be closed by registry when its adapter instance goes away first.

The session must be owned by a std::shared_ptr; false otherwise.

◆ resizable()

bool pulp::format::ContractEditorSession::resizable ( ) const

False only for an editor whose hints fix its size (equal, non-zero minimum and maximum on both axes).

◆ set_scale()

bool pulp::format::ContractEditorSession::set_scale ( double scale)

A new content scale at the current size.

◆ set_size()

bool pulp::format::ContractEditorSession::set_size ( std::uint32_t width,
std::uint32_t height )

A host resize, keeping the scale the editor reports.

◆ size()

EditorSize pulp::format::ContractEditorSession::size ( ) const

The editor's size, or its preferred size while it reports none.

◆ size_hints()

ViewSize pulp::format::ContractEditorSession::size_hints ( ) const

The editor's size hints (defaults when the editor is gone).

◆ tick()

void pulp::format::ContractEditorSession::tick ( )

One idle tick: Editor::idle() while attached.

◆ use_self_paced_idle()

void pulp::format::ContractEditorSession::use_self_paced_idle ( )

Tick from the session's own timer from now on, for an adapter whose host timer is unavailable.

Starts the tick at once when attached.

◆ visibility_changed()

void pulp::format::ContractEditorSession::visibility_changed ( bool visible)

◆ ContractSessionRegistry

friend class ContractSessionRegistry
friend

Member Data Documentation

◆ kIdleIntervalMs

int pulp::format::ContractEditorSession::kIdleIntervalMs = 16
staticconstexpr

Interval of the session's own idle tick while attached (about 60 Hz).


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