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 , () )
DECLARE_CALLBACK(void , onInputEvent , (const char *device, const char *action, bool state) )
DECLARE_CALLBACK(void , onAxisEvent , (const char *device, const char *action, F32 axisValue) )

Public Types

Public Static Attributes

Indicates a row has no extra icon available.

Indicates there is no option.

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 * bitmapName, const char * callback, S32 icon, S32 yPad, bool enabled, const char * tooltip)
addRow(const char * label, const char * callback, S32 icon, S32 yPad, bool useHighlightIcon, bool enabled, S32 mode, const char * tooltip)

Adds a row to the control.

addRow(const char * label, const char * optionsList, bool wrapOptions, const char * callback, S32 icon, S32 yPad, bool enabled, const char * tooltip, const char * defaultValue)

Adds a row to the control.

addRow(const char * label, F32 defaultValue, F32 increments, Point2F range, const char * callback, S32 icon, S32 yPad, bool enabled, const char * tooltip)

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 text for the currently selected option of the given row.

Gets the number of rows in the control.

getRowLabel(S32 rowIndex)

Gets the label displayed on the specified row.

const char *
getTooltip(S32 rowIndex)

Gets the tooltip of a row.

getValue(S32 rowIndex)

Gets the value of a 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 the gamepad axis is activated.

bool

Callback when the gamepad axis is activated.

bool

General input handler.

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.

onRenderKeybindOption(Row * row, Point2I currentOffset)
onRenderListOption(Row * row, Point2I currentOffset)
onRenderSliderOption(Row * row, Point2I currentOffset)
bool

Callback when the control wakes up.

bool
selectOption(S32 rowIndex, StringTableEntry option)

Attempts to set the given row to the specified selected option.

setOptions(S32 rowIndex, const char * optionsList)

Sets the list of options on the given row.

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.

setValue(S32 rowIndex, F32 value)

Sets the value of a 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, S32 mode, const char * tooltip)

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

changeOption(Row * row, S32 delta)

Changes the option on the given row.

Changes the option on the currently selected row.

changeRow(S32 delta)

Changes the currently selected row.

clickKeybind(Row * row, S32 xPos)
clickOption(Row * row, S32 xPos)

Performs a click on the current option row.

clickSlider(Row * row, S32 xPos)

Performs a click on the current slider 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 , () )

DECLARE_CALLBACK(void , onInputEvent , (const char *device, const char *action, bool state) )

DECLARE_CALLBACK(void , onAxisEvent , (const char *device, const char *action, F32 axisValue) )

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_OPTION 

Indicates there is no option.

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

bool mCallbackOnInputs 
bool mConsumeKeyInputEvents 
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 * bitmapName, const char * callback, S32 icon, S32 yPad, bool enabled, const char * tooltip)

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

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.

addRow(const char * label, const char * optionsList, bool wrapOptions, const char * callback, S32 icon, S32 yPad, bool enabled, const char * tooltip, const char * defaultValue)

Adds a row to the control.

Parameters:

label

The text to display on the row as a label.

optionsList

A tab separated list of options for the control.

wrapOptions

Specify true to allow options to wrap at the ends or false to prevent wrapping.

callback

[optional] Name of a script function to use as a callback when this row is activated. Default NULL means no callback.

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.

addRow(const char * label, F32 defaultValue, F32 increments, Point2F range, const char * callback, S32 icon, S32 yPad, bool enabled, const char * tooltip)

Adds a row to the control.

Parameters:

label

The text to display on the row as a label.

defaultValue

A float indicating the slider's default value

increments

A float indicating the incremental values the slider snaps along between it's range

range

A Point2F that indicates the minimum and maximum value range

callback

[optional] Name of a script function to use as a callback when this row is activated. Default NULL means no callback.

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.

clearRows()

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." )

getCurrentOption(S32 rowIndex)

Gets the text for the currently selected option of the given row.

Parameters:

rowIndex

Index of the row to get the option from.

return:

A string representing the text currently displayed as the selected option on the given row. If there is no such displayed text then the empty string is returned.

getHighlighted()

return:

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

getRowBounds(S32 rowIndex)

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.

getTooltip(S32 rowIndex)

Gets the tooltip of a row.

Parameters:

rowIndex

Index of the row to get the tooltip of.

getValue(S32 rowIndex)

Gets the value of a row.

Parameters:

rowIndex

Index of the row to get the value of.

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

onGamepadAxisLeft(const GuiEvent & event)

Reimplemented from: GuiControl

Reimplemented by: GuiGameListOptionsCtrl

onGamepadAxisRight(const GuiEvent & event)

Reimplemented from: GuiControl

Reimplemented by: GuiGameListOptionsCtrl

onGamepadAxisUp(const GuiEvent & event)

Reimplemented from: GuiControl

onInputEvent(const InputEventInfo & 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

onRenderKeybindOption(Row * row, Point2I currentOffset)

onRenderListOption(Row * row, Point2I currentOffset)

onRenderSliderOption(Row * row, Point2I currentOffset)

onWake()

Reimplemented from: GuiControl

refresh()

removeRow(const S32 & row)

selectOption(S32 rowIndex, StringTableEntry option)

Attempts to set the given row to the specified selected option.

The option will only be set if the option exists in the control.

Parameters:

rowIndex

Index of the row to set an option on.

option

The option to be made active.

return:

True if the row contained the option and was set, false otherwise.

setOptions(S32 rowIndex, const char * optionsList)

Sets the list of options on the given row.

Parameters:

rowIndex

Index of the row to set options on.

optionsList

A tab separated list of options for the control.

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.

setValue(S32 rowIndex, F32 value)

Sets the value of a row.

Parameters:

rowIndex

Index of the row to set the value of.

value

The new value to be set.

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, S32 mode, const char * tooltip)

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

changeOption(Row * row, S32 delta)

Changes the option on the given row.

Parameters:

row

The row to change the option on.

delta

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

changeOption(S32 delta)

Changes the option on the currently selected row.

If there is no row selected, this method does nothing.

Parameters:

delta

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

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.

clickKeybind(Row * row, S32 xPos)

clickOption(Row * row, S32 xPos)

Performs a click on the current option row.

The x position is used to determine if the left or right arrow were clicked. If one was clicked, the option will be changed. If neither was clicked, the option is unaffected. This method should only be called when there is an actively selected row.

Parameters:

row

The row to perform the click on.

xPos

The x position of the the click, relative to the control.

clickSlider(Row * row, S32 xPos)

Performs a click on the current slider row.

The x position is used to determine if the left or right arrow were clicked, or if it landed somewhere on the sliderbar. If one was clicked, the option will be changed. If neither was clicked, the option is unaffected. This method should only be called when there is an actively selected row.

Parameters:

row

The row to perform the click on.

xPos

The x position of the the click, relative to the control.

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.