Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::ui::ActionRef Class Reference

Weak UI-affine action identity; owner retirement never leaves an executable callback. More...

#include <ui_action.hpp>

Public Member Functions

 ActionRef ()=default
 Empty weak identity; operations return CLOSED.
std::expected< std::shared_ptr< const ActionMetadata >, TreeError > snapshot () const
EditorCommandResult set (ActionMetadata metadata, std::source_location origin=std::source_location::current()) const
EditorCommandResult rebind (Action action, std::source_location origin=std::source_location::current()) const
EditorCommandResult remove (std::source_location origin=std::source_location::current()) const
EditorCommandResult invoke (ActionInvocation invocation={}, std::source_location origin=std::source_location::current()) const
EditorCommandResult operator() (const KeyEvent &event) const
EditorCommandResult operator() (const ClickEvent &event) const

Friends

class ActionSet
struct detail::ActionAccess

Detailed Description

Weak UI-affine action identity; owner retirement never leaves an executable callback.

Member Function Documentation

◆ invoke()

EditorCommandResult portals::ui::ActionRef::invoke ( ActionInvocation invocation = {},
std::source_location origin = std::source_location::current() ) const
Parameters
invocationExplicit original input context.
originInvocation site retained for an unreported callback error.
Returns
Existing checked command receipt; hidden/disabled actions succeed without callback entry.

◆ operator()() [1/2]

EditorCommandResult portals::ui::ActionRef::operator() ( const ClickEvent & event) const
Parameters
eventExisting button activation.
Returns
Exact command receipt with source/modifiers preserved.

◆ operator()() [2/2]

EditorCommandResult portals::ui::ActionRef::operator() ( const KeyEvent & event) const
Parameters
eventExisting keyboard input.
Returns
Exact command receipt for existing managed adapters.

◆ rebind()

EditorCommandResult portals::ui::ActionRef::rebind ( Action action,
std::source_location origin = std::source_location::current() ) const
Parameters
actionReplacement callback and metadata; the currently admitted callback stays alive.
originRegistration site.
Returns
Checked result; failed preparation preserves the original callback and state.

◆ remove()

EditorCommandResult portals::ui::ActionRef::remove ( std::source_location origin = std::source_location::current()) const
Parameters
originRetirement site.
Returns
Success or typed availability error; self-removal is safe.

◆ set()

EditorCommandResult portals::ui::ActionRef::set ( ActionMetadata metadata,
std::source_location origin = std::source_location::current() ) const
Parameters
metadataCandidate common state, atomically committed after all new storage is ready.
originPublic mutation site retained in existing diagnostics.
Returns
Checked result, also collected once when the attached scene is live.

◆ snapshot()

std::expected< std::shared_ptr< const ActionMetadata >, TreeError > portals::ui::ActionRef::snapshot ( ) const
Returns
Owning immutable metadata, or WRONG_THREAD/CLOSED/STALE_NODE/admission failure.

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