CAlfGridLayout Class Reference

class CAlfGridLayout : public CAlfLayout

Grid layout class.

To use this class, a grid layout is created of a desired width and height. Then, when visuals are added to grid layout, they will populate the grid. By default, all slots in a grid layout are of a uniform size, but the weighting of individual rows and columns can be modified, and can be specified using metric units. Slots will resize automatically as the grid layout size changes.

The standard application grid is one example of a grid layout.

Usage:

 // Create a new 3x4 grid layout visual.
 CAlfGridLayout* grid = CAlfGridLayout::AddNewL( control, 3, 4 );
 
 // Add a single text visual into the grid.
 CAlfTextVisual* text = CAlfTextVisual::AddNewL( control, grid );
 
 // Make the text visual visible; if no text is specified, nothing is drawn.
 text->SetTextL(_L("T"));
 
 //Setting grid dimentions with weight
 RArry<TInt> col;
 col.AppendL( 1 );
 col.AppendL( 2 );
 
 //sets no of columns to 2 and width of second column
 //is double of that of first
 grid->SetColumns( col );
alfclient.lib
Since
S60 v3.2

Nested Classes and Structures

Public Member Functions
CAlfGridLayout()
~CAlfGridLayout()
IMPORT_C CAlfGridLayout *AddNewL(CAlfControl &, TInt, TInt, CAlfLayout *)
IMPORT_C voidAppendWeightL(TAlfGridDimension, const TAlfMetric &)
IMPORT_C TAlfXYMetricBaseUnit()
IMPORT_C voidClearLayoutModeFlags(TAlfGridDimension, TUint)
IMPORT_C TIntColumnCount()
IMPORT_C voidConstructL(CAlfControl &)
IMPORT_C TIntDimensionCount(TAlfGridDimension)
IMPORT_C voidFillWeightsL(TAlfGridDimension, TInt, const TAlfMetric &)
IMPORT_C CAlfVisual *FindTag(const TDesC8 &)
IMPORT_C voidInsertWeightL(TAlfGridDimension, const TAlfMetric &, TInt)
IMPORT_C TIntLayoutModeFlags(TAlfGridDimension)
IMPORT_C TPointOrdinalToBlock(TInt)
IMPORT_C voidRemoveAndDestroyAllD()
IMPORT_C voidRemoveWeightL(TAlfGridDimension, TInt)
IMPORT_C voidReplaceWeightL(TAlfGridDimension, const TAlfMetric &, TInt)
IMPORT_C TIntRowCount()
voidSetColumns(TInt)
voidSetColumns(const RArray< TInt > &)
IMPORT_C voidSetColumnsL(TInt)
IMPORT_C voidSetColumnsL(const RArray< TInt > &)
IMPORT_C voidSetExpanding(TInt)
IMPORT_C voidSetLayoutModeFlags(TAlfGridDimension, TUint)
voidSetRows(TInt)
voidSetRows(const RArray< TInt > &)
IMPORT_C voidSetRowsL(TInt)
IMPORT_C voidSetRowsL(const RArray< TInt > &)
IMPORT_C voidUpdateChildrenLayout(TInt)
IMPORT_C TAlfMetricWeight(TAlfGridDimension, TInt)
Protected Member Functions
IMPORT_C voidDoRemoveAndDestroyAllD()
IMPORT_C voidPropertyOwnerExtension(const TUid &, TAny **)
Inherited Functions
CAlfLayout::AddNewL(CAlfControl &,CAlfLayout *)
CAlfLayout::Append(CAlfVisual *,TBool,TInt)
CAlfLayout::CAlfLayout()
CAlfLayout::ChildOrdinal(TInt)
CAlfLayout::ChildPos(TInt,TPoint &)
CAlfLayout::ChildSize(TInt,TSize &)
CAlfLayout::Count()const
CAlfLayout::EffectiveLayoutOrdinal(const CAlfVisual &)const
CAlfLayout::EnableScrollingL(TBool)
CAlfLayout::FindVisual(CAlfVisual *)const
CAlfLayout::HorizontalInnerPadding()const
CAlfLayout::InnerPadding()const
CAlfLayout::InnerPaddingAsMetric()const
CAlfLayout::InnerPaddingInBaseUnits()const
CAlfLayout::Insert(CAlfVisual *,TInt)
CAlfLayout::MoveVisualToBack(CAlfVisual &,TInt)
CAlfLayout::MoveVisualToFront(CAlfVisual &,TInt)
CAlfLayout::Remove(CAlfVisual *,TInt)
CAlfLayout::Reorder(CAlfVisual &,TInt,TInt)
CAlfLayout::ScrollOffset()const
CAlfLayout::Scrolling()const
CAlfLayout::SetBaseUnit(const TAlfMetric &)
CAlfLayout::SetBaseUnit(const TAlfXYMetric &)
CAlfLayout::SetInnerPadding(const TAlfXYMetric &)
CAlfLayout::SetInnerPadding(const TPoint &)
CAlfLayout::SetScrollOffset(const TAlfTimedPoint &)
CAlfLayout::SetTransitionTime(TInt)
CAlfLayout::TransitionTime()const
CAlfLayout::VerticalInnerPadding()const
CAlfLayout::VirtualSize()const
CAlfLayout::Visual(TInt)const
CAlfLayout::~CAlfLayout()
CAlfPropertyOwner::CAlfPropertyOwner()
CAlfPropertyOwner::CopyProperty(const CAlfPropertyOwner &,const TDesC8 &)
CAlfPropertyOwner::PropertyClear()
CAlfPropertyOwner::PropertyFindInteger(const TDesC8 &,TInt *)const
CAlfPropertyOwner::PropertyFindString(const TDesC8 &,TDesC **)const
CAlfPropertyOwner::PropertyRemove(const TDesC8 &)
CAlfPropertyOwner::PropertySetIntegerL(const TDesC8 &,TInt,TInt,TInt)
CAlfPropertyOwner::PropertySetStringL(const TDesC8 &,const TDesC &)
CAlfPropertyOwner::~CAlfPropertyOwner()
CAlfVisual::AlignByOrigin(TAlfRealRect &)const
CAlfVisual::Brushes()
CAlfVisual::CAlfVisual()
CAlfVisual::ClearFlag(TAlfVisualFlags)
CAlfVisual::ClearFlags(TUint)
CAlfVisual::Clipping()const
CAlfVisual::Comms()const
CAlfVisual::ConstructL(CAlfControl &,TInt,TInt,const TDesC8 &)
CAlfVisual::CopyValues(const CAlfVisual &,TInt,TInt)
CAlfVisual::DepthOffset()const
CAlfVisual::Display()const
CAlfVisual::DisplayRect()const
CAlfVisual::DisplayRectTarget()const
CAlfVisual::DisplayToLocal(const TAlfRealPoint &)const
CAlfVisual::DisplayToLocal(const TPoint &)const
CAlfVisual::DropShadowHandler()const
CAlfVisual::EffectiveOpacity()const
CAlfVisual::EnableBrushesL(TBool)
CAlfVisual::EnableDropShadowL(TBool)
CAlfVisual::EnableTransformationL(TBool)
CAlfVisual::Env()const
CAlfVisual::Flags()const
CAlfVisual::HasTactileFeedback(TInt)const
CAlfVisual::HorizontalOrigin()const
CAlfVisual::HorizontalPadding()const
CAlfVisual::Identifier()const
CAlfVisual::IsTagged()const
CAlfVisual::Layout()const
CAlfVisual::LocalToDisplay(const TAlfRealPoint &)const
CAlfVisual::LocalToDisplay(const TPoint &)const
CAlfVisual::MaxSize()const
CAlfVisual::MaxSizeInBaseUnits()const
CAlfVisual::Mimic(CAlfVisual &,TInt)
CAlfVisual::MinSize()const
CAlfVisual::MinSizeInBaseUnits()const
CAlfVisual::Move(const TAlfRealPoint &,TInt)
CAlfVisual::Move(const TPoint &,TInt)
CAlfVisual::MoveToFront(TInt)
CAlfVisual::Opacity()const
CAlfVisual::Owner()const
CAlfVisual::Padding()const
CAlfVisual::PaddingAsMetric()const
CAlfVisual::PaddingInPixels()const
CAlfVisual::Pause(TInt)
CAlfVisual::Pos()const
CAlfVisual::RemoveTactileFeedback(TInt)
CAlfVisual::Resume(TInt)
CAlfVisual::SetCenteredPosAndSize(const TAlfRealPoint &,const TAlfRealSize &,TInt)
CAlfVisual::SetCenteredPosAndSize(const TPoint &,const TSize &,TInt)
CAlfVisual::SetClipping(TBool)
CAlfVisual::SetDepthOffset(const TAlfTimedValue &)
CAlfVisual::SetDisplay(CAlfDisplay *)
CAlfVisual::SetEffectL(const TDesC &)
CAlfVisual::SetFlag(TAlfVisualFlags)
CAlfVisual::SetFlags(TUint)
CAlfVisual::SetGroupEffectL(const TDesC &,TInt)
CAlfVisual::SetLayout(CAlfLayout *)
CAlfVisual::SetMaxSize(const TAlfRealSize &)
CAlfVisual::SetMaxSize(const TSize &)
CAlfVisual::SetMinSize(const TAlfRealSize &)
CAlfVisual::SetMinSize(const TSize &)
CAlfVisual::SetOpacity(const TAlfTimedValue &)
CAlfVisual::SetOrigin(TAlfVisualHOrigin,TAlfVisualVOrigin)
CAlfVisual::SetOwner(CAlfControl &)
CAlfVisual::SetPadding(TInt)
CAlfVisual::SetPadding(const TAlfBoxMetric &)
CAlfVisual::SetPadding(const TPoint &)
CAlfVisual::SetPos(const TAlfRealPoint &,TInt)
CAlfVisual::SetPos(const TAlfTimedPoint &)
CAlfVisual::SetRect(const TAlfRealRect &,TInt)
CAlfVisual::SetSize(const TAlfRealSize &,TInt)
CAlfVisual::SetSize(const TAlfTimedPoint &)
CAlfVisual::SetTactileFeedbackL(TInt,TInt)
CAlfVisual::SetTagL(const TDesC8 &)
CAlfVisual::Size()const
CAlfVisual::Tag()const
CAlfVisual::TagMatches(const TDesC8 &)const
CAlfVisual::Transformation()
CAlfVisual::VerticalOrigin()const
CAlfVisual::VerticalPadding()const
CAlfVisual::~CAlfVisual()
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Inherited Enumerations
CAlfLayout:TExpansionFlags
Private Attributes
TGridLayoutPrivateData *iGridLayoutData

Constructor & Destructor Documentation

CAlfGridLayout()

IMPORT_CCAlfGridLayout()

Constructor.

~CAlfGridLayout()

IMPORT_C~CAlfGridLayout()

Virtual destructor.

Member Functions Documentation

AddNewL(CAlfControl &, TInt, TInt, CAlfLayout *)

IMPORT_C CAlfGridLayout *AddNewL(CAlfControl &aOwnerControl,
TIntaColumns,
TIntaRows,
CAlfLayout *aParentLayout = 0
)[static]

Construct a new grid layout and give its ownership to a control.

Note:

the columns and rows will be initialized with equal unit weights, so that blocks will all share even proportions of the available area to start with.

in order to use a mixture of metric weights, or to set different weights, set rows and columns to zero when calling this method, then use e.g. AppendWeightL to subsequently populate the weights.

Parameters

CAlfControl & aOwnerControlOwner control.
TInt aColumnsNumber of columns in the grid.
TInt aRowsNumber of rows in the grid.
CAlfLayout * aParentLayout = 0Parent layout for the new grid layout.

AppendWeightL(TAlfGridDimension, const TAlfMetric &)

IMPORT_C voidAppendWeightL(TAlfGridDimensionaDim,
const TAlfMetric &aWeight
)

Add a new line of blocks to this grid layout at the last position in the direction of the specified dimension. It will have the supplied weight. Weights can be any metric value, hence different units can be used for each block. In particular, EAlfUnitWeight can be used to represent weight values in aribtrary proportional units.

In the case of proportional weights, the effect of this will be to cause the other blocks to resize according to the new total weight.

Since
S60 3.2
Note:

If non-relative coordinates are specified (e.g., real pixels), the combined blocks might not fill the entire layout area. However, weights will always stretch to fill all available space after the fixed units have been determined. Therefore, depending on circumstances it may be better to use EAlfUnitWeight

For example [2 weights, 1 weight, 2 weights] in a layout of 100 pixels would result in [40 pixels, 20 pixels, 40 pixels].

For example [10 pixels, 1 weight, 15 pixels] in a layout of 100 pixels would result in [10 pixels, 75 pixels, 15 pixels].

Parameters

TAlfGridDimension aDimthe dimension to which the weight corresponds
const TAlfMetric & aWeightthe weight to be used for the block in the specified dimension, replacing any previously existing weight for that block

BaseUnit()

IMPORT_C TAlfXYMetricBaseUnit()const [virtual]

ClearLayoutModeFlags(TAlfGridDimension, TUint)

IMPORT_C voidClearLayoutModeFlags(TAlfGridDimensionaDim,
TUintaGridLayoutModeFlags
)

Clears flag(s) which alter the children's pixel error distribution within the grid layout.

TAlfGridLayoutModeFlags, SetLayoutModeFlags

Parameters

TAlfGridDimension aDimthe dimension to which the given flag(s) affect.
TUint aGridLayoutModeFlagsFlags to be cleared

ColumnCount()

IMPORT_C TIntColumnCount()const

Gets amount of columns.

ConstructL(CAlfControl &)

IMPORT_C voidConstructL(CAlfControl &aOwner)[virtual]

From CAlfLayout. Second-phase constructor.

Parameters

CAlfControl & aOwner

DimensionCount(TAlfGridDimension)

IMPORT_C TIntDimensionCount(TAlfGridDimensionaDim)const

Return the number of lines of blocks in this grid, along the specified dimension.

Since
S60 3.2

Parameters

TAlfGridDimension aDimthe dimension along which to count

DoRemoveAndDestroyAllD()

IMPORT_C voidDoRemoveAndDestroyAllD()[protected, virtual]

FillWeightsL(TAlfGridDimension, TInt, const TAlfMetric &)

IMPORT_C voidFillWeightsL(TAlfGridDimensionaDim,
TIntaCount,
const TAlfMetric &aWeight
)

Sets the number and weights of blocks in this grid layout in the direction of the specified dimension. Each block's weight will be set to equal the supplied value, the result of which is that all blocks will be equally spaced, whatever the units.

Since
S60 3.2
AppendWeightL for more information on how weights are used to calculate layout positions.
Note:

This API could be useful if then subsequent calls to ReplaceWeightL are made to change specific values, depending on how many of the values are different.

Calling this with aCount set to 0 will clear all of the existing weights in the direction of the specified dimension.

this is the same as using metrics with unit type EAlfUnitWeight.

Parameters

TAlfGridDimension aDimthe dimension along which to fill
TInt aCountThe number of lines of blocks to fill
const TAlfMetric & aWeightthe weights to be used for all blocks

FindTag(const TDesC8 &)

IMPORT_C CAlfVisual *FindTag(const TDesC8 &aTag)[virtual]

CAlfVisual Finds a visual whose tag descriptor contains a specific tag.

CAlfLayout::FindTag() extends the search into child visuals, covering recursively entire visual hierarchies.

Todo: how should several visuals with matching tag to be handled ??

CAlfVisual::Tag() CAlfVisual::SetTagL() CAlfVisual::IsTagged() CAlfVisual::FindTag()

Parameters

const TDesC8 & aTagTag to look for. If this tag is found as a part of a visual's colon-separated tag descriptor, it is treated as a match and the visual is returned. The tag to look for cannot contain separator characters (:).

InsertWeightL(TAlfGridDimension, const TAlfMetric &, TInt)

IMPORT_C voidInsertWeightL(TAlfGridDimensionaDim,
const TAlfMetric &aWeight,
TIntaPos
)

Add a new line of blocks to this grid layout at the specified position in the direciton of the specified dimension. It will have the supplied weight. In the case of proportional weights, the effect of this will be to cause the other blocks to resize according to the new total weight. It will also mean that many child visuals will now occupy different blocks within the grid according to how the blocks wrap.

Since
S60 3.2
AppendWeightL for more information on how weights are used to calculate layout positions.

Parameters

TAlfGridDimension aDimthe dimension to which the weight corresponds
const TAlfMetric & aWeightthe weight to be used for the block in the specified dimension, replacing any previously existing weight for that block
TInt aPosthe index of the block

LayoutModeFlags(TAlfGridDimension)

IMPORT_C TIntLayoutModeFlags(TAlfGridDimensionaDim)

Return flag(s) which alter the children's pixel error distribution within the grid layout.

Parameters

TAlfGridDimension aDimthe dimension to return the flags for.

OrdinalToBlock(TInt)

IMPORT_C TPointOrdinalToBlock(TIntaOrdinal)const

Calculates the position of a child in the grid. Returns the block position, where block (0, 0) is in the top left corner.

Parameters

TInt aOrdinalOrdinal of a child.

PropertyOwnerExtension(const TUid &, TAny **)

IMPORT_C voidPropertyOwnerExtension(const TUid &aExtensionUid,
TAny **aExtensionParams
)[protected, virtual]

! future proofing

Parameters

const TUid & aExtensionUid
TAny ** aExtensionParams

RemoveAndDestroyAllD()

IMPORT_C voidRemoveAndDestroyAllD()[virtual]

RemoveWeightL(TAlfGridDimension, TInt)

IMPORT_C voidRemoveWeightL(TAlfGridDimensionaDim,
TIntaPos
)

Remove a line of blocks from this grid layout at the specified position in the specified dimension. In the case of proportional weights, the effect of this will be to cause the other blocks to resize according to the new total weight. It will also mean that many child visuals will now occupy different blocks within the grid according to how the blocks wrap.

Since
S60 3.2
AppendWeightL for more information on how weights are used to calculate layout positions.

Parameters

TAlfGridDimension aDimthe dimension to which the weight corresponds
TInt aPosthe index of the cell

ReplaceWeightL(TAlfGridDimension, const TAlfMetric &, TInt)

IMPORT_C voidReplaceWeightL(TAlfGridDimensionaDim,
const TAlfMetric &aWeight,
TIntaPos
)

Sets the weight of a specific line of blocks in this grid layout, in the direction of the supplied dimension. In the case of proportional weights, the effect of this will be to cause the other blocks to resize according to the new total weight.

Since
S60 3.2
AppendWeightL for more information on how weights are used to calculate layout positions.

Parameters

TAlfGridDimension aDimthe dimension to which the weight corresponds
const TAlfMetric & aWeightthe weight to be used for the block in the specified dimension, replacing any previously existing weight for that cell
TInt aPosthe index of the cell

RowCount()

IMPORT_C TIntRowCount()const

Gets amount of rows.

SetColumns(TInt)

voidSetColumns(TIntaColumnCount)[inline]

! Deprecated, use leaving method instead

Parameters

TInt aColumnCount

SetColumns(const RArray< TInt > &)

voidSetColumns(const RArray< TInt > &aWeights)[inline]

! Deprecated, use leaving method instead

Parameters

const RArray< TInt > & aWeights

SetColumnsL(TInt)

IMPORT_C voidSetColumnsL(TIntaColumnCount)

Sets amount of columns.

Parameters

TInt aColumnCountAmount of columns.

SetColumnsL(const RArray< TInt > &)

IMPORT_C voidSetColumnsL(const RArray< TInt > &aWeights)

Sets the number and weights of columns in this grid layout. The caller specifies an array of relative weights to use for each column. Weights can be any integer, ie a column of weight 30 would be twice the width of a column of weight 15.

Note:

this is equivalent to using metrics with unit type EAlfUnitWeight.

Parameters

const RArray< TInt > & aWeightsAn array containing weights for each column.

SetExpanding(TInt)

IMPORT_C voidSetExpanding(TIntaFlags)

Sets flags to control expanding behaviour.

Parameters

TInt aFlagsFlags

SetLayoutModeFlags(TAlfGridDimension, TUint)

IMPORT_C voidSetLayoutModeFlags(TAlfGridDimensionaDim,
TUintaGridLayoutModeFlags
)

Sets flag(s) which alter the children's pixel error distribution within the grid layout.

This method allows the client to force all items in the grid layout to be the same pixel size. The floating point error that this introduces is distributed between the various paddings of the layout.

Example of use that allows outer paddings to be automatically adjusted:
 iGridLayout->SetLayoutModeFlags(EHuiGridRow, EHuiGridAdjustOuterPadding); 

Note that some flags are mutually exclusive, and will clear some existing flags if set.

TAlfGridLayoutModeFlags, ClearLayoutModeFlags

Parameters

TAlfGridDimension aDimthe dimension to which the given flag(s) affect.
TUint aGridLayoutModeFlagsFlags to be set or cleared

SetRows(TInt)

voidSetRows(TIntaRowCount)[inline]

! Deprecated, use leaving method instead

Parameters

TInt aRowCount

SetRows(const RArray< TInt > &)

voidSetRows(const RArray< TInt > &aWeights)[inline]

! Deprecated, use leaving method instead

Parameters

const RArray< TInt > & aWeights

SetRowsL(TInt)

IMPORT_C voidSetRowsL(TIntaRowCount)

Sets amount of rows.

Parameters

TInt aRowCountAmount of rows.

SetRowsL(const RArray< TInt > &)

IMPORT_C voidSetRowsL(const RArray< TInt > &aWeights)

Sets the number and weights of rows in this grid layout. The caller specifies an array of relative weights to use for each row. Weights can be any integer, ie a row of weight 30 would be twice the height of a row of weight 15.

Note:

this is the same as using metrics with unit type EAlfUnitWeight.

Parameters

const RArray< TInt > & aWeightsAn array containing weights for each row.

UpdateChildrenLayout(TInt)

IMPORT_C voidUpdateChildrenLayout(TIntaTransitionTime = 0)[virtual]

CAlfVisual Update the layout of all children. Subclasses can call this to recalculate the layout of all children.

Parameters

TInt aTransitionTime = 0Time for layout transition in milliseconds. Any negative value uses value given in CAlfEnv::StaticSetLayoutTransitionTime()

Weight(TAlfGridDimension, TInt)

IMPORT_C TAlfMetricWeight(TAlfGridDimensionaDim,
TIntaPos
)const

Returns the weight of a specific line of blocks in this grid layout, in the specified dimension.

Since
S60 3.2
AppendWeightL for more information on how weights are used to calculate layout positions.

Parameters

TAlfGridDimension aDimthe dimension to which the weight corresponds
TInt aPosthe index of the cell

Member Data Documentation

TGridLayoutPrivateData * iGridLayoutData

TGridLayoutPrivateData *iGridLayoutData[private]