MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ destroy()

MAYAFLUX_API void MayaFlux::Portal::Forma::destroy ( Surface &  surface,
uint32_t  id 
)

Tear down an element and everything related to it.

The symmetric counterpart to create_element/create<T>/create_text_field: walks surface.layer().closure(id) (id plus every id transitively related via Layer::relate, e.g. a Collapsible's attached body, a Scrollable's tracked rows, or a TextField's Scrollable viewport), calls Context::unbind and Bridge::unbind on each id in that closure, then Layer::remove(id) - which itself cascades the Layer-side removal (buffer mark_for_removal, m_elements erase, m_relations cleanup) across the same closure.

This is the one call callers should use to tear down a composed Forma element. Layer::remove(id) alone is still available for callers that only need the Layer-side cascade with no Context/Bridge involvement.

Parameters
surfaceSurface owning the Layer, Context, and (via the module Bridge) the bindings id may participate in.
idElement id to remove, as returned by layer().add()/Slot::id().

Definition at line 90 of file Forma.cpp.

91{
92 for (uint32_t cid : surface.layer().closure(id)) {
93 surface.ctx().unbind(cid);
94 bridge().unbind({ surface.layer_ptr(), cid });
95 }
96 surface.layer().remove(id);
97}
void unbind(const ElementRef &ref)
Cancel all inbound and outbound bindings for an element.
Definition Bridge.cpp:380
void unbind(uint32_t id)
Remove all callbacks registered for an element id.
Definition Context.cpp:168
bool remove(uint32_t id)
Remove an element by id, cascading to every related id.
Definition Layer.cpp:17
const std::shared_ptr< Layer > & layer_ptr() const noexcept
Shared handles for callers that need to keep components alive independently of the Surface (backgroun...
Definition Surface.hpp:188
Context & ctx() noexcept
Access the event router.
Definition Surface.hpp:170
Layer & layer() noexcept
Access the spatial registry.
Definition Surface.hpp:159
Bridge & bridge()
Return the application-level Bridge instance.
Definition Forma.cpp:71

References bridge(), MayaFlux::Portal::Forma::Layer::closure(), MayaFlux::Portal::Forma::Surface::ctx(), MayaFlux::Portal::Forma::Surface::layer(), MayaFlux::Portal::Forma::Surface::layer_ptr(), MayaFlux::Portal::Forma::Layer::remove(), MayaFlux::Portal::Forma::Bridge::unbind(), and MayaFlux::Portal::Forma::Context::unbind().

+ Here is the call graph for this function: