VISU - PHP Game Framework

FUISelect extends FUIView
in package

Table of Contents

Properties

$children  : array<string|int, FUIView>
An array of child views
$label  : string|null
A Label string that will be rendered before the select
$onSelect  : Closure|null
$options  : array<string, string>
$padding  : Vec4
Padding is represented as a Vec4 x = left padding y = right padding z = top padding w = bottom padding
$selectedOption  : string|null
The currently selected option key
$selectId  : string
Select ID
$style  : FUISelectStyle
The style of the select
$selectedOptionRef  : string|null
Reference to external selected option variable (if provided)

Methods

__construct()  : mixed
Constructs a new select
applyStyle()  : self
Applies the given select style
getEstimatedSize()  : Vec2
Returns the estimated size of the select
getSelectedOption()  : string|null
Gets the selected option
hideLabel()  : self
Hides the label for the select
padding()  : self
Sets the views padding Padding is the space inside the view to its content
paddingAll()  : self
Sets all padding values to the same value Padding is the space inside the view to its content
paddingBottom()  : self
Sets the views bottom padding Padding is the space inside the view to its content
paddingFull()  : self
Sets the views padding with individual values Padding is the space inside the view to its content
paddingLeft()  : self
Sets the views left padding Padding is the space inside the view to its content
paddingRight()  : self
Sets the views right padding Padding is the space inside the view to its content
paddingTop()  : self
Sets the views top padding Padding is the space inside the view to its content
paddingX()  : self
Sets the views horizontal padding (left and right) Padding is the space inside the view to its content
paddingY()  : self
Sets the views vertical padding (top and bottom) Padding is the space inside the view to its content
render()  : void
Renders the select
setId()  : self
Sets the select ID
setSelectedOption()  : self
Sets the selected option
isOpen()  : bool
Whether the dropdown is currently open (stored in context for persistence)
renderDropdown()  : void
Renders the dropdown list
setOpen()  : void
Sets the dropdown open state

Properties

$children

An array of child views

public array<string|int, FUIView> $children = []

$label

A Label string that will be rendered before the select

public string|null $label = null

$onSelect

public Closure|null $onSelect = null

$options

public array<string, string> $options

Array of key => label pairs

$padding

Padding is represented as a Vec4 x = left padding y = right padding z = top padding w = bottom padding

public Vec4 $padding

$selectedOption

The currently selected option key

public string|null $selectedOption = null

$selectedOptionRef

Reference to external selected option variable (if provided)

private string|null $selectedOptionRef = null

Methods

__construct()

Constructs a new select

public __construct(string $name, array<string, string> $options[, string|null &$selectedOption = null ][, Closure|null $onSelect = null ][, string|null $selectId = null ][, FUISelectStyle|null $selectStyle = null ]) : mixed
Parameters
$name : string

The name of the select, will also be used for the ID, so must be unique

$options : array<string, string>

Array of key => label pairs

$selectedOption : string|null = null
$onSelect : Closure|null = null
$selectId : string|null = null
$selectStyle : FUISelectStyle|null = null

getSelectedOption()

Gets the selected option

public getSelectedOption() : string|null
Return values
string|null

hideLabel()

Hides the label for the select

public hideLabel() : self
Return values
self

padding()

Sets the views padding Padding is the space inside the view to its content

public padding(float $horizontal, float $vertical) : self
Parameters
$horizontal : float
$vertical : float
Return values
self

paddingAll()

Sets all padding values to the same value Padding is the space inside the view to its content

public paddingAll(float $padding) : self
Parameters
$padding : float
Return values
self

paddingBottom()

Sets the views bottom padding Padding is the space inside the view to its content

public paddingBottom(float $paddingBottom) : self
Parameters
$paddingBottom : float
Return values
self

paddingFull()

Sets the views padding with individual values Padding is the space inside the view to its content

public paddingFull(float $left, float $right, float $top, float $bottom) : self
Parameters
$left : float
$right : float
$top : float
$bottom : float
Return values
self

paddingLeft()

Sets the views left padding Padding is the space inside the view to its content

public paddingLeft(float $paddingLeft) : self
Parameters
$paddingLeft : float
Return values
self

paddingRight()

Sets the views right padding Padding is the space inside the view to its content

public paddingRight(float $paddingRight) : self
Parameters
$paddingRight : float
Return values
self

paddingTop()

Sets the views top padding Padding is the space inside the view to its content

public paddingTop(float $paddingTop) : self
Parameters
$paddingTop : float
Return values
self

paddingX()

Sets the views horizontal padding (left and right) Padding is the space inside the view to its content

public paddingX(float $paddingX) : self
Parameters
$paddingX : float
Return values
self

paddingY()

Sets the views vertical padding (top and bottom) Padding is the space inside the view to its content

public paddingY(float $paddingY) : self
Parameters
$paddingY : float
Return values
self

setId()

Sets the select ID

public setId(string $id) : self
Parameters
$id : string
Return values
self

setSelectedOption()

Sets the selected option

public setSelectedOption(string|null $selectedOption) : self
Parameters
$selectedOption : string|null
Return values
self

renderDropdown()

Renders the dropdown list

private renderDropdown(FUIRenderContext $ctx, float $x, float $y, float $width) : void
Parameters
$ctx : FUIRenderContext
$x : float
$y : float
$width : float

        
On this page

Search results