C# Class Nez.UI.Table

A group that sizes and positions children using table constraints. By default, {@link #getTouchable()} is {@link Touchable#childrenOnly}. The preferred and minimum sizes are that of the chdebugn when laid out in columns and rows.
Inheritance: Group
ファイルを表示 Open project: prime31/Nez Class Usage Examples

Public Properties

Property Type Description
backgroundBottom Value
backgroundLeft Value
backgroundRight Value
backgroundTop Value
clip bool
debugCellColor Color
debugElementColor Color
debugTableColor Color

Protected Properties

Property Type Description
_background IDrawable

Public Methods

Method Description
Table ( ) : System
add ( ) : Cell

Adds a cell without an element

add ( Element element ) : Cell

Adds a new cell to the table with the specified element.

add ( string text ) : Cell

Adds a new cell with a label

addDebugRect ( float x, float y, float w, float h, Color color ) : void
align ( int align ) : Table

Alignment of the logical table within the table element. Set to {@link Align#center}, {@link Align#top}, {@link Align#bottom} {@link Align#left}, {@link Align#right}, or any combination of those.

bottom ( ) : Table

Adds {@link Align#bottom} and clears {@link Align#top} for the alignment of the logical table within the table element.

center ( ) : Table

Sets the alignment of the logical table within the table element to {@link Align#center}. This clears any other alignment.

clearChildren ( ) : void

Removes all elements and cells from the table

computeDebugRects ( float x, float y, float layoutX, float layoutY, float layoutWidth, float layoutHeight, float tableWidth, float tableHeight, float hpadding, float vpadding ) : void
computeSize ( ) : void
debugAll ( ) : Table

Turn on all debug lines (table, cell, and element)

debugCell ( ) : Table

Turns on cell debug lines.

debugElement ( ) : Table

Turns on element debug lines.

debugRender ( Graphics graphics ) : void
debugTable ( ) : Table

Turns on table debug lines.

defaults ( ) : Cell

The cell values that will be used as the defaults for all cells.

draw ( Graphics graphics, float parentAlpha ) : void
endRow ( ) : void
getAlign ( ) : int
getBackground ( ) : IDrawable
getCell ( Element element ) : Cell

Returns the cell for the specified element in this table, or null.

getCells ( ) : List

returns all the Cells in the table

getColumnDefaults ( int column ) : Cell

Gets the cell values that will be used as the defaults for all cells in the specified column. Columns are indexed starting at 0

getColumnWidth ( int columnIndex ) : float

Returns the width of the specified column.

getColumns ( ) : int
getPadBottom ( ) : float
getPadBottomValue ( ) : Value
getPadLeft ( ) : float
getPadLeftValue ( ) : Value
getPadRight ( ) : float
getPadRightValue ( ) : Value
getPadTop ( ) : float
getPadTopValue ( ) : Value
getPadX ( ) : float

Returns {@link #getPadLeft()} plus {@link #getPadRight()}.

getPadY ( ) : float

Returns {@link #getPadTop()} plus {@link #getPadBottom()}.

getRowDefaults ( ) : Cell

gets the current Cell defaults. This is the same value returned by a call to row()

getRowHeight ( int rowIndex ) : float

Returns the height of the specified row.

getRows ( ) : int
hit ( Vector2 point ) : Element
invalidate ( ) : void
layout ( ) : void
layout ( float layoutX, float layoutY, float layoutWidth, float layoutHeight ) : void

Positions and sizes children of the table using the cell associated with each child. The values given are the position within the parent and size of the table.

left ( ) : Table

Adds {@link Align#left} and clears {@link Align#right} for the alignment of the logical table within the table element.

pad ( Value pad ) : Table

Sets the padTop, padLeft, padBottom, and padRight around the table to the specified value.

pad ( Value top, Value left, Value bottom, Value right ) : Table
pad ( float pad ) : Table

Sets the padTop, padLeft, padBottom, and padRight around the table to the specified value.

pad ( float top, float left, float bottom, float right ) : Table
padBottom ( Value padBottom ) : Table

Padding at the bottom edge of the table.

padBottom ( float padBottom ) : Table

Padding at the bottom edge of the table.

padLeft ( Value padLeft ) : Table

Padding at the left edge of the table.

padLeft ( float padLeft ) : Table

Padding at the left edge of the table.

padRight ( Value padRight ) : Table

Padding at the right edge of the table.

padRight ( float padRight ) : Table

Padding at the right edge of the table.

padTop ( Value padTop ) : Table

Padding at the top edge of the table.

padTop ( float padTop ) : Table

Padding at the top edge of the table.

removeElement ( Element element ) : bool
reset ( ) : void

Removes all elements and cells from the table (same as {@link #clear()}) and additionally resets all table properties and cell, column, and row defaults.

right ( ) : Table

Adds {@link Align#right} and clears {@link Align#left} for the alignment of the logical table within the table element.

round ( bool round ) : Table

If true (the default), positions and sizes are rounded to integers.

row ( ) : Cell

Indicates that subsequent cells should be added to a new row and returns the cell values that will be used as the defaults for all cells in the new row.

setBackground ( IDrawable background ) : Table

background may be null to clear the background.

setDebug ( bool enabled ) : void

enables/disables all debug lines (table, cell, and widget)

setFillParent ( bool fillParent ) : Table
stack ( ) : Cell

Adds a new cell to the table with the specified elements in a {@link Stack}.

tableDebug ( TableDebug tableDebug ) : Table

Turns debug lines on or off.

top ( ) : Table

Adds {@link Align#top} and clears {@link Align#bottom} for the alignment of the logical table within the table element.

Protected Methods

Method Description
drawBackground ( Graphics graphics, float parentAlpha, float x, float y ) : void

Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background drawable.

Private Methods

Method Description
ensureSize ( float array, int size ) : float[]
obtainCell ( ) : Cell

Method Details

Table() public method

public Table ( ) : System
return System

add() public method

Adds a cell without an element
public add ( ) : Cell
return Cell

add() public method

Adds a new cell to the table with the specified element.
public add ( Element element ) : Cell
element Element element.
return Cell

add() public method

Adds a new cell with a label
public add ( string text ) : Cell
text string Text.
return Cell

addDebugRect() public method

public addDebugRect ( float x, float y, float w, float h, Color color ) : void
x float
y float
w float
h float
color Color
return void

align() public method

Alignment of the logical table within the table element. Set to {@link Align#center}, {@link Align#top}, {@link Align#bottom} {@link Align#left}, {@link Align#right}, or any combination of those.
public align ( int align ) : Table
align int Align.
return Table

bottom() public method

Adds {@link Align#bottom} and clears {@link Align#top} for the alignment of the logical table within the table element.
public bottom ( ) : Table
return Table

center() public method

Sets the alignment of the logical table within the table element to {@link Align#center}. This clears any other alignment.
public center ( ) : Table
return Table

clearChildren() public method

Removes all elements and cells from the table
public clearChildren ( ) : void
return void

computeDebugRects() public method

public computeDebugRects ( float x, float y, float layoutX, float layoutY, float layoutWidth, float layoutHeight, float tableWidth, float tableHeight, float hpadding, float vpadding ) : void
x float
y float
layoutX float
layoutY float
layoutWidth float
layoutHeight float
tableWidth float
tableHeight float
hpadding float
vpadding float
return void

computeSize() public method

public computeSize ( ) : void
return void

debugAll() public method

Turn on all debug lines (table, cell, and element)
public debugAll ( ) : Table
return Table

debugCell() public method

Turns on cell debug lines.
public debugCell ( ) : Table
return Table

debugElement() public method

Turns on element debug lines.
public debugElement ( ) : Table
return Table

debugRender() public method

public debugRender ( Graphics graphics ) : void
graphics Graphics
return void

debugTable() public method

Turns on table debug lines.
public debugTable ( ) : Table
return Table

defaults() public method

The cell values that will be used as the defaults for all cells.
public defaults ( ) : Cell
return Cell

draw() public method

public draw ( Graphics graphics, float parentAlpha ) : void
graphics Graphics
parentAlpha float
return void

drawBackground() protected method

Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background drawable.
protected drawBackground ( Graphics graphics, float parentAlpha, float x, float y ) : void
graphics Graphics Graphics.
parentAlpha float Parent alpha.
x float The x coordinate.
y float The y coordinate.
return void

endRow() public method

public endRow ( ) : void
return void

getAlign() public method

public getAlign ( ) : int
return int

getBackground() public method

public getBackground ( ) : IDrawable
return IDrawable

getCell() public method

Returns the cell for the specified element in this table, or null.
public getCell ( Element element ) : Cell
element Element element.
return Cell

getCells() public method

returns all the Cells in the table
public getCells ( ) : List
return List

getColumnDefaults() public method

Gets the cell values that will be used as the defaults for all cells in the specified column. Columns are indexed starting at 0
public getColumnDefaults ( int column ) : Cell
column int Column.
return Cell

getColumnWidth() public method

Returns the width of the specified column.
public getColumnWidth ( int columnIndex ) : float
columnIndex int Column index.
return float

getColumns() public method

public getColumns ( ) : int
return int

getPadBottom() public method

public getPadBottom ( ) : float
return float

getPadBottomValue() public method

public getPadBottomValue ( ) : Value
return Value

getPadLeft() public method

public getPadLeft ( ) : float
return float

getPadLeftValue() public method

public getPadLeftValue ( ) : Value
return Value

getPadRight() public method

public getPadRight ( ) : float
return float

getPadRightValue() public method

public getPadRightValue ( ) : Value
return Value

getPadTop() public method

public getPadTop ( ) : float
return float

getPadTopValue() public method

public getPadTopValue ( ) : Value
return Value

getPadX() public method

Returns {@link #getPadLeft()} plus {@link #getPadRight()}.
public getPadX ( ) : float
return float

getPadY() public method

Returns {@link #getPadTop()} plus {@link #getPadBottom()}.
public getPadY ( ) : float
return float

getRowDefaults() public method

gets the current Cell defaults. This is the same value returned by a call to row()
public getRowDefaults ( ) : Cell
return Cell

getRowHeight() public method

Returns the height of the specified row.
public getRowHeight ( int rowIndex ) : float
rowIndex int Row index.
return float

getRows() public method

public getRows ( ) : int
return int

hit() public method

public hit ( Vector2 point ) : Element
point Vector2
return Element

invalidate() public method

public invalidate ( ) : void
return void

layout() public method

public layout ( ) : void
return void

layout() public method

Positions and sizes children of the table using the cell associated with each child. The values given are the position within the parent and size of the table.
public layout ( float layoutX, float layoutY, float layoutWidth, float layoutHeight ) : void
layoutX float Layout x.
layoutY float Layout y.
layoutWidth float Layout width.
layoutHeight float Layout height.
return void

left() public method

Adds {@link Align#left} and clears {@link Align#right} for the alignment of the logical table within the table element.
public left ( ) : Table
return Table

pad() public method

Sets the padTop, padLeft, padBottom, and padRight around the table to the specified value.
public pad ( Value pad ) : Table
pad Value Pad.
return Table

pad() public method

public pad ( Value top, Value left, Value bottom, Value right ) : Table
top Value
left Value
bottom Value
right Value
return Table

pad() public method

Sets the padTop, padLeft, padBottom, and padRight around the table to the specified value.
public pad ( float pad ) : Table
pad float Pad.
return Table

pad() public method

public pad ( float top, float left, float bottom, float right ) : Table
top float
left float
bottom float
right float
return Table

padBottom() public method

Padding at the bottom edge of the table.
public padBottom ( Value padBottom ) : Table
padBottom Value Pad bottom.
return Table

padBottom() public method

Padding at the bottom edge of the table.
public padBottom ( float padBottom ) : Table
padBottom float Pad bottom.
return Table

padLeft() public method

Padding at the left edge of the table.
public padLeft ( Value padLeft ) : Table
padLeft Value Pad left.
return Table

padLeft() public method

Padding at the left edge of the table.
public padLeft ( float padLeft ) : Table
padLeft float Pad left.
return Table

padRight() public method

Padding at the right edge of the table.
public padRight ( Value padRight ) : Table
padRight Value Pad right.
return Table

padRight() public method

Padding at the right edge of the table.
public padRight ( float padRight ) : Table
padRight float Pad right.
return Table

padTop() public method

Padding at the top edge of the table.
public padTop ( Value padTop ) : Table
padTop Value Pad top.
return Table

padTop() public method

Padding at the top edge of the table.
public padTop ( float padTop ) : Table
padTop float Pad top.
return Table

removeElement() public method

public removeElement ( Element element ) : bool
element Element
return bool

reset() public method

Removes all elements and cells from the table (same as {@link #clear()}) and additionally resets all table properties and cell, column, and row defaults.
public reset ( ) : void
return void

right() public method

Adds {@link Align#right} and clears {@link Align#left} for the alignment of the logical table within the table element.
public right ( ) : Table
return Table

round() public method

If true (the default), positions and sizes are rounded to integers.
public round ( bool round ) : Table
round bool If set to true round.
return Table

row() public method

Indicates that subsequent cells should be added to a new row and returns the cell values that will be used as the defaults for all cells in the new row.
public row ( ) : Cell
return Cell

setBackground() public method

background may be null to clear the background.
public setBackground ( IDrawable background ) : Table
background IDrawable Background.
return Table

setDebug() public method

enables/disables all debug lines (table, cell, and widget)
public setDebug ( bool enabled ) : void
enabled bool If set to true enabled.
return void

setFillParent() public method

public setFillParent ( bool fillParent ) : Table
fillParent bool
return Table

stack() public method

Adds a new cell to the table with the specified elements in a {@link Stack}.
public stack ( ) : Cell
return Cell

tableDebug() public method

Turns debug lines on or off.
public tableDebug ( TableDebug tableDebug ) : Table
tableDebug TableDebug Table debug.
return Table

top() public method

Adds {@link Align#top} and clears {@link Align#bottom} for the alignment of the logical table within the table element.
public top ( ) : Table
return Table

Property Details

_background protected_oe property

protected IDrawable _background
return IDrawable

backgroundBottom static_oe public_oe property

static public Value,Nez.UI backgroundBottom
return Value

backgroundLeft static_oe public_oe property

static public Value,Nez.UI backgroundLeft
return Value

backgroundRight static_oe public_oe property

static public Value,Nez.UI backgroundRight
return Value

backgroundTop static_oe public_oe property

static public Value,Nez.UI backgroundTop
return Value

clip public_oe property

public bool clip
return bool

debugCellColor static_oe public_oe property

static public Color debugCellColor
return Color

debugElementColor static_oe public_oe property

static public Color debugElementColor
return Color

debugTableColor static_oe public_oe property

static public Color debugTableColor
return Color