A Metric is used to represent a value in a specified unit type. This is to support the definition of Layouts using screen-size independent as well as screen-size dependent measurements.
The metrics are used for different things in different contexts: coordinate base units, anchor offsets, grid column/row weights, paddings, etc. The interpretation of the units used in the metric depends on the context, the type of Layout in which they are used, etc. Usage:
TAlfMetric metricX(1.0, EAlfUnitNormalized);
TAlfMetric metricY(2.0, EAlfUnitNormalized);
//Set Layout base unit using Metrc
layout->SetBaseUnit(metricX);
//Create XYMetric using Metric
TAlfXYMetric metricXY(metricX, metricY);
//Set Layout base unit using XYMetrc
layout->SetBaseUnit( metricXY );
//Create Anchor offset as boxMetric
TAlfBoxMetric offset(
TAlfMetric(0.1, EAlfUnitMySize),
TAlfMetric(-0.1, EAlfUnitMySize),
TAlfMetric(0.1, EAlfUnitMySize),
TAlfMetric(-0.1, EAlfUnitMySize));
TAlfAnchorAttachmentOrigin attachmentOrigin(EAlfAnchorAttachmentOriginNone);
TInt attachmentOrdinal(EAlfAnchorAttachToParent);
//Attach anchor origin
anchorLayout->Attach(ordinal, offset, attachmentOrigin, attachmentOrdinal);