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

Public Member Functions
AlfLayoutManager ( TAlfLayoutType )
~AlfLayoutManager ()
OSN_IMPORT void childRemoved ( CAlfWidgetControl *)
OSN_IMPORT int count ()
OSN_IMPORT void createLayout ( CAlfWidgetControl &, CAlfLayout *, int)
OSN_IMPORT CAlfWidgetControl * getControl (int)
OSN_IMPORT CAlfLayout & getLayout ()
OSN_IMPORT IAlfInterfaceBase * makeInterface (const IfId &)
OSN_IMPORT CAlfWidgetControl & owner ()
OSN_IMPORT void updateChildLayout ( CAlfWidgetControl *)
OSN_IMPORT void updateChildrenLayout ()
Protected Member Functions
OSN_IMPORT bool controlRect ( CAlfWidgetControl &, TAlfRealRect &)
OSN_IMPORT void doUpdateChildLayout ( CAlfWidgetControl *)
OSN_IMPORT const IAlfLayoutPreferences * getLayoutPreferences ( CAlfWidgetControl *)
OSN_IMPORT void setControlPosition ( CAlfWidgetControl &, const TAlfRealPoint &)
OSN_IMPORT void setControlRect ( CAlfWidgetControl &, const TAlfRealRect &)
OSN_IMPORT void setControlSize ( CAlfWidgetControl &, const TAlfRealPoint &)
Inherited Functions
Alf::IAlfInterfaceBase::makeInterface(IAlfInterfaceBase *)
Alf::IAlfInterfaceBase::~IAlfInterfaceBase()
Alf::IAlfLayoutManager::type()
Alf::IAlfLayoutManager::~IAlfLayoutManager()
Private Attributes
auto_ptr< AlfLayoutManagerImpl > mData

Constructor & Destructor Documentation

AlfLayoutManager(TAlfLayoutType)

OSN_IMPORT AlfLayoutManager ( TAlfLayoutType aLayoutType )

layout manager constructor

Parameters

TAlfLayoutType aLayoutType type of layout used by this manager.

~AlfLayoutManager()

OSN_IMPORT ~AlfLayoutManager ( ) [virtual]

virtual destructor

Member Functions Documentation

childRemoved(CAlfWidgetControl *)

OSN_IMPORT void childRemoved ( 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 * aControl control, which has been removed from the layout.

controlRect(CAlfWidgetControl &, TAlfRealRect &)

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

returns the rect of the control.

Parameters

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

count()

OSN_IMPORT int count ( ) const

returns the count of controls inside layoutmanager.

createLayout(CAlfWidgetControl &, CAlfLayout *, int)

OSN_IMPORT void createLayout ( CAlfWidgetControl & aOwner,
CAlfLayout * aParentLayout,
int aLayoutIndex
) [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 * aParentLayout parent for the created layout
int aLayoutIndex index, where created visual should be placed in the parent layout.

doUpdateChildLayout(CAlfWidgetControl *)

OSN_IMPORT void doUpdateChildLayout ( 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 * aControl control, which size has changed.

getControl(int)

OSN_IMPORT CAlfWidgetControl * getControl ( int aIndex ) const

returns the control at aIndex.

Parameters

int aIndex index 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 & aType The type id of the queried interface.

owner()

OSN_IMPORT CAlfWidgetControl & owner ( ) const

setControlPosition(CAlfWidgetControl &, const TAlfRealPoint &)

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

sets the position to the control

Parameters

CAlfWidgetControl & aControl
const TAlfRealPoint & aPos

setControlRect(CAlfWidgetControl &, const TAlfRealRect &)

OSN_IMPORT void setControlRect ( 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 void setControlSize ( CAlfWidgetControl & aControl,
const TAlfRealPoint & aSize
) [protected]

sets the size to control

Parameters

CAlfWidgetControl & aControl
const TAlfRealPoint & aSize

updateChildLayout(CAlfWidgetControl *)

OSN_IMPORT void updateChildLayout ( 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 * aControl control, which size has changed.

updateChildrenLayout()

OSN_IMPORT void updateChildrenLayout ( ) [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]