Top-level UI container and event router.
More...
#include <UserInterface/CUIContainer.h>
|
| virtual void | initComponent () |
| virtual void | updateComponent () |
|
void | resetTouch () |
| CCanvas * | getCanvas () |
| | Get the associated canvas.
|
| void | addChild (CUIBase *base) |
| | Add a child UI object to the container.
|
| bool | removeChild (CUIBase *base) |
| | Remove a child UI object from the container.
|
| void | removeChildsByGUI (CGUIElement *element) |
| | Remove all children that are backed by the specified GUI element.
|
| CUIBase * | getChildByGUI (CGUIElement *element) |
| | Find a child by its underlying GUI element.
|
| virtual CUIBase * | OnProcessEvent (const SEvent &event) |
| | Process an input event and forward it to the appropriate child.
|
| virtual CUIBase * | OnProcessEvent (const SEvent &event, CUIBase *capture) |
| | Process an input event with an explicit capture hint.
|
| virtual void | onPointerOut (int pointerId, float x, float y) |
| | Notify container that pointer left the given position.
|
| virtual void | cancelPointerDown (CUIBase *base, int pointerId, float pointerX, float pointerY) |
| | Cancel an active pointer down on a child.
|
|
void | startInMotion () |
| | Start the "in" motion sequence and set internal state.
|
|
void | startOutMotion () |
| | Start the "out" motion sequence and set internal state.
|
|
void | setEnable (bool b) |
| | Enable or disable the container processing.
|
| bool | isEnable () |
| | Enable or disable the container processing.
|
|
bool | isPointerDown (int id) |
| | Check the pointer id is down.
|
|
const char * | getName () |
| virtual void | reset () |
| virtual void | startComponent () |
| virtual void | endUpdate () |
|
virtual void | onEnable (bool b) |
|
virtual void | onUpdateCullingLayer (u32 mask) |
| virtual CObjectSerializable * | createSerializable () |
| virtual void | loadSerializable (CObjectSerializable *object) |
|
void | setEnable (bool b) |
|
bool | isEnable () |
|
CGameObject * | getGameObject () |
|
void | setEnableSerializable (bool b) |
|
bool | isSerializable () |
|
void | addLinkComponent (CComponentSystem *comp) |
|
void | removeAllLink () |
|
virtual | ~IActivatorObject () |
| | Virtual destructor for polymorphic activator objects.
|
|
|
std::function< void(CUIBase *)> | OnPressed |
|
std::function< void(CUIBase *)> | OnHover |
| std::function< void()> | OnMotionInFinish |
| | Callback invoked when in-motion sequence finishes.
|
| std::function< void()> | OnMotionOutFinish |
| | Callback invoked when out-motion sequence finishes.
|
|
|
bool | m_enable |
|
std::vector< CUIBase * > | m_arrayUIObjects |
|
std::vector< CUIBase * > | m_raycastUIObjects |
|
std::vector< CUIBase * > | m_removed |
|
CUIBase * | m_skip |
|
CUIBase * | m_hover |
|
CCanvas * | m_canvas |
|
bool | m_inMotion |
|
bool | m_outMotion |
|
std::map< int, bool > | m_pointerDown |
|
CGameObject * | m_gameObject |
|
bool | m_enable |
|
bool | m_serializable |
|
std::vector< CComponentSystem * > | m_linkComponent |
|
|
static int | useComponent (CComponentSystem *used) |
|
void | setOwner (CGameObject *obj) |
Top-level UI container and event router.
CUIContainer manages a collection of CUIBase objects and acts as the bridge between low-level input events (irrlicht SEvent) and high-level UI interactions. Responsibilities include:
- owning and updating child UI objects,
- performing hit/raycast ordering through m_raycastUIObjects,
- forwarding pointer and keyboard events to the appropriate child,
- managing focus/capture semantics via CUIEventManager,
- controlling simple motion sequences (in/out) and invoking finish callbacks.
The container is itself a CComponentSystem so it integrates with the engine update loop through initComponent() and updateComponent().
- Note
- Most UI controls are created as CUIBase subclasses and attached to a container with addChild(). Event processing is done through OnProcessEvent() which returns the CUIBase* that handled the event (or NULL if none).
◆ addChild()
| void Skylicht::UI::CUIContainer::addChild |
( |
CUIBase * | base | ) |
|
Add a child UI object to the container.
- Parameters
-
| base | CUIBase* to add. The container will own and update it. |
◆ cancelPointerDown()
| virtual void Skylicht::UI::CUIContainer::cancelPointerDown |
( |
CUIBase * | base, |
|
|
int | pointerId, |
|
|
float | pointerX, |
|
|
float | pointerY ) |
|
virtual |
Cancel an active pointer down on a child.
- Parameters
-
| base | Pointer to the child where pointer down should be cancelled. |
| pointerId | ID of the pointer to cancel. |
| pointerX | Last known pointer X (world). |
| pointerY | Last known pointer Y (world). |
This is used to abort press interactions when another system needs to interrupt the ongoing pointer down state.
◆ getCanvas()
| CCanvas * Skylicht::UI::CUIContainer::getCanvas |
( |
| ) |
|
Get the associated canvas.
- Returns
- Pointer to the CCanvas used by this container.
◆ getChildByGUI()
Find a child by its underlying GUI element.
- Parameters
-
| element | GUI element to search for. |
- Returns
- Pointer to the CUIBase that wraps the element or NULL if not found.
◆ initComponent()
| virtual void Skylicht::UI::CUIContainer::initComponent |
( |
| ) |
|
|
virtual |
◆ isEnable()
| bool Skylicht::UI::CUIContainer::isEnable |
( |
| ) |
|
|
inline |
Enable or disable the container processing.
When set to false the container will ignore pointer/touch events and stop routing input to its child UI objects. OnProcessEvent() returns NULL while disabled, so pointer and mouse events are effectively ignored.
◆ onPointerOut()
| virtual void Skylicht::UI::CUIContainer::onPointerOut |
( |
int | pointerId, |
|
|
float | x, |
|
|
float | y ) |
|
virtual |
Notify container that pointer left the given position.
- Parameters
-
| pointerId | ID of the pointer that moved out. |
| x | World X coordinate of pointer out. |
| y | World Y coordinate of pointer out. |
This will clear hover state and forward onPointerOut to the previously hovered child if any.
◆ OnProcessEvent() [1/2]
| virtual CUIBase * Skylicht::UI::CUIContainer::OnProcessEvent |
( |
const SEvent & | event | ) |
|
|
virtual |
Process an input event and forward it to the appropriate child.
- Parameters
-
- Returns
- The CUIBase* that handled the event, or NULL if none handled it.
This overload resolves events using the container's internal capture/focus state.
◆ OnProcessEvent() [2/2]
| virtual CUIBase * Skylicht::UI::CUIContainer::OnProcessEvent |
( |
const SEvent & | event, |
|
|
CUIBase * | capture ) |
|
virtual |
Process an input event with an explicit capture hint.
- Parameters
-
| event | Low-level input SEvent. |
| capture | CUIBase* currently capturing input (may be NULL). |
- Returns
- The CUIBase* that handled the event, or NULL if none handled it.
Use this overload when event routing should respect a specific capture target.
◆ removeChild()
| bool Skylicht::UI::CUIContainer::removeChild |
( |
CUIBase * | base | ) |
|
Remove a child UI object from the container.
- Parameters
-
- Returns
- true if the child was found and removed; false otherwise.
◆ removeChildsByGUI()
| void Skylicht::UI::CUIContainer::removeChildsByGUI |
( |
CGUIElement * | element | ) |
|
Remove all children that are backed by the specified GUI element.
- Parameters
-
| element | CGUIElement* whose associated UI objects will be removed. |
◆ updateComponent()
| virtual void Skylicht::UI::CUIContainer::updateComponent |
( |
| ) |
|
|
virtual |
◆ OnMotionInFinish
| std::function<void()> Skylicht::UI::CUIContainer::OnMotionInFinish |
Callback invoked when in-motion sequence finishes.
Used by UI transitions that require a post-animation action.
◆ OnMotionOutFinish
| std::function<void()> Skylicht::UI::CUIContainer::OnMotionOutFinish |
Callback invoked when out-motion sequence finishes.
Used by UI transitions that require teardown or state change after hiding.
The documentation for this class was generated from the following file: