Alf::IAlfGridLayoutPolicy Class Reference

class Alf::IAlfGridLayoutPolicy : public Alf::IAlfInterfaceBase

The interface for grid layout policy

Provides grid specific layout APIs

 // Create layout manager interface.
 IAlfLayoutManager* layoutManager = IAlfInterfaceBase::makeInterface<IAlfLayoutManager>(control);

 // See if layout policy is supported in the given layout manager.
 IAlfGridLayoutPolicy* layoutPolicy = IAlfInterfaceBase::makeInterface<IAlfGridLayoutPolicy>(layoutManager);

 if(layoutPreferences != 0)
     {
     int rows = layoutPolicy->dimensionCount(EAlfGridDimensionRow);
     }
alfwidgetmodel.lib
Since
S60 ?S60_version Draft

Inherits from

Constructor & Destructor Documentation

~IAlfGridLayoutPolicy()

~IAlfGridLayoutPolicy()[inline, virtual]

Member Functions Documentation

appendWeight(gridLayoutDimension, const TAlfMetric &)

voidappendWeight(gridLayoutDimensionaDim,
const TAlfMetric &aWeight
)[pure virtual]

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.

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].

Exceptions
AlfVisualException

Parameters

gridLayoutDimension 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

count(gridLayoutDimension)

intcount(gridLayoutDimensionaDim)const [pure virtual]

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

Parameters

gridLayoutDimension aDimthe dimension along which to count

fillWeights(gridLayoutDimension, int, const TAlfMetric &)

voidfillWeights(gridLayoutDimensionaDim,
intaCount,
const TAlfMetric &aWeight
)[pure virtual]

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.

appendWeight; for more information on how weights are used to calculate layout positions.
Note:

This API could be useful if then subsequent calls to replaceWeight 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.

Exceptions
AlfVisualException

Parameters

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

insertWeight(gridLayoutDimension, const TAlfMetric &, int)

voidinsertWeight(gridLayoutDimensionaDim,
const TAlfMetric &aWeight,
intaPos
)[pure virtual]

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.

Note:

will leave if the specified position is greater than the number of objects currently in the array, so check first by calling preferredDimensionCount

appendWeight for more information on how weights are used to calculate layout positions.
Exceptions
AlfVisualException

Parameters

gridLayoutDimension 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
int aPosthe index of the block

makeInterface(const IfId &)

IAlfInterfaceBase *makeInterface(const IfId &aType)[pure virtual]

Interface getter. IAlfInterfaceBase::MakeInterface

Parameters

const IfId & aTypeThe type id of the queried interface.

removeWeight(gridLayoutDimension, int)

voidremoveWeight(gridLayoutDimensionaDim,
intaPos
)[pure virtual]

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.

appendWeight for more information on how weights are used to calculate layout positions.
Exceptions
AlfVisualException

Parameters

gridLayoutDimension aDimthe dimension to which the weight corresponds
int aPosthe index of the cell

replaceWeight(gridLayoutDimension, const TAlfMetric &, int)

voidreplaceWeight(gridLayoutDimensionaDim,
const TAlfMetric &aWeight,
intaPos
)[pure virtual]

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.

appendWeight for more information on how weights are used to calculate layout positions.
Exceptions
AlfVisualException

Parameters

gridLayoutDimension 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
int aPosthe index of the cell

type()

const IfId &type()[static, inline]

weight(gridLayoutDimension, int)

TAlfMetric weight(gridLayoutDimensionaDim,
intaPos
)const [pure virtual]

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

appendWeight for more information on how weights are used to calculate layout positions.
Exceptions
AlfVisualException

Parameters

gridLayoutDimension aDimthe dimension to which the weight corresponds
int aPosthe index of the cell

Member Enumerations Documentation

Enum gridLayoutDimension

Enumerators

EGridDimensionColumn = 0
EGridDimensionRow