class MAGES::Editor::PopupPalette¶
Overview¶
A lightweight command palette popup for editor tools. More…
class PopupPalette: public VisualElement
{
public:
// properties
Action
Detailed Documentation¶
A lightweight command palette popup for editor tools.
Properties¶
ActionOnChosen
Gets or sets the chosen callback.
IList Items
Gets the current item source.
Methods¶
PopupPalette()
Initializes a new instance of the PopupPalette class.
void SetItems(
IList items,
Func getName,
Func getDescription
)
Replaces the palette items and item label selectors.
Parameters:
items |
The items to display. |
getName |
Maps an item to its display name. |
getDescription |
Maps an item to its description. |
void SetItems< T >(
IList items,
Func getName,
Func getDescription
)
Replaces the palette items and item label selectors.
Parameters:
T |
The item type. |
items |
The items to display. |
getName |
Maps an item to its display name. |
getDescription |
Maps an item to its description. |
void Refresh()
Refreshes the filtered view from the current source list.
void ClearItems()
Clears the palette source.
static PopupPalette Show(
Vector2 position,
IList items,
Func getName,
Func getDescription,
Action onChosen
)
Shows a palette popup at the given position.
Parameters:
position |
The screen position to anchor the popup to. |
items |
The items to display. |
getName |
Maps an item to its display name. |
getDescription |
Maps an item to its description. |
onChosen |
Invoked when an item is chosen. |
Returns:
The created palette instance.
static PopupPalette Show< T >(
Vector2 position,
IList items,
Func getName,
Func getDescription,
Action onChosen
)
Shows a palette popup at the given position.
Parameters:
T |
The item type. |
position |
The screen position to anchor the popup to. |
items |
The items to display. |
getName |
Maps an item to its display name. |
getDescription |
Maps an item to its description. |
onChosen |
Invoked when an item is chosen. |
Returns:
The created palette instance.