PHP Class PhpSchool\CliMenu\MenuStyle

Author: Michael Woodward ([email protected])
显示文件 Open project: php-school/cli-menu Class Usage Examples

Protected Properties

Property Type Description
$bg string
$contentWidth integer
$fg string
$margin integer
$padding integer
$terminal PhpSchool\CliMenu\Terminal\TerminalInterface
$width integer

Public Methods

Method Description
__construct ( PhpSchool\CliMenu\Terminal\TerminalInterface $terminal = null ) Initialise style
getAvailableColours ( ) : array
getBg ( ) : string
getContentWidth ( ) : integer
getDefaultStyleValues ( ) : array
getDisabledItemText ( string $text ) : string
getDisplaysExtra ( ) : boolean
getFg ( ) : string
getItemExtra ( ) : string
getMargin ( ) : integer
getMarker ( boolean $selected ) : string Get the correct marker for the item
getPadding ( ) : integer
getRightHandPadding ( $contentLength ) : integer Get padding for right had side of content
getSelectedMarker ( ) : string
getSelectedSetCode ( ) : string Get the colour code set for Bg and Fg
getSelectedUnsetCode ( ) : string Get the colour unset code for Bg and Fg
getTitleSeparator ( ) : string
getUnselectedMarker ( ) : string
getUnselectedSetCode ( ) : string Get the inverted colour code
getUnselectedUnsetCode ( ) : string Get the inverted colour unset code
getWidth ( ) : integer
setBg ( string $bg ) : MenuStyle
setDisplaysExtra ( boolean $displaysExtra )
setFg ( string $fg ) : MenuStyle
setItemExtra ( string $itemExtra )
setMargin ( integer $margin ) : MenuStyle
setPadding ( integer $padding ) : MenuStyle
setSelectedMarker ( string $marker )
setTitleSeparator ( string $actionSeparator )
setUnselectedMarker ( string $marker )
setWidth ( integer $width ) : MenuStyle

Protected Methods

Method Description
calculateContentWidth ( ) Calculate the contents width

Method Details

__construct() public method

Initialise style
public __construct ( PhpSchool\CliMenu\Terminal\TerminalInterface $terminal = null )
$terminal PhpSchool\CliMenu\Terminal\TerminalInterface

calculateContentWidth() protected method

Calculate the contents width
protected calculateContentWidth ( )

getAvailableColours() public static method

public static getAvailableColours ( ) : array
return array

getBg() public method

public getBg ( ) : string
return string

getContentWidth() public method

public getContentWidth ( ) : integer
return integer

getDefaultStyleValues() public static method

public static getDefaultStyleValues ( ) : array
return array

getDisabledItemText() public method

public getDisabledItemText ( string $text ) : string
$text string
return string

getDisplaysExtra() public method

public getDisplaysExtra ( ) : boolean
return boolean

getFg() public method

public getFg ( ) : string
return string

getItemExtra() public method

public getItemExtra ( ) : string
return string

getMargin() public method

public getMargin ( ) : integer
return integer

getMarker() public method

Get the correct marker for the item
public getMarker ( boolean $selected ) : string
$selected boolean
return string

getPadding() public method

public getPadding ( ) : integer
return integer

getRightHandPadding() public method

Get padding for right had side of content
public getRightHandPadding ( $contentLength ) : integer
$contentLength
return integer

getSelectedMarker() public method

public getSelectedMarker ( ) : string
return string

getSelectedSetCode() public method

Get the colour code set for Bg and Fg
public getSelectedSetCode ( ) : string
return string

getSelectedUnsetCode() public method

Get the colour unset code for Bg and Fg
public getSelectedUnsetCode ( ) : string
return string

getTitleSeparator() public method

public getTitleSeparator ( ) : string
return string

getUnselectedMarker() public method

public getUnselectedMarker ( ) : string
return string

getUnselectedSetCode() public method

Get the inverted colour code
public getUnselectedSetCode ( ) : string
return string

getUnselectedUnsetCode() public method

Get the inverted colour unset code
public getUnselectedUnsetCode ( ) : string
return string

getWidth() public method

public getWidth ( ) : integer
return integer

setBg() public method

public setBg ( string $bg ) : MenuStyle
$bg string
return MenuStyle

setDisplaysExtra() public method

public setDisplaysExtra ( boolean $displaysExtra )
$displaysExtra boolean

setFg() public method

public setFg ( string $fg ) : MenuStyle
$fg string
return MenuStyle

setItemExtra() public method

public setItemExtra ( string $itemExtra )
$itemExtra string

setMargin() public method

public setMargin ( integer $margin ) : MenuStyle
$margin integer
return MenuStyle

setPadding() public method

public setPadding ( integer $padding ) : MenuStyle
$padding integer
return MenuStyle

setSelectedMarker() public method

public setSelectedMarker ( string $marker )
$marker string

setTitleSeparator() public method

public setTitleSeparator ( string $actionSeparator )
$actionSeparator string

setUnselectedMarker() public method

public setUnselectedMarker ( string $marker )
$marker string

setWidth() public method

public setWidth ( integer $width ) : MenuStyle
$width integer
return MenuStyle

Property Details

$bg protected_oe property

protected string $bg
return string

$contentWidth protected_oe property

protected int $contentWidth
return integer

$fg protected_oe property

protected string $fg
return string

$margin protected_oe property

protected int $margin
return integer

$padding protected_oe property

protected int $padding
return integer

$terminal protected_oe property

protected TerminalInterface,PhpSchool\CliMenu\Terminal $terminal
return PhpSchool\CliMenu\Terminal\TerminalInterface

$width protected_oe property

protected int $width
return integer