Alf::AlfLayoutManager Class Reference

class Alf::AlfLayoutManager : public Alf::IAlfLayoutManager

The interface for layout managers

Layout manager handles the layouting of child widgets in the container widget. It uses IAlfLayoutPreferences-interface (IAlfLayoutPreferences) of child widgets as a guide for laying out the widgets. The layoutmanager is set to the IAlfHostApi- interface (IAlfHostApi::setBaseLayout) createLayout-method should be the first call after creating the layoutmanager.Layout manager may also provide information about the layout preferences of its children. If this is supported the layout manager will combine the layout preferences of its children taking into consideration the technique used to lay out the children using the layout manager. This will provide information about the whole display area occupied by the layout manager. For instance vertical flow layout manager will provide preferred size area of its children by summing their heights and providing the maximum width among the children.

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

 // See if layout preferences is supported in the given layout manager.
 IAlfLayoutPreferences* layoutPreferences = IAlfInterfaceBase::makeInterface<IAlfLayoutPreferences>(layoutManager);

 if(layoutPreferences != 0)
     {
     TAlfXYMetric preferredSize;
     // This will report the preferred size of the layout by combining together preferred sizes of its children.
     bool result = layoutPreferences->getPreferredSize(preferredSize);
     }
alfwidgetmodel.lib
Since
S60 ?S60_version Draft IAlfLayoutManager, IAlfLayoutPreferences

Inherits from

Constructor & Destructor Documentation

AlfLayoutManager(TAlfLayoutType)

OSN_IMPORTAlfLayoutManager(TAlfLayoutTypeaLayoutType)

layout manager constructor

Parameters

TAlfLayoutType aLayoutTypetype of layout used by this manager.

~AlfLayoutManager()

OSN_IMPORT~AlfLayoutManager()[virtual]

virtual destructor

Member Functions Documentation

childRemoved(CAlfWidgetControl *)

OSN_IMPORT voidchildRemoved(CAlfWidgetControl *aControl)[virtual]

from IAlfLayoutManager Notifies the layout manager, that the control's has been removed from the layout.

Exceptions
osncore::AlfVisualException

Thrown with error code osncore::EInvalidVisual if layout is not created.

Parameters

CAlfWidgetControl * aControlcontrol, which has been removed from the layout.

controlRect(CAlfWidgetControl &, TAlfRealRect &)

OSN_IMPORT boolcontrolRect(CAlfWidgetControl &aControl,
TAlfRealRect &aRect
)[protected]

returns the rect of the control.

Parameters

CAlfWidgetControl & aControl
TAlfRealRect & aRectwill receive the rect of aControl, if return value is true.

count()

OSN_IMPORT intcount()const

returns the count of controls inside layoutmanager.

createLayout(CAlfWidgetControl &, CAlfLayout *, int)

OSN_IMPORT voidcreateLayout(CAlfWidgetControl &aOwner,
CAlfLayout *aParentLayout,
intaLayoutIndex
)[virtual]

creates the layout used by this layoutmanager.

Exceptions
osncore::AlfVisualException

Thrown with error code osncore::EInvalidVisual if aLayoutIndex is out of bounds.

osncore::AlfVisualException

Thrown with error code osncore::ECanNotCreateVisual if the layout creation failed.

Parameters

CAlfWidgetControl & aOwner
CAlfLayout * aParentLayoutparent for the created layout
int aLayoutIndexindex, where created visual should be placed in the parent layout.

doUpdateChildLayout(CAlfWidgetControl *)

OSN_IMPORT voiddoUpdateChildLayout(CAlfWidgetControl *aControl)[protected, virtual]

Notifies the layout manager, that the child control's layout must be updated. Called in updateChildLayout for the updated control and in updateChildrenLayout for all the controls in the layout.

Parameters

CAlfWidgetControl * aControlcontrol, which size has changed.

getControl(int)

OSN_IMPORT CAlfWidgetControl *getControl(intaIndex)const

returns the control at aIndex.

Parameters

int aIndexindex for the control.

getLayout()

OSN_IMPORT CAlfLayout &getLayout()const [virtual]

from IAlfLayoutManager Returns the layout used by this layoutmanager.

Exceptions
osncore::AlfVisualException

Thrown with error code osncore::EInvalidVisual if layout is not created.

getLayoutPreferences(CAlfWidgetControl *)

OSN_IMPORT const IAlfLayoutPreferences *getLayoutPreferences(CAlfWidgetControl *aControl)const [protected]

returns layout preferences for aControl

Parameters

CAlfWidgetControl * aControl

makeInterface(const IfId &)

OSN_IMPORT IAlfInterfaceBase *makeInterface(const IfId &aType)[virtual]
Interface getter. IAlfInterfaceBase::MakeInterface
Since
S60 ?S60_version

Parameters

const IfId & aTypeThe type id of the queried interface.

owner()

OSN_IMPORT CAlfWidgetControl &owner()const

setControlPosition(CAlfWidgetControl &, const TAlfRealPoint &)

OSN_IMPORT voidsetControlPosition(CAlfWidgetControl &aControl,
const TAlfRealPoint &aPos
)[protected]

sets the position to the control

Parameters

CAlfWidgetControl & aControl
const TAlfRealPoint & aPos

setControlRect(CAlfWidgetControl &, const TAlfRealRect &)

OSN_IMPORT voidsetControlRect(CAlfWidgetControl &aControl,
const TAlfRealRect &aRect
)[protected]

sets the size and position to the control

Parameters

CAlfWidgetControl & aControl
const TAlfRealRect & aRect

setControlSize(CAlfWidgetControl &, const TAlfRealPoint &)

OSN_IMPORT voidsetControlSize(CAlfWidgetControl &aControl,
const TAlfRealPoint &aSize
)[protected]

sets the size to control

Parameters

CAlfWidgetControl & aControl
const TAlfRealPoint & aSize

updateChildLayout(CAlfWidgetControl *)

OSN_IMPORT voidupdateChildLayout(CAlfWidgetControl *aControl)[virtual]

from IAlfLayoutManager Notifies the layout manager, that the child control's layout must be updated

Exceptions
osncore::AlfVisualException

Thrown with error code osncore::EInvalidVisual if layout is not created.

Parameters

CAlfWidgetControl * aControlcontrol, which size has changed.

updateChildrenLayout()

OSN_IMPORT voidupdateChildrenLayout()[virtual]
from IAlfLayoutManager Notifies the layout manager, that all the child control's layouts must be updated.
Exceptions
osncore::AlfVisualException

Thrown with error code osncore::EInvalidVisual if layout is not created.

Member Data Documentation

auto_ptr< AlfLayoutManagerImpl > mData

auto_ptr< AlfLayoutManagerImpl >mData[private]