PopupMenu

PopupMenu displays a list of options.

PopupMenu is a Control that displays a list of options. They are popular in toolbars or context menus.

@GodotBaseClass
struct PopupMenu {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

_getItems
Array _getItems()
_guiInput
void _guiInput(InputEvent arg0)
_setItems
void _setItems(Array arg0)
_submenuTimeout
void _submenuTimeout()
addCheckItem
void addCheckItem(String label, long id, long accel)

Adds a new checkable item with text label. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided then the default 0 will be assigned to it. See getItemAccelerator for more info on accelerators. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See setItemChecked for more info on how to control it.

addCheckShortcut
void addCheckShortcut(ShortCut shortcut, long id, bool global)

Adds a new checkable item and assigns the specified ShortCut to it. Sets the label of the checkbox to the ShortCut's name. An id can optionally be provided. If no id is provided, one will be created from the index. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See setItemChecked for more info on how to control it.

addIconCheckItem
void addIconCheckItem(Texture texture, String label, long id, long accel)

Adds a new checkable item with text label and icon texture. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided then the default 0 will be assigned to it. See getItemAccelerator for more info on accelerators. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See setItemChecked for more info on how to control it.

addIconCheckShortcut
void addIconCheckShortcut(Texture texture, ShortCut shortcut, long id, bool global)

Adds a new checkable item and assigns the specified ShortCut and icon texture to it. Sets the label of the checkbox to the ShortCut's name. An id can optionally be provided. If no id is provided, one will be created from the index. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See setItemChecked for more info on how to control it.

addIconItem
void addIconItem(Texture texture, String label, long id, long accel)

Adds a new item with text label and icon texture. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided then the default 0 will be assigned to it. See getItemAccelerator for more info on accelerators.

addIconRadioCheckItem
void addIconRadioCheckItem(Texture texture, String label, long id, long accel)

Same as addIconCheckItem, but uses a radio check button.

addIconRadioCheckShortcut
void addIconRadioCheckShortcut(Texture texture, ShortCut shortcut, long id, bool global)

Same as addIconCheckShortcut, but uses a radio check button.

addIconShortcut
void addIconShortcut(Texture texture, ShortCut shortcut, long id, bool global)

Adds a new item and assigns the specified ShortCut and icon texture to it. Sets the label of the checkbox to the ShortCut's name. An id can optionally be provided. If no id is provided, one will be created from the index.

addItem
void addItem(String label, long id, long accel)

Adds a new item with text label. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided then the default 0 will be assigned to it. See getItemAccelerator for more info on accelerators.

addMultistateItem
void addMultistateItem(String label, long max_states, long default_state, long id, long accel)

Adds a new multistate item with text label. Contrarily to normal binary items, multistate items can have more than two states, as defined by max_states. Each press or activate of the item will increase the state by one. The default value is defined by default_state. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided then the default 0 will be assigned to it. See getItemAccelerator for more info on accelerators.

addRadioCheckItem
void addRadioCheckItem(String label, long id, long accel)

Adds a new radio check button with text label. An id can optionally be provided, as well as an accelerator (accel). If no id is provided, one will be created from the index. If no accel is provided then the default 0 will be assigned to it. See getItemAccelerator for more info on accelerators. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See setItemChecked for more info on how to control it.

addRadioCheckShortcut
void addRadioCheckShortcut(ShortCut shortcut, long id, bool global)

Adds a new radio check button and assigns a ShortCut to it. Sets the label of the checkbox to the ShortCut's name. An id can optionally be provided. If no id is provided, one will be created from the index. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See setItemChecked for more info on how to control it.

addSeparator
void addSeparator(String label, long id)

Adds a separator between items. Separators also occupy an index, which you can set by using the id parameter. A label can optionally be provided, which will appear at the center of the separator.

addShortcut
void addShortcut(ShortCut shortcut, long id, bool global)

Adds a ShortCut. An id can optionally be provided. If no id is provided, one will be created from the index.

addSubmenuItem
void addSubmenuItem(String label, String submenu, long id)

Adds an item that will act as a submenu of the parent PopupMenu node when clicked. The submenu argument is the name of the child PopupMenu node that will be shown when the item is clicked. An id can optionally be provided. If no id is provided, one will be created from the index.

clear
void clear()

Removes all items from the PopupMenu.

getAllowSearch
bool getAllowSearch()
getCurrentIndex
long getCurrentIndex()

Returns the index of the currently focused item. Returns -1 if no item is focused.

getItemAccelerator
long getItemAccelerator(long idx)

Returns the accelerator of the item at index idx. Accelerators are special combinations of keys that activate the item, no matter which control is focused.

getItemCount
long getItemCount()

Returns the number of items in the PopupMenu.

getItemIcon
Ref!Texture getItemIcon(long idx)

Returns the icon of the item at index idx.

getItemId
long getItemId(long idx)

Returns the id of the item at index idx. id can be manually assigned, while index can not.

getItemIndex
long getItemIndex(long id)

Returns the index of the item containing the specified id. Index is automatically assigned to each item by the engine. Index can not be set manually.

getItemMetadata
Variant getItemMetadata(long idx)

Returns the metadata of the specified item, which might be of any type. You can set it with setItemMetadata, which provides a simple way of assigning context data to items.

getItemShortcut
Ref!ShortCut getItemShortcut(long idx)

Returns the ShortCut associated with the specified idx item.

getItemSubmenu
String getItemSubmenu(long idx)

Returns the submenu name of the item at index idx. See addSubmenuItem for more info on how to add a submenu.

getItemText
String getItemText(long idx)

Returns the text of the item at index idx.

getItemTooltip
String getItemTooltip(long idx)

Returns the tooltip associated with the specified index index idx.

getSubmenuPopupDelay
double getSubmenuPopupDelay()
isHideOnCheckableItemSelection
bool isHideOnCheckableItemSelection()
isHideOnItemSelection
bool isHideOnItemSelection()
isHideOnStateItemSelection
bool isHideOnStateItemSelection()
isHideOnWindowLoseFocus
bool isHideOnWindowLoseFocus()

Returns true if the popup will be hidden when the window loses focus or not.

isItemCheckable
bool isItemCheckable(long idx)

Returns true if the item at index idx is checkable in some way, i.e. if it has a checkbox or radio button. Note: Checkable items just display a checkmark or radio button, but don't have any built-in checking behavior and must be checked/unchecked manually.

isItemChecked
bool isItemChecked(long idx)

Returns true if the item at index idx is checked.

isItemDisabled
bool isItemDisabled(long idx)

Returns true if the item at index idx is disabled. When it is disabled it can't be selected, or its action invoked. See setItemDisabled for more info on how to disable an item.

isItemRadioCheckable
bool isItemRadioCheckable(long idx)

Returns true if the item at index idx has radio button-style checkability. Note: This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.

isItemSeparator
bool isItemSeparator(long idx)

Returns true if the item is a separator. If it is, it will be displayed as a line. See addSeparator for more info on how to add a separator.

isItemShortcutDisabled
bool isItemShortcutDisabled(long idx)

Returns true if the specified item's shortcut is disabled.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(PopupMenu other)
opEquals
bool opEquals(typeof(null) n)
removeItem
void removeItem(long idx)

Removes the item at index idx from the menu. Note: The indices of items after the removed item will be shifted by one.

setAllowSearch
void setAllowSearch(bool allow)
setHideOnCheckableItemSelection
void setHideOnCheckableItemSelection(bool enable)
setHideOnItemSelection
void setHideOnItemSelection(bool enable)
setHideOnStateItemSelection
void setHideOnStateItemSelection(bool enable)
setHideOnWindowLoseFocus
void setHideOnWindowLoseFocus(bool enable)

Hides the PopupMenu when the window loses focus.

setItemAccelerator
void setItemAccelerator(long idx, long accel)

Sets the accelerator of the item at index idx. Accelerators are special combinations of keys that activate the item, no matter which control is focused.

setItemAsCheckable
void setItemAsCheckable(long idx, bool enable)

Sets whether the item at index idx has a checkbox. If false, sets the type of the item to plain text. Note: Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.

setItemAsRadioCheckable
void setItemAsRadioCheckable(long idx, bool enable)

Sets the type of the item at the specified index idx to radio button. If false, sets the type of the item to plain text.

setItemAsSeparator
void setItemAsSeparator(long idx, bool enable)

Mark the item at index idx as a separator, which means that it would be displayed as a line. If false, sets the type of the item to plain text.

setItemChecked
void setItemChecked(long idx, bool checked)

Sets the checkstate status of the item at index idx.

setItemDisabled
void setItemDisabled(long idx, bool disabled)

Enables/disables the item at index idx. When it is disabled, it can't be selected and its action can't be invoked.

setItemIcon
void setItemIcon(long idx, Texture icon)

Replaces the Texture icon of the specified idx.

setItemId
void setItemId(long idx, long id)

Sets the id of the item at index idx.

setItemMetadata
void setItemMetadata(long idx, VariantArg1 metadata)

Sets the metadata of an item, which may be of any type. You can later get it with getItemMetadata, which provides a simple way of assigning context data to items.

setItemMultistate
void setItemMultistate(long idx, long state)

Sets the state of a multistate item. See addMultistateItem for details.

setItemShortcut
void setItemShortcut(long idx, ShortCut shortcut, bool global)

Sets a ShortCut for the specified item idx.

setItemShortcutDisabled
void setItemShortcutDisabled(long idx, bool disabled)

Disables the ShortCut of the specified index idx.

setItemSubmenu
void setItemSubmenu(long idx, String submenu)

Sets the submenu of the item at index idx. The submenu is the name of a child PopupMenu node that would be shown when the item is clicked.

setItemText
void setItemText(long idx, String text)

Sets the text of the item at index idx.

setItemTooltip
void setItemTooltip(long idx, String tooltip)

Sets the String tooltip of the item at the specified index idx.

setSubmenuPopupDelay
void setSubmenuPopupDelay(double seconds)
toHash
size_t toHash()
toggleItemChecked
void toggleItemChecked(long idx)

Toggles the check state of the item of the specified index idx.

toggleItemMultistate
void toggleItemMultistate(long idx)

Cycle to the next state of a multistate item. See addMultistateItem for details.

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

allowSearch
bool allowSearch [@property getter]
bool allowSearch [@property setter]

If true, allows navigating PopupMenu with letter keys.

hideOnCheckableItemSelection
bool hideOnCheckableItemSelection [@property getter]
bool hideOnCheckableItemSelection [@property setter]

If true, hides the PopupMenu when a checkbox or radio button is selected.

hideOnItemSelection
bool hideOnItemSelection [@property getter]
bool hideOnItemSelection [@property setter]

If true, hides the PopupMenu when an item is selected.

hideOnStateItemSelection
bool hideOnStateItemSelection [@property getter]
bool hideOnStateItemSelection [@property setter]

If true, hides the PopupMenu when a state item is selected.

items
Array items [@property getter]
Array items [@property setter]
submenuPopupDelay
double submenuPopupDelay [@property getter]
double submenuPopupDelay [@property setter]

Sets the delay time in seconds for the submenu item to popup on mouse hovering. If the popup menu is added as a child of another (acting as a submenu), it will inherit the delay time of the parent menu item.

Static functions

_new
PopupMenu _new()

Construct a new instance of PopupMenu. Note: use memnew!PopupMenu instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta