C# Class Nez.UI.ButtonGroup

Manages a group of buttons to enforce a minimum and maximum number of checked buttons. This enables "radio button" functionality and more. A button may only be in one group at a time. The {@link #canCheck(Button, boolean)} method can be overridden to control if a button check or uncheck is allowed.
Show file Open project: prime31/Nez

Public Methods

Method Description
ButtonGroup ( ) : System
add ( ) : void
add ( Button button ) : void
canCheck ( Button button, bool newState ) : bool

Called when a button is checked or unchecked. If overridden, generally changing button checked states should not be done from within this method.

clear ( ) : void
getAllChecked ( ) : List
getButtons ( ) : List
getChecked ( ) : Button

The first checked button, or null.

getCheckedIndex ( ) : int

The first checked button index, or -1

remove ( ) : void
remove ( Button button ) : void
setChecked ( string text ) : void

Sets the first {@link TextButton} with the specified text to checked.

setMaxCheckCount ( int maxCheckCount ) : void

Sets the maximum number of buttons that can be checked. Set to -1 for no maximum. Default is 1.

setMinCheckCount ( int minCheckCount ) : void

Sets the minimum number of buttons that must be checked. Default is 1.

setUncheckLast ( bool uncheckLast ) : void

If true, when the maximum number of buttons are checked and an additional button is checked, the last button to be checked is unchecked so that the maximum is not exceeded. If false, additional buttons beyond the maximum are not allowed to be checked. Default is true.

uncheckAll ( ) : void

Sets all buttons' {@link Button#isChecked()} to false, regardless of {@link #setMinCheckCount(int)}.

Method Details

ButtonGroup() public method

public ButtonGroup ( ) : System
return System

add() public method

public add ( ) : void
return void

add() public method

public add ( Button button ) : void
button Button
return void

canCheck() public method

Called when a button is checked or unchecked. If overridden, generally changing button checked states should not be done from within this method.
public canCheck ( Button button, bool newState ) : bool
button Button Button.
newState bool New state.
return bool

clear() public method

public clear ( ) : void
return void

getAllChecked() public method

public getAllChecked ( ) : List
return List

getButtons() public method

public getButtons ( ) : List
return List

getChecked() public method

The first checked button, or null.
public getChecked ( ) : Button
return Button

getCheckedIndex() public method

The first checked button index, or -1
public getCheckedIndex ( ) : int
return int

remove() public method

public remove ( ) : void
return void

remove() public method

public remove ( Button button ) : void
button Button
return void

setChecked() public method

Sets the first {@link TextButton} with the specified text to checked.
public setChecked ( string text ) : void
text string Text.
return void

setMaxCheckCount() public method

Sets the maximum number of buttons that can be checked. Set to -1 for no maximum. Default is 1.
public setMaxCheckCount ( int maxCheckCount ) : void
maxCheckCount int Max check count.
return void

setMinCheckCount() public method

Sets the minimum number of buttons that must be checked. Default is 1.
public setMinCheckCount ( int minCheckCount ) : void
minCheckCount int Minimum check count.
return void

setUncheckLast() public method

If true, when the maximum number of buttons are checked and an additional button is checked, the last button to be checked is unchecked so that the maximum is not exceeded. If false, additional buttons beyond the maximum are not allowed to be checked. Default is true.
public setUncheckLast ( bool uncheckLast ) : void
uncheckLast bool Uncheck last.
return void

uncheckAll() public method

Sets all buttons' {@link Button#isChecked()} to false, regardless of {@link #setMinCheckCount(int)}.
public uncheckAll ( ) : void
return void