PopupMenu

Engine/source/platform/menus/popupMenu.h

More...

Private Types

Parent 

Public Friends

class

Private Functions

Used by MenuBar to attach the menu to the menu bar. Do not use anywhere else.

Public Functions

attachToMenuBar(GuiCanvas * owner, S32 pos, const char * title)

Places this menu in the menu bar of the application's main window.

bool

Returns true iff this menu contains an item that matches

iD
.

checkItem(S32 pos, bool checked)

implemented on a per-platform basis.

checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos)

All items at positions firstPos through lastPos are unchecked, and the item at checkPos is checked.

Set to true if any menu or submenu handles a selection event.

enableItem(S32 pos, bool enable)

implemented on a per-platform basis.

Returns the number of items in the menu.

Returns the popup GUID.

Returns the position index of this menu on the bar.

bool
handleSelect(U32 command, const char * text)

A menu item in this menu has been selected by id.

handleSelectEvent(U32 popID, U32 command)

Helper function to allow menu selections from signal events.

insertItem(S32 pos, const char * title, const char * accelerator, const char * cmd)

pass NULL for

title
to insert a separator returns the menu item's ID, or -1 on failure.

insertSubMenu(S32 pos, const char * title, PopupMenu * submenu)

pass NULL for

title
to insert a separator returns the menu item's ID, or -1 on failure.

bool

Returns true if this menu is attached to the menu bar.

bool
bool

Called when the object is added to the sim.

onAttachToMenuBar(GuiCanvas * canvas, S32 pos, const char * title)

Called when the menu has been attached to the menu bar.

bool

Callback for when message objects are received.

bool
onMessageReceived(StringTableEntry queue, const char * msg, const char * data)

Callback for when messages are received.

Called when the object is removed from the sim.

Called when the menu has been removed from the menu bar.

Removes this menu from the menu bar.

removeItem(S32 itemPos)

remove the menu item at

itemPos
if the item has a submenu, it is removed from the mSubmenus list.

setBarTitle(const char * val)
bool
setItem(S32 pos, const char * title, const char * accelerator, const char * cmd)

Sets the name title and accelerator for an existing item.

showPopup(GuiCanvas * owner, S32 x, S32 y)

Displays this menu as a popup menu and blocks until the user has selected an item.

Public Static Functions

Detailed Description

Private Types

typedef SimObject Parent 

Public Friends

Protected Attributes

StringTableEntry mBarTitle 
SimObjectPtr< GuiCanvas > mCanvas 
PlatformPopupMenuData * mData 
bool mIsPopup 
U32 mPopupGUID 
SimSet * mSubmenus 

Public Static Attributes

PopupMenuEvent smPopupMenuEvent 
bool smSelectionEventHandled 

Private Functions

attachToMenuBar(GuiCanvas * owner, S32 pos)

Used by MenuBar to attach the menu to the menu bar. Do not use anywhere else.

Public Functions

PopupMenu()

~PopupMenu()

attachToMenuBar(GuiCanvas * owner, S32 pos, const char * title)

Places this menu in the menu bar of the application's main window.

Parameters:

owner

The GuiCanvas that owns the PlatformWindow that this call is associated with

pos

The relative position at which to place the menu.

title

The name of the menu

canHandleID(U32 iD)

Returns true iff this menu contains an item that matches

iD
.

implemented on a per-platform basis. TODO: factor out common code

checkItem(S32 pos, bool checked)

implemented on a per-platform basis.

checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos)

All items at positions firstPos through lastPos are unchecked, and the item at checkPos is checked.

implemented on a per-platform basis.

createPlatformMenu()

Set to true if any menu or submenu handles a selection event.

Creates the platform specific menu object, a peer to this object. The platform menu must exist before calling any method that manipulates menu items or displays the menu. implementd on a per-platform basis.

createPlatformPopupMenuData()

DECLARE_CONOBJECT(PopupMenu )

deletePlatformPopupMenuData()

enableItem(S32 pos, bool enable)

implemented on a per-platform basis.

getBarTitle()

getItemCount()

Returns the number of items in the menu.

getPopupGUID()

Returns the popup GUID.

getPosOnMenuBar()

Returns the position index of this menu on the bar.

handleSelect(U32 command, const char * text)

A menu item in this menu has been selected by id.

Submenus are given a chance to respond to the command first. If no submenu can handle the command id, this menu handles it. The script callback this::onSelectItem( position, text) is called. If

text
is null, then the text arg passed to script is the text of the selected menu item. implemented on a per-platform basis. TODO: factor out common code

handleSelectEvent(U32 popID, U32 command)

Helper function to allow menu selections from signal events.

Wraps canHandleID() and handleSelect() in one function without changing their internal functionality, so it should work regardless of platform.

insertItem(S32 pos, const char * title, const char * accelerator, const char * cmd)

pass NULL for

title
to insert a separator returns the menu item's ID, or -1 on failure.

implementd on a per-platform basis. TODO: factor out common code

insertSubMenu(S32 pos, const char * title, PopupMenu * submenu)

pass NULL for

title
to insert a separator returns the menu item's ID, or -1 on failure.

adds the submenu to the mSubmenus vector. implemented on a per-platform basis. TODO: factor out common code

isAttachedToMenuBar()

Returns true if this menu is attached to the menu bar.

isItemChecked(S32 pos)

onAdd()

Reimplemented from: SimObject

onAttachToMenuBar(GuiCanvas * canvas, S32 pos, const char * title)

Called when the menu has been attached to the menu bar.

onMenuSelect()

onMessageObjectReceived(StringTableEntry queue, Message * msg)

Reimplemented from: Dispatcher::IMessageListener

onMessageReceived(StringTableEntry queue, const char * msg, const char * data)

Reimplemented from: Dispatcher::IMessageListener

onRemove()

Reimplemented from: SimObject

onRemoveFromMenuBar(GuiCanvas * canvas)

Called when the menu has been removed from the menu bar.

removeFromMenuBar()

Removes this menu from the menu bar.

removeItem(S32 itemPos)

remove the menu item at

itemPos
if the item has a submenu, it is removed from the mSubmenus list.

implemented on a per-platform basis. TODO: factor out common code

setBarTitle(const char * val)

setItem(S32 pos, const char * title, const char * accelerator, const char * cmd)

Sets the name title and accelerator for an existing item.

showPopup(GuiCanvas * owner, S32 x, S32 y)

Displays this menu as a popup menu and blocks until the user has selected an item.

Parameters:

canvas

the owner to show this popup associated with

x

window local x coordinate at which to display the popup menu

y

window local y coordinate at which to display the popup menu implemented on a per-platform basis.

Public Static Functions

initPersistFields()