Torque3D Documentation / _generateds / GuiGameListMenuCtrl

GuiGameListMenuCtrl

Engine/source/gui/controls/guiGameListMenuCtrl.h

A base class for cross platform menu controls that are gamepad friendly.

More...

Classes:

class

Internal data representation of a single row in the control.

Callbacks

DECLARE_CALLBACK(void , onChange , () )

Public Types

Public Static Attributes

Indicates a row has no extra icon available.

Indicates a query result of no row found.

Protected Attributes

Script callback when the 'A' button is pressed.

Script callback when the 'B' button is pressed.

Script callback when the 'X' button is pressed.

Script callback when the 'Y' button is pressed.

bool

Determines when to show debug render lines.

Vector< Row * >

Holds data wrappers on all the rows we have.

Private Attributes

index of the currently highlighted row

index of the currently selected row

Public Functions

Activates the current row.

addRow(const char * label, const char * callback, S32 icon, S32 yPad, bool useHighlightIcon, bool enabled)

Adds a row to the control.

DECLARE_CATEGORY("Gui Game" )
DECLARE_DESCRIPTION("Base class <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> cross platform menu controls that are gamepad friendly." )

Gets the number of rows in the control.

getRowLabel(S32 rowIndex)

Gets the label displayed on the specified row.

bool

Determines if the specified row is enabled or disabled.

bool

Callback when the object is registered with the sim.

bool

Callback when the gamepad axis is activated.

bool

Callback when the gamepad axis is activated.

bool

Callback when a key is pressed.

bool

Callback when a key is repeating.

Callback when the mouse button is clicked on the control.

Callback when the mouse is dragged on the control.

Callback when the mouse leaves the control.

Callback when the mouse is moving over this control.

Callback when the mouse button is released.

onRender(Point2I offset, const RectI & updateRect)

Called when this control is to render itself.

bool

Callback when the control wakes up.

setRowEnabled(S32 index, bool enabled)

Sets a row's enabled status according to the given parameters.

setRowLabel(S32 rowIndex, const char * label)

Sets the label on the given row.

Sets the selected row.

Public Static Functions

Initializes fields accessible through the console.

Protected Functions

addRow(Row * row, const char * label, const char * callback, S32 icon, S32 yPad, bool useHighlightIcon, bool enabled)

Adds a row to the control.

Evaluates some script.

Enforces the validity of the fields on this control and its profile (if the profile is valid, see: hasValidProfile).

getRow(Point2I globalPoint)

Looks up the row having a hit area at the given global point.

bool

Checks to make sure our control has a profile of the correct type.

bool

Determines if the given index is a valid row index.

Called to implement debug rendering which displays colored lines to provide visual feedback on extents and hit zones.

Sets the script variable $ThisControl to reflect this control.

Private Functions

changeRow(S32 delta)

Changes the currently selected row.

Recalculates the height of this control based on the stored row height and and padding on the rows.

Sets the first enabled row as selected.

Makes sure the height will allow all rows to be displayed without being truncated.

Detailed Description

A base class for cross platform menu controls that are gamepad friendly.

Callbacks

DECLARE_CALLBACK(void , onChange , () )

Public Types

typedef GuiControl Parent 
typedef GuiGameListMenuProfile Profile 

Public Static Attributes

const S32 NO_ICON 

Indicates a row has no extra icon available.

const S32 NO_ROW 

Indicates a query result of no row found.

Protected Attributes

StringTableEntry mCallbackOnA 

Script callback when the 'A' button is pressed.

StringTableEntry mCallbackOnB 

Script callback when the 'B' button is pressed.

StringTableEntry mCallbackOnX 

Script callback when the 'X' button is pressed.

StringTableEntry mCallbackOnY 

Script callback when the 'Y' button is pressed.

bool mDebugRender 

Determines when to show debug render lines.

Vector< Row * > mRows 

Holds data wrappers on all the rows we have.

Private Attributes

S32 mHighlighted 

index of the currently highlighted row

S32 mSelected 

index of the currently selected row

Public Functions

GuiGameListMenuCtrl()

~GuiGameListMenuCtrl()

activateRow()

Activates the current row.

The script callback of the current row will be called (if it has one).

addRow(const char * label, const char * callback, S32 icon, S32 yPad, bool useHighlightIcon, bool enabled)

Adds a row to the control.

Parameters:

label

The text to display on the row as a label.

callback

Name of a script function to use as a callback when this row is activated.

icon

[optional] Index of the icon to use as a marker. Default -1 means no icon will be shown on this row.

yPad

[optional] An extra amount of height padding before the row.

enabled

[optional] If this row is initially enabled. Default true.

DECLARE_CATEGORY("Gui Game" )

DECLARE_CONOBJECT(GuiGameListMenuCtrl )

DECLARE_DESCRIPTION("Base class <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> cross platform menu controls that are gamepad friendly." )

getHighlighted()

return:

The index of the highlighted row or NO_ROW if none of the rows are currently highlighted.

getRowCount()

Gets the number of rows in the control.

return:

The number of rows in this control.

getRowLabel(S32 rowIndex)

Gets the label displayed on the specified row.

Parameters:

rowIndex

Index of the row to get the label of.

return:

The label for the row.

getSelected()

return:

The index of the selected row or NO_ROW if none of the rows are currently selected.

isRowEnabled(S32 index)

Determines if the specified row is enabled or disabled.

Parameters:

index

Index of the row to check.

return:

True if the specified row is enabled. False if the row is not enabled or the given index was not valid.

onAdd()

Reimplemented from: GuiControl

Reimplemented by: GuiGameListOptionsCtrl

onGamepadAxisDown(const GuiEvent & event)

Reimplemented from: GuiControl

onGamepadAxisUp(const GuiEvent & event)

Reimplemented from: GuiControl

onKeyDown(const GuiEvent & event)

Reimplemented from: GuiControl

Reimplemented by: GuiGameListOptionsCtrl

onKeyRepeat(const GuiEvent & event)

Reimplemented from: GuiControl

Reimplemented by: GuiGameListOptionsCtrl

onMouseDown(const GuiEvent & event)

Reimplemented from: GuiControl

onMouseDragged(const GuiEvent & event)

Reimplemented from: GuiControl

onMouseLeave(const GuiEvent & event)

Reimplemented from: GuiControl

onMouseMove(const GuiEvent & event)

Reimplemented from: GuiControl

onMouseUp(const GuiEvent & event)

Reimplemented from: GuiControl

Reimplemented by: GuiGameListOptionsCtrl

onRender(Point2I offset, const RectI & updateRect)

Reimplemented from: GuiControl

Reimplemented by: GuiGameListOptionsCtrl

onWake()

Reimplemented from: GuiControl

setRowEnabled(S32 index, bool enabled)

Sets a row's enabled status according to the given parameters.

Parameters:

index

The row to set the enabled status of.

enabled

Indicate true to enable the row or false to disable it.

setRowLabel(S32 rowIndex, const char * label)

Sets the label on the given row.

Parameters:

rowIndex

Index of the row to set the label on.

label

Text to set as the label of the row.

setSelected(S32 index)

Sets the selected row.

Only rows that are enabled can be selected. Input is clamped to [0, mRows.size())

Parameters:

index

The index to set as selected.

Public Static Functions

initPersistFields()

Initializes fields accessible through the console.

Protected Functions

addRow(Row * row, const char * label, const char * callback, S32 icon, S32 yPad, bool useHighlightIcon, bool enabled)

Adds a row to the control.

Parameters:

row

A reference to the row object to fill.

label

The text to display on the row as a label.

callback

Name of a script function to use as a callback when this row is activated.

icon

[optional] Index of the icon to use as a marker. Default -1 means no icon will be shown on this row.

yPad

[optional] An extra amount of height padding before the row.

enabled

[optional] If this row is initially enabled. Default true.

doScriptCommand(StringTableEntry command)

Evaluates some script.

If the command is empty then nothing is evaluated.

Parameters:

command

The script to evaluate.

enforceConstraints()

Enforces the validity of the fields on this control and its profile (if the profile is valid, see: hasValidProfile).

Reimplemented by: GuiGameListOptionsCtrl

getRow(Point2I globalPoint)

Looks up the row having a hit area at the given global point.

Parameters:

globalPoint

The point we want to check for hitting a row.

return:

The index of the hit row or NO_ROW if no row was hit.

hasValidProfile()

Checks to make sure our control has a profile of the correct type.

return:

True if the profile is of type GuiGameListMenuProfile or false if the profile is of any other type.

Reimplemented by: GuiGameListOptionsCtrl

isValidRowIndex(S32 index)

Determines if the given index is a valid row index.

Any index pointing at an existing row is valid.

Parameters:

index

The index to check for validity.

return:

True if the index points at a valid row, false otherwise.

onDebugRender(Point2I offset)

Called to implement debug rendering which displays colored lines to provide visual feedback on extents and hit zones.

Reimplemented by: GuiGameListOptionsCtrl

setThisControl()

Sets the script variable $ThisControl to reflect this control.

Private Functions

changeRow(S32 delta)

Changes the currently selected row.

Parameters:

delta

The amount to change the row selection by. Typically this will be 1 or -1.

getMinExtent()

Reimplemented from: GuiControl

selectFirstEnabledRow()

Sets the first enabled row as selected.

If there are no enabled rows then selected will be set to NO_ROW.

updateHeight()

Makes sure the height will allow all rows to be displayed without being truncated.