Open 3D Engine LyShine Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
UiElementInterface Class Referenceabstract

Inherits AZ::ComponentBus.

Public Member Functions

virtual ~UiElementInterface ()
 Deleting an element will remove it from its parent and delete its child elements and components.
 
virtual void RenderElement (LyShine::IRenderGraph *renderGraph, bool isInGame)=0
 
virtual LyShine::ElementId GetElementId ()=0
 Retrieves the identifier of this element.
 
virtual LyShine::NameType GetName ()=0
 Get the name of this element.
 
virtual AZ::EntityId GetCanvasEntityId ()=0
 Get the canvas that contains this element (returns AZ::InvalidEntityId if element has no canvas)
 
virtual AZ::Entity * GetParent ()=0
 Get the parent element of this element (returns nullptr if element has no parent)
 
virtual AZ::EntityId GetParentEntityId ()=0
 Get the parent entity Id of this element (returns invalid Id if element has no parent)
 
virtual int GetNumChildElements ()=0
 Get the number child elements of this element.
 
virtual AZ::Entity * GetChildElement (int index)=0
 Get the specified child element, index must be less than GetNumChildElements()
 
virtual AZ::EntityId GetChildEntityId (int index)=0
 Get the specified child entity Id, index must be less than GetNumChildElements()
 
virtual UiElementInterfaceGetChildElementInterface (int index)=0
 
virtual int GetIndexOfChild (const AZ::Entity *child)=0
 Get the index of the specified child element.
 
virtual int GetIndexOfChildByEntityId (AZ::EntityId childId)=0
 Get the index of the specified child element.
 
virtual LyShine::EntityArray GetChildElements ()=0
 Get the child elements of this element.
 
virtual AZStd::vector< AZ::EntityId > GetChildEntityIds ()=0
 Get the child entity Ids of this element.
 
virtual AZ::Entity * CreateChildElement (const LyShine::NameType &name)=0
 
virtual void DestroyElement ()=0
 Destroy this element.
 
virtual void DestroyElementOnFrameEnd ()=0
 Queue up element for destruction at end of frame.
 
virtual void Reparent (AZ::Entity *newParent, AZ::Entity *insertBefore=nullptr)=0
 
virtual void ReparentByEntityId (AZ::EntityId newParent, AZ::EntityId insertBefore)=0
 
virtual void AddToParentAtIndex (AZ::Entity *newParent, int index=-1)=0
 
virtual void RemoveFromParent ()=0
 Remove this element from its parent.
 
virtual AZ::Entity * FindFrontmostChildContainingPoint (AZ::Vector2 point, bool isInGame)=0
 
virtual LyShine::EntityArray FindAllChildrenIntersectingRect (const AZ::Vector2 &bound0, const AZ::Vector2 &bound1, bool isInGame)=0
 
virtual AZ::EntityId FindInteractableToHandleEvent (AZ::Vector2 point)=0
 Look for an entity with interactable component to handle an event at given point.
 
virtual AZ::EntityId FindParentInteractableSupportingDrag (AZ::Vector2 point)=0
 Look for a parent (ancestor) entity with interactable component to handle dragging starting at given point.
 
virtual AZ::Entity * FindChildByName (const LyShine::NameType &name)=0
 Return the first immediate child element with the given name or nullptr if no match.
 
virtual AZ::Entity * FindDescendantByName (const LyShine::NameType &name)=0
 Return the first descendant element with the given name or nullptr if no match.
 
virtual AZ::EntityId FindChildEntityIdByName (const LyShine::NameType &name)=0
 Return the first immediate child entity Id with the given name or invalid Id if no match.
 
virtual AZ::EntityId FindDescendantEntityIdByName (const LyShine::NameType &name)=0
 Return the first descendant entity Id with the given name or invalid Id if no match.
 
virtual AZ::Entity * FindChildByEntityId (AZ::EntityId id)=0
 Return the first immediate child element with the given id or nullptr if no match.
 
virtual AZ::Entity * FindDescendantById (LyShine::ElementId id)=0
 Return the descendant element with the given id or nullptr if no match.
 
virtual void FindDescendantElements (AZStd::function< bool(const AZ::Entity *)> predicate, LyShine::EntityArray &result)=0
 
virtual void CallOnDescendantElements (AZStd::function< void(const AZ::EntityId)> callFunction)=0
 
virtual bool IsAncestor (AZ::EntityId id)=0
 Return whether a given element is an ancestor of this element.
 
virtual bool IsEnabled ()=0
 Enabled/disabled.
 
virtual void SetIsEnabled (bool isEnabled)=0
 
virtual bool GetAreElementAndAncestorsEnabled ()=0
 
virtual bool IsRenderEnabled ()=0
 
virtual void SetIsRenderEnabled (bool isRenderEnabled)=0
 

Static Public Attributes

static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single
 Only one component on a entity can implement the events.
 

Member Function Documentation

◆ AddToParentAtIndex()

virtual void UiElementInterface::AddToParentAtIndex ( AZ::Entity *  newParent,
int  index = -1 
)
pure virtual

Add this element as a child of the specified parent

Parameters
newParentNew parent element. If null then the canvas is the parent
indexChild index where element is inserted. If -1 element is put at end of child list

◆ CallOnDescendantElements()

virtual void UiElementInterface::CallOnDescendantElements ( AZStd::function< void(const AZ::EntityId)>  callFunction)
pure virtual

recursively visit descendant elements and call the given function on them The function is called first on the element and then on its children

◆ CreateChildElement()

virtual AZ::Entity * UiElementInterface::CreateChildElement ( const LyShine::NameType name)
pure virtual

Create a new element that is a child of this element, this element (the parent) has ownership of the child The new entity will have a UiElementComponent added but will not yet be initialized or activated

◆ FindAllChildrenIntersectingRect()

virtual LyShine::EntityArray UiElementInterface::FindAllChildrenIntersectingRect ( const AZ::Vector2 &  bound0,
const AZ::Vector2 &  bound1,
bool  isInGame 
)
pure virtual

Get all the children whose bounds intersect with the given rect in canvas space

Returns
Empty EntityArray if no match

◆ FindDescendantElements()

virtual void UiElementInterface::FindDescendantElements ( AZStd::function< bool(const AZ::Entity *)>  predicate,
LyShine::EntityArray result 
)
pure virtual

recursively find descendant elements matching a predicate

Parameters
result,anymatching elements will be added to this array

◆ FindFrontmostChildContainingPoint()

virtual AZ::Entity * UiElementInterface::FindFrontmostChildContainingPoint ( AZ::Vector2  point,
bool  isInGame 
)
pure virtual

Get the front-most child element whose bounds include the given point in canvas space

Returns
nullptr if no match

◆ GetChildElementInterface()

virtual UiElementInterface * UiElementInterface::GetChildElementInterface ( int  index)
pure virtual

Get the specified child's UiElementInterface, index must be less than GetNumChildElements() and the element must be fully initialized

◆ IsRenderEnabled()

virtual bool UiElementInterface::IsRenderEnabled ( )
pure virtual

This can be used to disable the render without disabling the update/interaction. This is used internally by components that temporarily disable rendering of other elements (though they preserve the existing value).

◆ RenderElement()

virtual void UiElementInterface::RenderElement ( LyShine::IRenderGraph renderGraph,
bool  isInGame 
)
pure virtual

Render the element and its child elements and components, this is done by adding primitives to the render graph

Parameters
renderGraph,therender graph being added to
isInGame,trueif element being rendered in game (or preview), false if being render in edit mode

◆ Reparent()

virtual void UiElementInterface::Reparent ( AZ::Entity *  newParent,
AZ::Entity *  insertBefore = nullptr 
)
pure virtual

Re-parent this element to move it in the hierarchy

Parameters
newParentNew parent element. If null then the canvas is the parent
nextElementElement to insert this element before. If null element is put at end of child list

◆ ReparentByEntityId()

virtual void UiElementInterface::ReparentByEntityId ( AZ::EntityId  newParent,
AZ::EntityId  insertBefore 
)
pure virtual

Re-parent this element to move it in the hierarchy

Parameters
newParentNew parent element. If InvalidEntityId then the canvas is the parent
nextElementElement to insert this element before. If InvalidEntityId then element is put at end of child list

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