Torque3D Documentation / _generateds / GuiGameListMenuCtrl

GuiGameListMenuCtrl

consoledoc.h

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

More...

Callbacks

void

Called when the selected row changes.

void
onInputEvent(string device, string action, bool state)

Callback that occurs when an input is triggered on this control.

void
onAxisEvent(string device, string action, float axisValue)

Callback that occurs when an axis event is triggered on this control.

Public Attributes

string

Script callback when the 'A' button is pressed. 'A' inputs are Keyboard: A, Return, Space; Gamepad: A, Start.

string

Script callback when the 'B' button is pressed. 'B' inputs are Keyboard: B, Esc, Backspace, Delete; Gamepad: B, Back.

bool

Script callback when any inputs are detected, even if they aren't the regular 4 face buttons. Useful for secondary/speciality handling of menu navigation.

string

Script callback when the 'X' button is pressed. 'X' inputs are Keyboard: X; Gamepad: X.

string

Script callback when the 'Y' button is pressed. 'Y' inputs are Keyboard: Y; Gamepad: Y.

bool

When callbackOnInputs is active, this indicates if the input event should be consumed, or allowed 'through' to let other things respond to the event as well.

bool

Enable debug rendering.

Public Functions

void

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

void
addKeybindRow(string label, string bitmapName, string callback, int icon, int yPad, bool enabled, string tooltip)

Add a row to the list control.

void
addOptionRow(string label, string options, bool wrapOptions, string callback, int icon, int yPad, bool enabled, string tooltip, string defaultValue)

Add a row to the list control.

void
addRow(string label, string callback, int icon, int yPad, bool useHighlightIcon, bool enabled, int mode)

Add a row to the list control.

void
addSliderRow(string label, float defaultValue, float increment, Point2F range, string callback, int icon, int yPad, bool enabled, string tooltip)

Add a row to the list control.

void

Gets the index of the currently selected row.

string

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

int

Gets the number of rows on the control.

string
getRowLabel(int row)

Gets the label displayed on the specified row.

int

Gets the index of the currently selected row.

string
getTooltip(int row)

Sets the list of options on the given row.

float
getValue(int row)

Sets the list of options on the given row.

bool
isRowEnabled(int row)

Determines if the specified row is enabled or disabled.

void

Gets the index of the currently selected row.

void
removeRow(int row)

Removes the row at the provided index.

bool
selectOption(int row, string option)

Set the row's current option to the one specified.

void
setOptions(int row, string optionsList)

Sets the list of options on the given row.

void
setRowEnabled(int row, bool enabled)

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

void
setRowLabel(int row, string label)

Sets the label on the given row.

void
setSelected(int row)

Sets the selected row. Only rows that are enabled can be selected.

void
setValue(int row, float value)

Sets the list of options on the given row.

Detailed Description

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

This class is used to build row-based menu GUIs that can be easily navigated using the keyboard, mouse or gamepad. The desired row can be selected using the mouse, or by navigating using the Up and Down buttons.

new GuiGameListMenuCtrl()
{
   debugRender = "0";
   callbackOnA = "applyOptions();";
   callbackOnB = "Canvas.setContent(MainMenuGui);";
   callbackOnX = "";
   callbackOnY = "revertOptions();";
   //Properties not specific to this control have been omitted from this example.
};

Callbacks

onChange()

Called when the selected row changes.

onInputEvent(string device, string action, bool state)

Callback that occurs when an input is triggered on this control.

Parameters:

device

The device type triggering the input, such as keyboard, mouse, etc

action

The actual event occuring, such as a key or button

state

True if the action is being pressed, false if it is being release

onAxisEvent(string device, string action, float axisValue)

Callback that occurs when an axis event is triggered on this control.

Parameters:

device

The device type triggering the input, such as mouse, joystick, gamepad, etc

action

The ActionMap code for the axis

axisValue

The current value of the axis

Public Attributes

string callbackOnA 

Script callback when the 'A' button is pressed. 'A' inputs are Keyboard: A, Return, Space; Gamepad: A, Start.

string callbackOnB 

Script callback when the 'B' button is pressed. 'B' inputs are Keyboard: B, Esc, Backspace, Delete; Gamepad: B, Back.

bool callbackOnInputs 

Script callback when any inputs are detected, even if they aren't the regular 4 face buttons. Useful for secondary/speciality handling of menu navigation.

string callbackOnX 

Script callback when the 'X' button is pressed. 'X' inputs are Keyboard: X; Gamepad: X.

string callbackOnY 

Script callback when the 'Y' button is pressed. 'Y' inputs are Keyboard: Y; Gamepad: Y.

bool consumeKeyInputEvents 

When callbackOnInputs is active, this indicates if the input event should be consumed, or allowed 'through' to let other things respond to the event as well.

bool debugRender 

Enable debug rendering.

Public Functions

activateRow()

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

addKeybindRow(string label, string bitmapName, string callback, int icon, int yPad, bool enabled, string tooltip)

Add a row to the list control.

Parameters:

label

The text to display on the row as a label.

options

A tab separated list of options.

wrapOptions

Specify true to allow options to wrap at each end or false to prevent wrapping.

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.

yPad

[optional] An extra amount of height padding before the row. Does nothing on the first row.

enabled

[optional] If this row is initially enabled.

addOptionRow(string label, string options, bool wrapOptions, string callback, int icon, int yPad, bool enabled, string tooltip, string defaultValue)

Add a row to the list control.

Parameters:

label

The text to display on the row as a label.

options

A tab separated list of options.

wrapOptions

Specify true to allow options to wrap at each end or false to prevent wrapping.

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.

yPad

[optional] An extra amount of height padding before the row. Does nothing on the first row.

enabled

[optional] If this row is initially enabled.

addRow(string label, string callback, int icon, int yPad, bool useHighlightIcon, bool enabled, int mode)

Add a row to the list 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.

yPad

[optional] An extra amount of height padding before the row. Does nothing on the first row.

useHighlightIcon

[optional] Does this row use the highlight icon?.

enabled

[optional] If this row is initially enabled.

mode

[optional] What option mode the row is in. 0 = Default, 1 = OptionList, 2 == Keybind

addSliderRow(string label, float defaultValue, float increment, Point2F range, string callback, int icon, int yPad, bool enabled, string tooltip)

Add a row to the list control.

Parameters:

label

The text to display on the row as a label.

options

A tab separated list of options.

wrapOptions

Specify true to allow options to wrap at each end or false to prevent wrapping.

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.

yPad

[optional] An extra amount of height padding before the row. Does nothing on the first row.

enabled

[optional] If this row is initially enabled.

clearRows()

Gets the index of the currently selected row.

return:

Index of the selected row.

getCurrentOption(int row)

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

Parameters:

row

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.

getRowCount()

Gets the number of rows on the control.

return:

(int) The number of rows on the control.

getRowLabel(int row)

Gets the label displayed on the specified row.

Parameters:

row

Index of the row to get the label of.

return:

The label for the row.

getSelectedRow()

Gets the index of the currently selected row.

return:

Index of the selected row.

getTooltip(int row)

Sets the list of options on the given row.

Parameters:

row

Index of the row to set options on.

optionsList

A tab separated list of options for the control.

getValue(int row)

Sets the list of options on the given row.

Parameters:

row

Index of the row to set options on.

optionsList

A tab separated list of options for the control.

isRowEnabled(int row)

Determines if the specified row is enabled or disabled.

Parameters:

row

The row to set the enabled status of.

return:

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

refresh()

Gets the index of the currently selected row.

return:

Index of the selected row.

removeRow(int row)

Removes the row at the provided index.

selectOption(int row, string option)

Set the row's current option to the one specified.

Parameters:

row

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(int row, string optionsList)

Sets the list of options on the given row.

Parameters:

row

Index of the row to set options on.

optionsList

A tab separated list of options for the control.

setRowEnabled(int row, bool enabled)

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

Parameters:

row

The index to check for validity.

enabled

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

setRowLabel(int row, string label)

Sets the label on the given row.

Parameters:

row

Index of the row to set the label on.

label

Text to set as the label of the row.

setSelected(int row)

Sets the selected row. Only rows that are enabled can be selected.

Parameters:

row

Index of the row to set as selected.

setValue(int row, float value)

Sets the list of options on the given row.

Parameters:

row

Index of the row to set options on.

optionsList

A tab separated list of options for the control.