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 void AppendWeightL ( TAlfGridDimension , const TAlfMetric &)
IMPORT_C TAlfXYMetric BaseUnit ()
IMPORT_C void ClearLayoutModeFlags ( TAlfGridDimension , TUint )
IMPORT_C TInt ColumnCount ()
IMPORT_C void ConstructL ( CAlfControl &)
IMPORT_C TInt DimensionCount ( TAlfGridDimension )
IMPORT_C void FillWeightsL ( TAlfGridDimension , TInt , const TAlfMetric &)
IMPORT_C CAlfVisual * FindTag (const TDesC8 &)
IMPORT_C void InsertWeightL ( TAlfGridDimension , const TAlfMetric &, TInt )
IMPORT_C TInt LayoutModeFlags ( TAlfGridDimension )
IMPORT_C TPoint OrdinalToBlock ( TInt )
IMPORT_C void RemoveAndDestroyAllD ()
IMPORT_C void RemoveWeightL ( TAlfGridDimension , TInt )
IMPORT_C void ReplaceWeightL ( TAlfGridDimension , const TAlfMetric &, TInt )
IMPORT_C TInt RowCount ()
void SetColumns ( TInt )
void SetColumns (const RArray < TInt > &)
IMPORT_C void SetColumnsL ( TInt )
IMPORT_C void SetColumnsL (const RArray < TInt > &)
IMPORT_C void SetExpanding ( TInt )
IMPORT_C void SetLayoutModeFlags ( TAlfGridDimension , TUint )
void SetRows ( TInt )
void SetRows (const RArray < TInt > &)
IMPORT_C void SetRowsL ( TInt )
IMPORT_C void SetRowsL (const RArray < TInt > &)
IMPORT_C void UpdateChildrenLayout ( TInt )
IMPORT_C TAlfMetric Weight ( TAlfGridDimension , TInt )
Protected Member Functions
IMPORT_C void DoRemoveAndDestroyAllD ()
IMPORT_C void PropertyOwnerExtension (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_C CAlfGridLayout ( )

Constructor.

~CAlfGridLayout()

IMPORT_C ~CAlfGridLayout ( )

Virtual destructor.

Member Functions Documentation

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

IMPORT_C CAlfGridLayout * AddNewL ( CAlfControl & aOwnerControl,
TInt aColumns,
TInt aRows,
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 & aOwnerControl Owner control.
TInt aColumns Number of columns in the grid.
TInt aRows Number of rows in the grid.
CAlfLayout * aParentLayout = 0 Parent layout for the new grid layout.

AppendWeightL(TAlfGridDimension, const TAlfMetric &)

IMPORT_C void AppendWeightL ( TAlfGridDimension aDim,
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 aDim the dimension to which the weight corresponds
const TAlfMetric & aWeight the weight to be used for the block in the specified dimension, replacing any previously existing weight for that block

BaseUnit()

IMPORT_C TAlfXYMetric BaseUnit ( ) const [virtual]

ClearLayoutModeFlags(TAlfGridDimension, TUint)

IMPORT_C void ClearLayoutModeFlags ( TAlfGridDimension aDim,
TUint aGridLayoutModeFlags
)

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

TAlfGridLayoutModeFlags , SetLayoutModeFlags

Parameters

TAlfGridDimension aDim the dimension to which the given flag(s) affect.
TUint aGridLayoutModeFlags Flags to be cleared

ColumnCount()

IMPORT_C TInt ColumnCount ( ) const

Gets amount of columns.

ConstructL(CAlfControl &)

IMPORT_C void ConstructL ( CAlfControl & aOwner ) [virtual]

From CAlfLayout . Second-phase constructor.

Parameters

CAlfControl & aOwner

DimensionCount(TAlfGridDimension)

IMPORT_C TInt DimensionCount ( TAlfGridDimension aDim ) const

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

Since
S60 3.2

Parameters

TAlfGridDimension aDim the dimension along which to count

DoRemoveAndDestroyAllD()

IMPORT_C void DoRemoveAndDestroyAllD ( ) [protected, virtual]

FillWeightsL(TAlfGridDimension, TInt, const TAlfMetric &)

IMPORT_C void FillWeightsL ( TAlfGridDimension aDim,
TInt aCount,
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 aDim the dimension along which to fill
TInt aCount The number of lines of blocks to fill
const TAlfMetric & aWeight the 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 & aTag Tag 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 void InsertWeightL ( TAlfGridDimension aDim,
const TAlfMetric & aWeight,
TInt aPos
)

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 aDim the dimension to which the weight corresponds
const TAlfMetric & aWeight the weight to be used for the block in the specified dimension, replacing any previously existing weight for that block
TInt aPos the index of the block

LayoutModeFlags(TAlfGridDimension)

IMPORT_C TInt LayoutModeFlags ( TAlfGridDimension aDim )

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

Parameters

TAlfGridDimension aDim the dimension to return the flags for.

OrdinalToBlock(TInt)

IMPORT_C TPoint OrdinalToBlock ( TInt aOrdinal ) 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 aOrdinal Ordinal of a child.

PropertyOwnerExtension(const TUid &, TAny **)

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

! future proofing

Parameters

const TUid & aExtensionUid
TAny ** aExtensionParams

RemoveAndDestroyAllD()

IMPORT_C void RemoveAndDestroyAllD ( ) [virtual]

RemoveWeightL(TAlfGridDimension, TInt)

IMPORT_C void RemoveWeightL ( TAlfGridDimension aDim,
TInt aPos
)

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 aDim the dimension to which the weight corresponds
TInt aPos the index of the cell

ReplaceWeightL(TAlfGridDimension, const TAlfMetric &, TInt)

IMPORT_C void ReplaceWeightL ( TAlfGridDimension aDim,
const TAlfMetric & aWeight,
TInt aPos
)

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 aDim the dimension to which the weight corresponds
const TAlfMetric & aWeight the weight to be used for the block in the specified dimension, replacing any previously existing weight for that cell
TInt aPos the index of the cell

RowCount()

IMPORT_C TInt RowCount ( ) const

Gets amount of rows.

SetColumns(TInt)

void SetColumns ( TInt aColumnCount ) [inline]

! Deprecated, use leaving method instead

Parameters

TInt aColumnCount

SetColumns(const RArray< TInt > &)

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

! Deprecated, use leaving method instead

Parameters

const RArray < TInt > & aWeights

SetColumnsL(TInt)

IMPORT_C void SetColumnsL ( TInt aColumnCount )

Sets amount of columns.

Parameters

TInt aColumnCount Amount of columns.

SetColumnsL(const RArray< TInt > &)

IMPORT_C void SetColumnsL ( 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 > & aWeights An array containing weights for each column.

SetExpanding(TInt)

IMPORT_C void SetExpanding ( TInt aFlags )

Sets flags to control expanding behaviour.

Parameters

TInt aFlags Flags

SetLayoutModeFlags(TAlfGridDimension, TUint)

IMPORT_C void SetLayoutModeFlags ( TAlfGridDimension aDim,
TUint aGridLayoutModeFlags
)

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 aDim the dimension to which the given flag(s) affect.
TUint aGridLayoutModeFlags Flags to be set or cleared

SetRows(TInt)

void SetRows ( TInt aRowCount ) [inline]

! Deprecated, use leaving method instead

Parameters

TInt aRowCount

SetRows(const RArray< TInt > &)

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

! Deprecated, use leaving method instead

Parameters

const RArray < TInt > & aWeights

SetRowsL(TInt)

IMPORT_C void SetRowsL ( TInt aRowCount )

Sets amount of rows.

Parameters

TInt aRowCount Amount of rows.

SetRowsL(const RArray< TInt > &)

IMPORT_C void SetRowsL ( 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 > & aWeights An array containing weights for each row.

UpdateChildrenLayout(TInt)

IMPORT_C void UpdateChildrenLayout ( TInt aTransitionTime = 0 ) [virtual]

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

Parameters

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

Weight(TAlfGridDimension, TInt)

IMPORT_C TAlfMetric Weight ( TAlfGridDimension aDim,
TInt aPos
) 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 aDim the dimension to which the weight corresponds
TInt aPos the index of the cell

Member Data Documentation

TGridLayoutPrivateData * iGridLayoutData

TGridLayoutPrivateData * iGridLayoutData [private]