Class UILibraryTreeContextMenu

Custom context menu for the UILibraryTree class.

Hierarchy (view full)

Constructors

Properties

onSelectCustomTagButtonClicked: (() => void)

Gets called when the user clicks on the "Tags.." button to assign custom tags to a resource.

Accessors

  • get customElements(): UIElement[]
  • Gets a list of all added custom elements to the Context Menu.

    Returns UIElement[]

  • set customElements(value): void
  • Parameters

    Returns void

Methods

  • Adds a new item to the menu.

    Parameters

    • path: string

      Path that determines where to add the element. See class information on how to specify paths. All sub-elements of a path will be added automatically.

    • fnOnSelected: (() => void)

      Callback to invoke when the path element is selected.

        • (): void
        • Returns void

    • OptionalfnOnIsActive: (() => boolean)

      Callback to invoke when determining if the menuItem is active.

        • (): boolean
        • Returns boolean

    • OptionalshortcutAction: ShortcutActionBase

      Shortcut action to display next to the item name.

    Returns void

  • Adds an Item with the given path to this Context menu.

    Parameters

    • path: string

      Path that determines where to add the element. See class information on how to specify paths. All sub-elements of a path will be added automatically.

    • action: (() => void)

      Callback to trigger when the path element is selected.

        • (): void
        • Returns void

    • Optionalcondition: (() => boolean)

      Optional. Extra condition to display the item.

        • (): boolean
        • Returns boolean

    • OptionalmethodClass: Type

      Optional. The class type to get the callback method from. UILibraryBrowser if null.

    • OptionalmethodName: string

      Optional. The callback method name for fetching shortcut actions. The callback name if null.

    • Optionaltarget: any

      Optional. The callback object for fetching shortcut actions. Browser if null.

    Returns void

  • Adds a new separator to the menu.

    Parameters

    • Optionalpath: string

      Path that determines where to add the element. See class information on how to specify paths. All sub-elements of a path will be added automatically.

    Returns void

  • Adds a new toggle to the menu.

    Parameters

    • path: string

      Path that determines where to add the element. See class information on how to specify paths. All sub-elements of a path will be added automatically.

    • initialState: boolean

      The initial state of the context menu toggle. If true, the toggle will start in toggled state.

    • callback: (() => void)

      Callback to trigger when the path element is selected.

        • (): void
        • Returns void

    • OptionalshortcutAction: ShortcutActionBase

      Shortcut action to display next to the item name.

    Returns void

  • Opens a context menu at the specified position relative to the provided ui element base.

    Parameters

    • position: Immutable<Vector2>

      The position where the context menu should be displayed.

    • uiElement: UIElementBase

      The UI element serving as a position reference.

    • OptionaluseNativeMenu: boolean

      Whether the context menu should be displayed using native context menu when available, use the engine context menu otherwise.

    Returns void

  • Normally menu items use values from their paths as their names. However path labels don't provide a way of localizing the menu item. This method allows you to set specific names (different from path labels) to each menu item. All the values are localized so they will also be updated according to the string table.

    Parameters

    • label: string

      Label of the element.

    • name: I18N

      Name to display when the menu is shown.

    Returns void

  • Creates a new instance of the UIContextMenu class that contains a list of menu items based on the specified enumType.

    Type Parameters

    Parameters

    • enumType: EnumClassOf<T>

      The enumeration type to create the context menu from.

    • onSelected: ((value: EnumValue<T, number>) => void)

      The callback to invoke when a menu item is selected.

        • (value): void
        • Parameters

          Returns void

    • OptionalinitialValue: EnumValue<T, number>

      Optional, the initial value that is selected when the menu is opened.

    • OptionalisIncludingZero: boolean

      Optional, if set to false, will exclude any enum value that is zero. Default is true.

    Returns UIContextMenu

    A new instance of the UIContextMenu class.