UI Actions and Selection
This page covers the action model used by collection widgets and the interfaces used for selection visuals.
UI Action System
Collection widgets support generic item-level UI actions.
The action system is intentionally data-source agnostic, so UI elements can send requests without needing to know whether the backing data came from a table, a grid, or another host type.
IDataUIActionHost
Widgets that can process item actions implement IDataUIActionHost.
Examples include:
DataTableWidgetDataGridWidget(planned)
DataUIActionRequest
DataUIActionRequest is the generic request packet sent by UI elements.
It contains:
ItemIdItemKeyActionType
Optional fields include:
IntArgStringArgPayloadSender
The host decides how to interpret ItemId.
DataUIActionType
Common built-in actions include:
Selection:
SelectToggleSelect
Modification:
DeleteMoveUpMoveDown
Drag lifecycle:
BeginDragEndDragCancelDrag
Miscellaneous:
ContextMenuCustom
IDataUISelectionVisual
IDataUISelectionVisual lets widgets control selection visuals without depending on a specific implementation.
void SetSelected(bool selected); // may animate
void SyncSelected(bool selected); // snap state for pooling or rebuild
DataItemSelection
DataItemSelection is the default MonoBehaviour implementation for selection visuals.
It supports:
- Toggling a GameObject on and off
- Driving an Animator bool parameter named
Selected