C# Class Habanero.Faces.Base.FlowLayoutManager

Manages the layout of controls in a user interface by adding components in the manner of a horizontal text line that wraps to the next line.
Inheritance: LayoutManager
Show file Open project: Chillisoft/habanero.faces Class Usage Examples

Public Methods

Method Description
AddControl ( IControlHabanero control ) : IControlHabanero

Adds a control to the layout

AddGlue ( ) : void

Adds glue that connects two controls together. For example, if you've just added a label and want to ensure the textbox you're adding next is always next to the label, add glue between adding the label and adding the textbox. In this way, if you resize the control such that the textbox doesn't fit on the line, both the label and the textbox will move to the next line together. This must be called immediatly after adding the label. The next control to be added will be the control the label is glued to.

FlowLayoutManager ( IControlHabanero managedControl, IControlFactory controlFactory ) : System

Constructor to initialise a new manager

NewLine ( ) : void

Inserts a new line. This is like a line break or carriage return for controls. The next control will start at the control's margin (depending on alignment).

RemoveControl ( IControlHabanero controlHabanero ) : IControlHabanero

Removes a control.

Protected Methods

Method Description
RefreshControlPositions ( ) : void

Updates the layout and appearance of the managed controls

Private Methods

Method Description
BothControlsFitOnALine ( int i ) : bool
ControlDoesNotFitOnCurrentRow ( IControlHabanero ctl ) : bool

Informs if the specified control fails to fit on the current row of controls

ControlResizedHandler ( Object sender, EventArgs e ) : void

A handler called when a control has been resized

ControlVisibleChangedHandler ( Object sender, EventArgs e ) : void

A handler called when a control has had its visibility altered

GetControl ( int position ) : IControlHabanero
GetGluedControlToMoveToNewLineIfPossible ( int &controlNumber, IControlHabanero &ctl ) : void
GetPreviousControl ( int currentPos ) : IControlHabanero
InitialiseNewRow ( int i, int &rowStart, IList controlsInRow ) : int
IsControlOnANewLine ( int i, int currentLine ) : bool
IsGluedToAnotherControl ( int pos ) : bool

Checks for glue at a position (a position being a point between two controls. See AddGlue

MoveCurrentPosToStartOfNextRow ( int currentRowHeight ) : void

Moves the current placement position to the beginning of the next row of items

PreviousControlVisible ( int i ) : bool
ResetCurrentPosToTopLeft ( ) : void
SetControlPosition ( IControlHabanero ctl ) : void

Calculates the control's position in the user interface

SetUpTabIndexForAlignmentRight ( int rowStart, IList controlsInRow ) : void
ShiftControlsRightForCentering ( int startControlNum, int endControlNum ) : void

Shift controls right when centred is alignment is used

TopLeftPosition ( ) : Point

Method Details

AddControl() public method

Adds a control to the layout
public AddControl ( IControlHabanero control ) : IControlHabanero
control IControlHabanero The control to add
return IControlHabanero

AddGlue() public method

Adds glue that connects two controls together. For example, if you've just added a label and want to ensure the textbox you're adding next is always next to the label, add glue between adding the label and adding the textbox. In this way, if you resize the control such that the textbox doesn't fit on the line, both the label and the textbox will move to the next line together. This must be called immediatly after adding the label. The next control to be added will be the control the label is glued to.
public AddGlue ( ) : void
return void

FlowLayoutManager() public method

Constructor to initialise a new manager
public FlowLayoutManager ( IControlHabanero managedControl, IControlFactory controlFactory ) : System
managedControl IControlHabanero The control to manage e.g. a Panel
controlFactory IControlFactory The factory which generates controls
return System

NewLine() public method

Inserts a new line. This is like a line break or carriage return for controls. The next control will start at the control's margin (depending on alignment).
public NewLine ( ) : void
return void

RefreshControlPositions() protected method

Updates the layout and appearance of the managed controls
protected RefreshControlPositions ( ) : void
return void

RemoveControl() public method

Removes a control.
public RemoveControl ( IControlHabanero controlHabanero ) : IControlHabanero
controlHabanero IControlHabanero Control to be removed.
return IControlHabanero