I love the smell of UnrealEd crashing in the morning. – tarquin

UE3:UIContextMenu (UT3)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT3 Object >> UIRoot >> UIScreenObject >> UIObject >> UIList >> UIContextMenu
Package: 
Engine
Implemented interfaces
UIDataStorePublisher
Known classes within UIContextMenu:
UIComp_ContextMenuListPresenter
Direct subclass:
UTUI_ContextMenu
This class in other games:
UDK

Displays a list of options for the user to choose from. Invoked when the user right-clicks on a widget which supports context menus, and the list of available options are context sensitive. Items can be either static (using static data providers) or modified at runtime.

Copyright 2007 Epic Games, Inc. All Rights Reserved

Properties[edit]

bResolvePosition[edit]

Type: bool

Modifiers: transient, const

indicates that this context menu's position needs to be re-resolved during the next scene update

InvokingWidget[edit]

Type: UIObject

Modifiers: transient, const

the widget that invoked this context menu

MenuItems[edit]

Type: array<ContextMenuItem>

Modifiers: transient, const


Default values[edit]

Property Value
bEnableActiveCursorUpdates True
bEnableVerticalScrollbar False
bHidden True
bSingleClickSubmission True
bSupportsPrimaryStyle True
bUpdateItemUnderCursor True
CellDataComponent UIComp_ContextMenuListPresenter'ContextMenuDataComponent'
ColumnAutoSizeMode CELLAUTOSIZE_AdjustList
Position
Member Value
ScaleType[0] EVALPOS_PixelViewport
ScaleType[1] EVALPOS_PixelViewport
ScaleType[2] EVALPOS_PixelOwner
ScaleType[3] EVALPOS_PixelOwner
Value[2] 16.0
Value[3] 100.0
PrimaryStyle
Member Value
DefaultStyleTag 'DefaultContextMenuStyle'
RequiredStyleClass Class'Engine.UIStyle_Image'
RowAutoSizeMode CELLAUTOSIZE_AdjustList
WrapType LISTWRAP_Jump

Subobjects[edit]

ContextMenuDataComponent[edit]

Class: Engine.UIComp_ContextMenuListPresenter

Property Value
ListItemOverlay[0] UITexture'Engine.Default__UIContextMenu:ContextMenuDataComponent.NormalOverlayTemplate'
ListItemOverlay[1] UITexture'Engine.Default__UIContextMenu:ContextMenuDataComponent.ActiveOverlayTemplate'
ListItemOverlay[2] UITexture'Engine.Default__UIContextMenu:ContextMenuDataComponent.SelectionOverlayTemplate'
ListItemOverlay[3] UITexture'Engine.Default__UIContextMenu:ContextMenuDataComponent.HoverOverlayTemplate'

WidgetEventComponent[edit]

Class: Engine.UIComp_Event

Inherits from: UIList.WidgetEventComponent

No new values.

Enums[edit]

EContextMenuItemType[edit]

Different types of context menu items

CMIT_Normal 
A normal menu item
CMIT_Submenu 
A context menu item that has a submenu which is shown when the mouse is held over this menu item for a few seconds
CMIT_Separator 
Separates a group of context menu items
CMIT_Check 
Context menu item that supports a two states - on and off. State is represented by a check next to the item
CMIT_Radio 
Similar to CMIT_Check, except that only one menu item in a particular group can be selected at one time

Todo: ronp - determine how groups will be defined

Structs[edit]

ContextMenuItem[edit]

Modifiers: native, transient

Represents a single item in a context menu

Note: temporary; not sure if this struct will actually be used

UIContextMenu OwnerMenu 
pointer{struct FContextMenuItem} ParentItem 
EContextMenuItemType ItemType 
string ItemText 
int ItemId 

Default values:

Property Value
ItemId -1
ItemType CMIT_Normal

Functions[edit]

Native functions[edit]

Close[edit]

native final function bool Close (int PlayerIndex)

Closes this context menu.

Returns:

TRUE if the context menu closed successfully; FALSE if it didn't close (as a result of OnClose returning FALSE, for example)

IsActiveContextMenu[edit]

native final function bool IsActiveContextMenu () const

Returns TRUE if this context menu is the scene's currently active context menu.

Open[edit]

native final function bool Open (int PlayerIndex)

Opens this context menu. Called by the owning scene when a new context menu is activated.

Parameters:

  • PlayerIndex - the index of the player that triggered the context menu to be opened.

Returns:

TRUE if the context menu was successfully opened.

Events[edit]

ClearMenuItems[edit]

event bool ClearMenuItems (UIObject Widget)

Removes all context menu items from this context menu.

Parameters:

  • Widget - the widget that invoked this context menu

Returns:

TRUE if the operation was successful.

FindMenuItemIndex[edit]

event int FindMenuItemIndex (UIObject Widget, string ItemToFind)

Finds the location of a string in the context menu's array of items.

Parameters:

  • Widget - the widget that invoked this context menu
  • ItemToFind - the string to find

Returns:

the index for the specified value, or INDEX_NONE if it couldn't be found.

GetAllMenuItems[edit]

event bool GetAllMenuItems (UIObject Widget, out array<stringout_MenuItems)

Gets a list of the current context menu items strings.

Parameters:

  • Widget - the widget that invoked this context menu
  • out_MenuItems - receives the context menu item strings

Returns:

TRUE if the operation was successful.

GetMenuItem[edit]

event bool GetMenuItem (UIObject Widget, int IndexToGet, out string out_MenuItem)

Gets the value of the context menu item located at a specified position in the array.

Parameters:

  • Widget - the widget that invoked this context menu
  • IndexToGet - the index of the context menu item to get
  • out_MenuItem - receives the value of the context menu item text.

Returns:

TRUE if the value was successfully retrieved and copied to out_MenuItem.

InsertMenuItem[edit]

event bool InsertMenuItem (UIObject Widget, string Item, optional int InsertIndex, optional bool bAllowDuplicates)

Sets the text for a single context menu item.

Parameters:

  • Widget - the widget that invoked this context menu
  • Item - the text to add/insert to the context menu
  • InsertIndex - the location [in the list's items array] to insert the new menu item; if not specified, will be appended to the end of the array.
  • bAllowDuplicates - specify TRUE to allow multiple menu items with the same value; otherwise, the new value will not be added if an existing item has the same value.

Returns:

TRUE if the operation was successful.

RemoveMenuItem[edit]

event bool RemoveMenuItem (UIObject Widget, string ItemToRemove)

Removes a single menu item from the context menu.

Parameters:

  • Widget - the widget that invoked this context menu
  • ItemToRemove - the string that should be removed from the context menu

Returns:

TRUE if the value was successfully removed or didn't exist in the first place.

RemoveMenuItemAtIndex[edit]

event bool RemoveMenuItemAtIndex (UIObject Widget, int IndexToRemove)

Removes the context menu item located at a specified position in the array.

Parameters:

  • Widget - the widget that invoked this context menu
  • IndexToRemove - the index of the item that should be removed.

Returns:

TRUE if the value was successfully removed; FALSE if IndexToRemove wasn't valid or the value couldn't be removed.

SetMenuItems[edit]

event bool SetMenuItems (UIObject Widget, array<stringNewMenuItems, optional bool bClearExisting, optional int InsertIndex)

Sets the text that will be displayed in the context menu items.

Parameters:

  • Widget - the widget that invoked this context menu
  • NewMenuItems - the menu items to use in the context menu
  • bClearExisting - specify TRUE to clear any existing menu items; otherwise, the new items will be appended to the old
  • InsertIndex - the location [in the list's items array] to insert the new menu items at; only relevant if bClearExisting is FALSE

Returns:

TRUE if the operation was successful.