UIMenu
class UIMenu
extends
Component
implements
UIRenderable
Represents a menu that can be displayed on screen. The menu itself is built up dynamically using a platform dependent builder class.
Constructor
(): UIMenu
.builder
Menu builder, can be used to build up the menu before it is displayed, e.g. when handing the Build event.
.render()
(callback: RenderCallback<Output<
UIRenderable
, any>>): void
Build the current menu and render it using UIMenu.builder
.
.onSelectMenuItem() protected
(e:
UIMenuItemSelectedEvent
): boolean
Handle SelectMenuItem events by setting the selected
property to the key of the selected item, and then propagating the event on this component itself.
.menu
The last menu that was built, as a child object.
.gravity
"start" | "stretch" | "end"
Menu gravity in relation to reference component (start/stretch/end).
.options
{ key: string; text:
Stringable
; }[]
List of initial menu options; for advanced menus use onBuild
to build the menu dynamically.
.selected
string
The key of the menu item that was last selected, if any.
.isPresetComponent() protected
(): boolean
Inherited from Component.isPresetComponent
.
.delegateEvent() protected
(e:
ManagedEvent
, propertyName: string): boolean | void
Inherited from Component.delegateEvent
.
.getParentComponent()
<TParent extends Component = Component>(ParentClass?:
ComponentConstructor
<TParent>): TParent
Inherited from Component.getParentComponent
.
.getBoundParentComponent()
<TParent extends Component>(ParentClass?:
ComponentConstructor
<TParent>): TParent
Inherited from Component.getBoundParentComponent
.
.emitAction()
(name: string, inner?:
ManagedEvent
, context?:
ManagedObject
): void
Inherited from Component.emitAction
.
.propagateComponentEvent() deprecated
(name: string, inner?:
ManagedEvent
): void
Inherited from Component.propagateComponentEvent
.
.managedId
number
Inherited from ManagedObject.managedId
.
.managedState
Inherited from ManagedObject.managedState
.
.getReferenceCount() protected
(): number
Inherited from ManagedObject.getReferenceCount
.
.getManagedReferrers() protected
():
ManagedObject
[]
Inherited from ManagedObject.getManagedReferrers
.
.getManagedParent() protected
<TParent extends ManagedObject = ManagedObject>(ParentClass?:
ManagedObjectConstructor
<TParent>): TParent
Inherited from ManagedObject.getManagedParent
.
.emit()
<TEvent extends ManagedEvent = ManagedEvent, TConstructorArgs extends any[] = any[]>(e: string | TEvent | (new (...args: TConstructorArgs) => TEvent), ...constructorArgs: TConstructorArgs): this
Inherited from ManagedObject.emit
.
.emitChange()
(name?: string): void
Inherited from ManagedObject.emitChange
.
.propagateChildEvents() protected deprecated
(...types: ((new (...args: any[]) =>
ManagedEvent
) | ((e:
ManagedEvent
) => any))[]): this
Inherited from ManagedObject.propagateChildEvents
.
.activateManagedAsync() protected
(): Promise<any>
Inherited from ManagedObject.activateManagedAsync
.
.deactivateManagedAsync() protected
(): Promise<void>
Inherited from ManagedObject.deactivateManagedAsync
.
.destroyManagedAsync() protected
(): Promise<void>
Inherited from ManagedObject.destroyManagedAsync
.
.onManagedStateActivatingAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateActivatingAsync
.
.onManagedStateActiveAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateActiveAsync
.
.onManagedStateDeactivatingAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateDeactivatingAsync
.
.onManagedStateInactiveAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateInactiveAsync
.
.onManagedStateDestroyingAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateDestroyingAsync
.
UIMenu.Presets
UIMenu presets type, for use with Component.with
.
.options
{ key: string; text:
Stringable
; }[]
List of menu options; for advanced menus use onBuild
to build the menu dynamically.
.gravity
"start" | "stretch" | "end"
Menu gravity in relation to reference component (start/stretch/end).
.onBuild
ComponentEventHandler
<UIMenu,
ComponentEvent
<
Component
>>
Event handler that is invoked every time just before the menu is rendered.
.onSelectMenuItem
ComponentEventHandler
<UIMenu,
UIMenuItemSelectedEvent
>
Event handler that is invoked after a menu item has been picked.