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
Protected Member Functions | |
---|---|
IMPORT_C void | DoRemoveAndDestroyAllD() |
IMPORT_C void | PropertyOwnerExtension(const TUid &, TAny **) |
Inherited Enumerations | |
---|---|
CAlfLayout:TExpansionFlags |
Private Attributes | |
---|---|
TGridLayoutPrivateData * | iGridLayoutData |
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.
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.
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. |
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.
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].
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 |
IMPORT_C void | ClearLayoutModeFlags | ( | TAlfGridDimension | aDim, |
TUint | aGridLayoutModeFlags | |||
) |
Clears flag(s) which alter the children's pixel error distribution within the grid layout.
TAlfGridDimension aDim | the dimension to which the given flag(s) affect. |
TUint aGridLayoutModeFlags | Flags to be cleared |
IMPORT_C void | ConstructL | ( | CAlfControl & | aOwner | ) | [virtual] |
From CAlfLayout. Second-phase constructor.
CAlfControl & aOwner |
IMPORT_C TInt | DimensionCount | ( | TAlfGridDimension | aDim | ) | const |
Return the number of lines of blocks in this grid, along the specified dimension.
TAlfGridDimension aDim | the dimension along which to count |
IMPORT_C void | DoRemoveAndDestroyAllD | ( | ) | [protected, virtual] |
From CAlfVisual CAlfVisual
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.
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.
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 |
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()
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 (:). |
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.
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 |
IMPORT_C TInt | LayoutModeFlags | ( | TAlfGridDimension | aDim | ) |
Return flag(s) which alter the children's pixel error distribution within the grid layout.
TAlfGridDimension aDim | the dimension to return the flags for. |
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.
TInt aOrdinal | Ordinal of a child. |
IMPORT_C void | PropertyOwnerExtension | ( | const TUid & | aExtensionUid, |
TAny ** | aExtensionParams | |||
) | [protected, virtual] |
! future proofing
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.
TAlfGridDimension aDim | the dimension to which the weight corresponds |
TInt aPos | the index of the cell |
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.
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 |
void | SetColumns | ( | TInt | aColumnCount | ) | [inline] |
! Deprecated, use leaving method instead
TInt aColumnCount |
void | SetColumns | ( | const RArray< TInt > & | aWeights | ) | [inline] |
! Deprecated, use leaving method instead
IMPORT_C void | SetColumnsL | ( | TInt | aColumnCount | ) |
Sets amount of columns.
TInt aColumnCount | Amount of columns. |
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.
this is equivalent to using metrics with unit type EAlfUnitWeight.
IMPORT_C void | SetExpanding | ( | TInt | aFlags | ) |
Sets flags to control expanding behaviour.
TInt aFlags | Flags |
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.
iGridLayout->SetLayoutModeFlags(EHuiGridRow, EHuiGridAdjustOuterPadding);
Note that some flags are mutually exclusive, and will clear some existing flags if set.
TAlfGridDimension aDim | the dimension to which the given flag(s) affect. |
TUint aGridLayoutModeFlags | Flags to be set or cleared |
void | SetRows | ( | TInt | aRowCount | ) | [inline] |
! Deprecated, use leaving method instead
TInt aRowCount |
void | SetRows | ( | const RArray< TInt > & | aWeights | ) | [inline] |
! Deprecated, use leaving method instead
IMPORT_C void | SetRowsL | ( | TInt | aRowCount | ) |
Sets amount of rows.
TInt aRowCount | Amount of rows. |
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.
this is the same as using metrics with unit type EAlfUnitWeight.
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.
TInt aTransitionTime = 0 | Time for layout transition in milliseconds. Any negative value uses value given in CAlfEnv::StaticSetLayoutTransitionTime() |
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.
TAlfGridDimension aDim | the dimension to which the weight corresponds |
TInt aPos | the index of the cell |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.