Skip to content

Cell


Members

aspectRatio

desc: The aspect ratio of the cell in width divided by height. An aspect ratio of 0 means that aspectRatio wont be applied to the cell.

type: number

default:

border

desc: The border of the cell.

type: GridGUI.Position

meta: [object]

borderX

desc: The horizontal border or margin of the cell that is the amount of additional width beyond what the GridGUI.Cell.ctrl needs that is taken up by the cell.

type: number

default: 5

borderY

desc: The vertical border or margin of the cell that is the amount of additional height beyond what the GridGUI.Cell.ctrl needs that is taken up by the cell.

type: number

default: 5

ctrl

desc: The control that is managed by this cell. The control class needs to implement the two methods ControlGetPos and Draw as well as have the four members initialWidth, initialHeight, initialWidthVal and initialHeightVal.

type: GridGUI.Control

meta: [object]

ctrlInitialPos

desc: The initial position and size of the GridGUI.Cell.ctrl. It is used as the min size of the GridGUI.Cell.ctrl if no min size is specified.

type: GridGUI.Position

meta: [object]

ctrlPos

desc: The position and size when the GridGUI.Cell.ctrl was last drawn.

type: GridGUI.Position

meta: [object]

exH

desc: The vertical expansion weight of the cell. This is used to calculate the part of the additional GUI height that this cell should take.

type: number

default: 0

exW

desc: The horizontal expansion weight of the cell. This is used to calculate the part of the additional GUI width that this cell should take.

type: number

default: 0

fillH

desc: Whether or not to set the height of the GridGUI.Cell.ctrl to the height of the cell.

type: bool

default: false

fillW

desc: Whether or not to set the width of the GridGUI.Cell.ctrl to the width of the cell.

type: bool

default: false

gridpos

desc: The position and size of the cell in the grid in columns and rows. That is in the same coordinate system that is used when adding cells to a GridGUI.GridGUIClass.

type: GridGUI.Position

meta: [object]

hasHConfligts

desc: Whether or not the cell needs to take any other cells into account when calculating its height.

type: bool

default: false

hasWConfligts

desc: Whether or not the cell needs to take any other cells into account when calculating its width.

type: bool

default: false

justifyOptions

desc: How the GridGUI.Cell.ctrl will be positioned in the cell when drawn. Can be any combination of C (Center), N (North), S (South), W (West) and E (East).

type: string

default: C

othersH

desc: The combined vertical expansion weight of other cells that this cell is in conflict with. This is used to calculate the part of the additional GUI height that this cell should take.

type: number

default: 0

othersW

desc: The combined horizontal expansion weight of other cells that this cell is in conflict with. This is used to calculate the part of the additional GUI width that this cell should take.

type: number

default: 0

pos

desc: The position and size of the cell.

type: GridGUI.Position

meta: [object]

Methods

__Delete

__Delete()

Destructor. Destroys the GridGUI.Cell.ctrl.

__FindLeastUsedRowColumn

__FindLeastUsedRowColumn(size, start, nonExpanders, expanders)

Returns the index of the where there are the lest amount of cells with a fixed size or where there is the largest expansion weight.

parameters

name: size

desc: How many indexes to check.

type: number

name: start

desc: What index to start checking from.

type: number

name: nonExpanders

desc: An array of how many fixed sized cells there are in either the columns or rows.

type: array

name: expanders

desc: An array of how many expanding cells there are in either the columns or rows.

type: array

return value

desc: The found index.

type: number

__GetExpandedHeight

__GetExpandedHeight(index, height, expanders, nonExpanders)

Calculates the amount of the additional height that the cell should take up.

parameters

name: index

desc: What index of the positions in the grid that the height is wanted for.

type: number

name: height

desc: The unclaimed height of the grid, that is the height of the grid or subgrid left after removing the height of the fixed cells.

type: number

name: expanders

desc: An array of the sum of vertical expansion weights for each row.

type: associative array

name: nonExpanders

desc: An array of the amount of fixed size cells in each row.

type: associative array

return value

desc: The calculated height.

type: number

__GetExpandedHeights

__GetExpandedHeights(index, height, expanders, nonExpanders)

Calculates the heights that the cell wants to have in each of rows that it spans over.

parameters

name: index

desc: What index of the positions in the grid that the height is wanted for.

type: number

name: height

desc: The unclaimed height of the grid, that is the height of the grid or subgrid left after removing the height of the fixed cells.

type: number

name: expanders

desc: An array of the sum of vertical expansion weights for each row.

type: associative array

name: nonExpanders

desc: An array of the amount of fixed size cells in each row.

type: associative array

return value

desc: The wanted height of the cell in each row.

type: array

__GetExpandedWidth

__GetExpandedWidth(index, width, expanders, nonExpanders)

Calculates the amount of the additional width that the cell should take up.

parameters

name: index

desc: What index of the positions in the grid that the width is wanted for.

type: number

name: width

desc: The unclaimed width of the grid, that is the width of the GUI or subgrid left after removing the width of the fixed cells.

type: number

name: expanders

desc: An array of the sum of horizontal expansion weights for each column.

type: array

name: nonExpanders

desc: An array of the amount of fixed size cells in each column.

type: array

return value

desc: The calculated width.

type: number

__GetExpandedWidths

__GetExpandedWidths(index, width, expanders, nonExpanders)

Calculates the widths that the cell wants to have in each of columns that it spans over.

parameters

name: index

desc: What index of the positions in the grid that the width is wanted for.

type: number

name: width

desc: The unclaimed width of the grid, that is the width of the GUI or subgrid left after removing the width of the fixed cells.

type: number

name: expanders

desc: An array of the sum of horizontal expansion weights for each column.

type: array

name: nonExpanders

desc: An array of the amount of fixed size cells in each column.

type: array

return value

desc: The wanted width of the cell in each column.

type: array

__GetFixedHeight

__GetFixedHeight()

Returns the fixed height of the cell.

return value

desc: The fixed height of the cell. For non vertically expanding and non vertically filling cells the min-height of the GridGUI.Cell.ctrl plus 2 times the vertical margin is returned. For vertically expanding and or vertically filling cells 0 is returned unless an min-height where specified in which case the min-height of the GridGUI.Cell.ctrl plus 2 time the vertical margin is returned unless the min-height is 0 then 0 is returned.

type: number

__GetFixedWidth

__GetFixedWidth()

Returns the fixed width of the cell.

return value

desc: The fixed width of the cell. For non horizontally expanding and non horizontally filling cells the min-width of the GridGUI.Cell.ctrl plus 2 times the horizontal margin is returned. For horizontally expanding and or horizontally filling cells 0 is returned unless an min-width where specified in which case the min-width of the GridGUI.Cell.ctrl plus 2 time the vertical margin is returned unless the min-width is 0 then 0 is returned.

type: number

__GetNeededHeight

__GetNeededHeight()

Returns the needed height of the cell.

return value

desc: The needed height of the cell. That is the min-height of the GridGUI.Cell.ctrl plus two times the vertical margin.

type: number

__GetNeededWidth

__GetNeededWidth()

Returns the needed width of the cell.

return value

desc: The needed width of the cell. That is the min-width of the GridGUI.Cell.ctrl plus two times the horizontal margin.

type: number

__New

__New(pos, ctrl, exW := 0, exH := 0, fillW := false, fillH := false, justify := C, borderX := 5, borderY := 5, aspectRatio := )

Constructor.

parameters

name: pos

desc: The position and size of the cell in the grid in columns and rows. That is in the same coordinate system that is used when adding cells to a GridGUI.GridGUIClass.

type: GridGUI.Position

name: ctrl

desc: The control that will be managed by this cell. The control class needs to implement the two methods ControlGetPos and Draw as well as have the four members initialWidth, initialHeight, initialWidthVal and initialHeightVal.

type: GridGUI.Control

name: exW

desc: The horizontal expansion weight of the cell. This is used to calculate the part of the additional GUI width that this cell should take.

type: number

default: 0

name: exH

desc: The vertical expansion weight of the cell. This is used to calculate the part of the additional GUI height that this cell should take.

type: number

default: 0

name: fillW

desc: Whether or not to set the width of the GridGUI.Cell.ctrl to the width of the cell.

type: bool

default: false

name: fillH

desc: Whether or not to set the height of the GridGUI.Cell.ctrl to the height of the cell.

type: bool

default: false

name: justify

desc: How the GridGUI.Cell.ctrl will be positioned in the cell when drawn. Can be any combination of C (Center), N (North), S (South), W (West) and E (East).

type: string

default: C

name: borderX

desc: The horizontal border or margin of the cell that is the amount of additional width beyond what the control needs that is taken up by the cell.

type: number

default: 5

name: borderY

desc: The vertical border or margin of the cell that is the amount of additional height beyond what the control needs that is taken up by the cell.

type: number

default: 5

name: aspectRatio

desc: The aspect ratio of the cell in width divided by height. An aspect ratio of 0 means that aspectRatio wont be applied to the cell.

type: number

default:

return value

desc: A new GridGUI.Cell instance.

type: GridGUI.Cell

__Sum

__Sum(obj, start, end)

Calculates a partial sum of values in an array from a start index to an end index.

parameters

name: obj

desc: The array to calculate the sum of.

type: array

name: start

desc: The start index of the range to sum.

type: number

name: end

desc: The end index of the range to sum.

type: number

return value

desc: The sum of the sub-array.

type: number

CalculateCtrlSize

CalculateCtrlSize(pos)

Calculates the size the GridGUI.Cell.ctrl should use given a specific cell size.

parameters

name: pos

desc: The size to fit the GridGUI.Cell.ctrl within.

type: GridGUI.Position

return value

desc: An area sized according to the cell members to fit within pos.

type: GridGUI.Position

Center

Center(area, pos)

Centres one area in another.

parameters

name: area

desc: The area that should be centred in relation to.

type: GridGUI.Position

name: pos

desc: The area to centre.

type: GridGUI.Position

return value

desc: A copy of pos centred in area.

type: GridGUI.Position

DestroyCtrl

DestroyCtrl()

Destroys the GridGUI.Cell.ctrl.

GetExpandedHeight

GetExpandedHeight(index, height, expandersH, nonExpandersH, width, expandersW, nonExpandersW)

Calculates the amount of the additional height that the cell should take up and applies the aspect ratio of GridGUI.Cell.aspectRatio if non zero.

parameters

name: index

desc: What index of the positions in the grid that the height is wanted for.

type: number

name: height

desc: The unclaimed height of the grid, that is the height of the grid or subgrid left after removing the height of the fixed cells.

type: number

name: expandersH

desc: An array of the sum of vertical expansion weights for each row.

type: associative array

name: nonExpandersH

desc: An array of the amount of fixed size cells in each row.

type: associative array

name: width

desc: The unclaimed width of the grid, that is the width of the GUI or subgrid left after removing the width of the fixed cells.

type: number

name: expandersW

desc: An array of the sum of horizontal expansion weights for each column.

type: array

name: nonExpandersW

desc: An array of the amount of fixed size cells in each column.

type: array

return value

desc: The calculated height.

type: number

GetExpandedWidth

GetExpandedWidth(index, width, expandersW, nonExpandersW, height, expandersH, nonExpandersH)

Calculates the amount of the additional width that the cell should take up and applies the aspect ratio of GridGUI.Cell.aspectRatio if non zero.

parameters

name: index

desc: What index of the positions in the grid that the width is wanted for.

type: number

name: width

desc: The unclaimed width of the grid, that is the width of the GUI or subgrid left after removing the width of the fixed cells.

type: number

name: expandersW

desc: An array of the sum of horizontal expansion weights for each column.

type: array

name: nonExpandersW

desc: An array of the amount of fixed size cells in each column.

type: array

name: height

desc: The unclaimed height of the grid, that is the height of the grid or subgrid left after removing the height of the fixed cells.

type: number

name: expandersH

desc: An array of the sum of vertical expansion weights for each row.

type: associative array

name: nonExpandersH

desc: An array of the amount of fixed size cells in each row.

type: associative array

return value

desc: The calculated width.

type: number

GetExpansionHeightValue

GetExpansionHeightValue()

Getter for GridGUI.Cell.exH.

return value

desc: The vertical expansion weight.

type: number

GetExpansionWidthValue

GetExpansionWidthValue()

Getter for GridGUI.Cell.exW.

return value

desc: The horizontal expansion weight.

type: number

GetFixedHeight

GetFixedHeight()

Returns the fixed height of the cell and applies the aspect ratio of GridGUI.Cell.aspectRatio if non zero.

return value

desc: The fixed height of the cell. For non vertically expanding and non vertically filling cells the min-height of the GridGUI.Cell.ctrl plus 2 times the vertical margin is returned. For vertically expanding and or vertically filling cells 0 is returned unless an min-height where specified in which case the min-height of the GridGUI.Cell.ctrl plus 2 time the vertical margin is returned unless the min-height is 0 then 0 is returned.

type: number

GetFixedWidth

GetFixedWidth()

Returns the fixed width of the cell and applies the aspect ratio of GridGUI.Cell.aspectRatio if non zero.

return value

desc: The fixed width of the cell. For non horizontally expanding and non horizontally filling cells the min-width of the GridGUI.Cell.ctrl plus 2 times the horizontal margin is returned. For horizontally expanding and or horizontally filling cells 0 is returned unless an min-width where specified in which case the min-width of the GridGUI.Cell.ctrl plus 2 time the vertical margin is returned unless the min-width is 0 then 0 is returned.

type: number

GetNeededHeight

GetNeededHeight()

Returns the needed height of the cell and applies the aspect ratio of GridGUI.Cell.aspectRatio if non zero.

return value

desc: The needed height of the cell. That is the min-height of the GridGUI.Cell.ctrl plus two times the vertical margin.

type: number

GetNeededWidth

GetNeededWidth()

Returns the needed width of the cell and applies the aspect ratio of GridGUI.Cell.aspectRatio if non zero.

return value

desc: The needed width of the cell. That is the min-width of the GridGUI.Cell.ctrl plus two times the horizontal margin.

type: number

Justify

Justify(area, pos)

Justifies an area within another area. That is places the area according to a set of rules within the larger area.

parameters

name: area

desc: The area to position the other area within.

type: GridGUI.Position

name: pos

desc: The area to position in the larger area.

type: GridGUI.Position

return value

desc: A copy of pos that is justified within area.

type: GridGUI.Position

SetArea

SetArea(offset, widths, heights)

Sets the position and size of the cell.

parameters

name: offset

desc: The coordinate offset that the cell should be translated by. Used to support GridGUI.SubGrids within a GUI, since the calculated positions are relative to the client area.

type: GridGUI.Position

name: widths

desc: An array of the calculate width for each column.

type: array

name: heights

desc: An array of the calculate height for each row.

type: array

SetAspectRatio

SetAspectRatio(ratio := "")

Sets the aspect ratio of the cell.

parameters

name: ratio

desc: The ratio to set for the cell in width divided by height. An empty ratio will set the ratio to the current width of the cell divided by the current height of the cell.

type: number|""

default: ""

ToolTip

ToolTip()

Shows a tooltip of the cell as a string.

ToStr

ToStr(indent := "")

Converts the object to a string.

parameters

name: indent

desc: The amount of indentation to add on each line.

type: string

default: ""

return value

desc: A string representing this cell.

type: string

Update

Update()

Updates the position of the GridGUI.Cell.ctrl and draws it.

Back to top