C# Class Habanero.Faces.Base.GridLayoutManager

Manages the layout of controls in a user interface by assigning them to positions in a grid with rows and columns
Inheritance: LayoutManager
Show file Open project: Chillisoft/habanero.faces Class Usage Examples

Private Properties

Property Type Description
CalcColumnWidth int
CalcRowHeight int
GetFixedAmount int
GetFixedHeight int
GetFixedWidth int
GetNumVariableColumns int
GetNumVariableEntries int
GetNumVariableRows int
IsFixedColumn bool
IsFixedRow bool

Public Methods

Method Description
AddControl ( ControlInfo controlInfo ) : IControlHabanero

Adds a control as specified by the ControlInfo provided (which can provide some context for the control) such as number of rows or columns to span.

AddControl ( IControlHabanero control ) : IControlHabanero

Adds a control with a row and column span of 1 to the next position in the grid.

AddControl ( IControlHabanero control, int rowSpan, int columnSpan ) : IControlHabanero

Adds a control to the next position in the grid. The number of rows or columns to span are specified as parameters.

FixAllRowsBasedOnContents ( ) : void

Causes the fixed height of all the rows to be determined by the current or future contents

FixColumn ( int columnNumber, int columnWidth ) : void

Fixes the width of a column to a specified size

FixColumnBasedOnContents ( int columnNumber ) : void

Fixes a specified column's width based on current or future contents

FixRow ( int rowNumber, int rowHeight ) : void

Fixes the height of a row to a specified size

FixRowBasedOnContents ( int rowNumber ) : void

Fixes a specified row's height based on current or future contents

GetFixedColumnWidth ( int columnNumber ) : int

Gets the fixed width set for a specified column. The return value will be -1 if the width has not been fixed.

GetFixedHeightIncludingGaps ( ) : int

Returns the total height of the fixed-height rows added together, including the gaps and borders

GetFixedWidthIncludingGaps ( ) : int

Returns the total width of the fixed-width columns added together, including the gaps and borders

GridLayoutManager ( IControlHabanero managedControl, IControlFactory controlFactory ) : System

Constructor to initialise a new grid layout

SetGridSize ( int rows, int cols ) : void

Sets the grid size as a number of rows and columns

Protected Methods

Method Description
RefreshControlPositions ( ) : void

Updates the positions and settings of the controls in the interface

Private Methods

Method Description
CalcColumnWidth ( ) : int

Calculates the average column width

CalcRowHeight ( ) : int

Calculates the average row height

GetFixedAmount ( int arr ) : int

Adds the values in the array provided, as long as the values are above -1. This method is used to add up fixed-height/width items.

GetFixedHeight ( ) : int

Returns the total height of the fixed-height rows added together

GetFixedWidth ( ) : int

Returns the total width of the fixed-width columns added together

GetNumVariableColumns ( ) : int

Counts the number of columns that have not been assigned a fixed width

GetNumVariableEntries ( int arr ) : int

Counts the number of items in the array provided that have a value of -1. This method is used to count the number of rows or columns that have not been assigned a fixed width/height

GetNumVariableRows ( ) : int

Counts the number of rows that have not been assigned a fixed height

IsFixedColumn ( int columnNumber ) : bool

Indicates whether the specified column has a fixed width

IsFixedRow ( int rowNumber ) : bool

Indicates whether the specified row has a fixed height

Method Details

AddControl() public method

Adds a control as specified by the ControlInfo provided (which can provide some context for the control) such as number of rows or columns to span.
public AddControl ( ControlInfo controlInfo ) : IControlHabanero
controlInfo ControlInfo The information about the control to add to the next position in the grid.
return IControlHabanero

AddControl() public method

Adds a control with a row and column span of 1 to the next position in the grid.
public AddControl ( IControlHabanero control ) : IControlHabanero
control IControlHabanero The control to add
return IControlHabanero

AddControl() public method

Adds a control to the next position in the grid. The number of rows or columns to span are specified as parameters.
public AddControl ( IControlHabanero control, int rowSpan, int columnSpan ) : IControlHabanero
control IControlHabanero The control to add
rowSpan int The row span for the control
columnSpan int The column span for the control
return IControlHabanero

FixAllRowsBasedOnContents() public method

Causes the fixed height of all the rows to be determined by the current or future contents
public FixAllRowsBasedOnContents ( ) : void
return void

FixColumn() public method

Fixes the width of a column to a specified size
public FixColumn ( int columnNumber, int columnWidth ) : void
columnNumber int The column in question
columnWidth int The width to fix the column at
return void

FixColumnBasedOnContents() public method

Fixes a specified column's width based on current or future contents
public FixColumnBasedOnContents ( int columnNumber ) : void
columnNumber int The column in question
return void

FixRow() public method

Fixes the height of a row to a specified size
public FixRow ( int rowNumber, int rowHeight ) : void
rowNumber int The row in question
rowHeight int The height to fix the row at
return void

FixRowBasedOnContents() public method

Fixes a specified row's height based on current or future contents
public FixRowBasedOnContents ( int rowNumber ) : void
rowNumber int The row in question
return void

GetFixedColumnWidth() public method

Gets the fixed width set for a specified column. The return value will be -1 if the width has not been fixed.
public GetFixedColumnWidth ( int columnNumber ) : int
columnNumber int The column in question
return int

GetFixedHeightIncludingGaps() public method

Returns the total height of the fixed-height rows added together, including the gaps and borders
public GetFixedHeightIncludingGaps ( ) : int
return int

GetFixedWidthIncludingGaps() public method

Returns the total width of the fixed-width columns added together, including the gaps and borders
public GetFixedWidthIncludingGaps ( ) : int
return int

GridLayoutManager() public method

Constructor to initialise a new grid layout
public GridLayoutManager ( IControlHabanero managedControl, IControlFactory controlFactory ) : System
managedControl IControlHabanero The control to manage
controlFactory IControlFactory The control factory used to create any controls
return System

RefreshControlPositions() protected method

Updates the positions and settings of the controls in the interface
protected RefreshControlPositions ( ) : void
return void

SetGridSize() public method

Sets the grid size as a number of rows and columns
public SetGridSize ( int rows, int cols ) : void
rows int The number of rows
cols int The number of columns
return void