Alf::AlfWidget Class Reference

class Alf::AlfWidget : public Alf::IAlfContainerWidget
The base class for widgets. IAlfWidget IAlfContainerWidget IAlfHostApialfwidgetmodel.lib
Since
S60 ?S60_version Draft IAlfWidget,IAlfAttributeOwner,IAlfContainerWidget,IAlfWidgetControl,IAlfHostAPI, All interfaces returned by the elements associated with the widget's control, All interfaces returned by the layout manager associated widget control , All interfaces returned by the model assoiated with the widget.
Public Member Functions
AlfWidget(const char *, IAlfContainerWidget &, CAlfEnv &)
AlfWidget(const char *)
~AlfWidget()
OSN_IMPORT voidaddWidget(IAlfWidget &)
OSN_IMPORT voidapplyLayout(IAlfLayoutManager &)
OSN_IMPORT CAlfWidgetControl *control()
OSN_IMPORT IAlfWidget *getWidget(int)
OSN_IMPORT intgetWidgetIndex(IAlfWidget &)
OSN_IMPORT IAlfInterfaceBase *makeInterface(AlfWidget *, const IfId &)
T *makeInterface(AlfWidget *)
OSN_IMPORT IAlfInterfaceBase *makeInterface(const IfId &)
OSN_IMPORT IAlfModel *model()
OSN_IMPORT IAlfContainerWidget *parent()
voidremoveWidget(int)
OSN_IMPORT voidremoveWidget(IAlfWidget &)
OSN_IMPORT voidsetChildFocus(bool)
OSN_IMPORT voidsetControl(CAlfWidgetControl *, bool)
OSN_IMPORT voidsetModel(IAlfModel *, bool)
OSN_IMPORT voidsetPresentation(const char *)
OSN_IMPORT intwidgetCount()
OSN_IMPORT const char *widgetName()
Protected Member Functions
AlfWidget()
Private Member Functions
voidaddCommonWidgetProperties()
voidremoveReferenceFromControl()
Inherited Functions
Alf::IAlfContainerWidget::type()
Alf::IAlfContainerWidget::~IAlfContainerWidget()
Alf::IAlfInterfaceBase::makeInterface(IAlfInterfaceBase *)
Alf::IAlfInterfaceBase::~IAlfInterfaceBase()
Alf::IAlfWidget::~IAlfWidget()
Private Attributes
auto_ptr< AlfWidgetImpl >mImpl

Constructor & Destructor Documentation

AlfWidget(const char *, IAlfContainerWidget &, CAlfEnv &)

OSN_IMPORTAlfWidget(const char *aWidgetName,
IAlfContainerWidget &aContainer,
CAlfEnv &aEnv
)

Constructor.

This will create a default control to the widget to enable the widget containment hierarchy from the beginning. User can replace the default control with custom control by calling the setControl() - method.
Exceptions
std::bad_alloc

setControl()

Parameters

const char * aWidgetNameThe name of the widget.
IAlfContainerWidget & aContainerContainer widget that will contain this widget.
CAlfEnv & aEnvToolkit environment object that will be used to create the default control.

AlfWidget(const char *)

OSN_IMPORTAlfWidget(const char *aWidgetName)
Constructor to be used only by view widget. All the other widgets should use the other public constructor to ensure widget hierarchy consistency from start.
Exceptions
std::bad_alloc

AlfWidget(const char*, IAlfContainerWidget&, CAlfEnv&)

Parameters

const char * aWidgetNameThe name of the widget.

AlfWidget()

OSN_IMPORTAlfWidget()[protected]

The protected constructor.

Since
S60 ?S60_version

~AlfWidget()

OSN_IMPORT~AlfWidget()[virtual]

Destructor.

It also takes care that all the child widgets contained by this widget are destroyed correctly, provided that they have been instantiated correctly (e.g. through widget factory) and thus added to the ALF environment (CAlfEnv).

In other words, client code does not need to take care of destroying the child widgets contained by a container widget.

Member Functions Documentation

addCommonWidgetProperties()

voidaddCommonWidgetProperties()[private]

Adds the Common Properties for the widget

Since
S60 ?S60_version

addWidget(IAlfWidget &)

OSN_IMPORT voidaddWidget(IAlfWidget &aWidget)[virtual]

Adds a child widget to the container.

Parameters

IAlfWidget & aWidgetChild widget to be added to container. return void

applyLayout(IAlfLayoutManager &)

OSN_IMPORT voidapplyLayout(IAlfLayoutManager &aLayout)[virtual]

Sets the base layout of container widget.

Parameters

IAlfLayoutManager & aLayoutNew base layout of container widget. return void

control()

OSN_IMPORT CAlfWidgetControl *control()const [virtual]

Constructor. The new widget is left on the cleanup stack.

Since
S60 ?S60_version

getWidget(int)

OSN_IMPORT IAlfWidget *getWidget(intaIndex)const [virtual]

Returns child widget at given index.If index is not found return null.

Parameters

int aIndexIndex of widget to be returned.

getWidgetIndex(IAlfWidget &)

OSN_IMPORT intgetWidgetIndex(IAlfWidget &aWidget)const [virtual]

Returns the child index, when given the child widget.

Parameters

IAlfWidget & aWidgetchild widget, which index is returned

makeInterface(AlfWidget *, const IfId &)

OSN_IMPORT IAlfInterfaceBase *makeInterface(AlfWidget *aWidget,
const IfId &aType
)[static]

Getter for interfaces provided by the widget, the control, or the model.

Since
S60 ?S60_version

Parameters

AlfWidget * aWidgetThe widget to get the interface for.
const IfId & aTypeThe type id of the queried interface.

makeInterface(AlfWidget *)

T *makeInterface(AlfWidget *aWidget)[static]

Template getter for interfaces provided by the widget, the control, or the model. The type of the queried interface is specified by the template parameter.

Since
S60 ?S60_version

Parameters

AlfWidget * aWidgetThe widget to get the interface for.

makeInterface(const IfId &)

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

From IAlfInterfaceBase. Getter for interfaces provided by the widget classes. Derived classes should always call the base class method from the overridden MakeInterface.

Since
S60 ?S60_version

Parameters

const IfId & aTypeA descriptor to identify the type of the queried interface.

model()

OSN_IMPORT IAlfModel *model()[virtual]

Constructor. The new widget is left on the cleanup stack.

Since
S60 ?S60_version

parent()

OSN_IMPORT IAlfContainerWidget *parent()const [virtual]

Getter for the parent container. The ownership is not passed.

removeReferenceFromControl()

voidremoveReferenceFromControl()[private]

Removes reference from this widget's control to this widget.

removeWidget(int)

voidremoveWidget(intaIndex)[virtual]

Removes the child widget from given index.

Parameters

int aIndexIndex from which widget has to be removed. return void

removeWidget(IAlfWidget &)

OSN_IMPORT voidremoveWidget(IAlfWidget &aWidget)

Removes the given widget from this widget's child widget array. Does not modify control connections or control group containment.

Does nothing if the given widget is not found from widget array.

Parameters

IAlfWidget & aWidgetReference to a widget that is searched from the widget array of this widget and removed of found.

setChildFocus(bool)

OSN_IMPORT voidsetChildFocus(boolaFocus)[virtual]

Sets/Releases the Focus from child widget of container. Does not set the actual focused status in roster.

Since
S60 ?S60_version

Parameters

bool aFocusboolean value for focused status return void

setControl(CAlfWidgetControl *, bool)

OSN_IMPORT voidsetControl(CAlfWidgetControl *aControl,
boolaDeletePreviousControl = true
)[virtual]
Sets new widget control to this widget.
Exceptions
osncore::AlfException

Thrown with error code osncore::EInvalidArgument if aControl is alreasy associated with another widget.

IAlfWidget::setControl()
Since
S60 ?S60_version

Parameters

CAlfWidgetControl * aControlControl to be set to the widget.
bool aDeletePreviousControl = trueIf true, the previous widget control is destroyed.

setModel(IAlfModel *, bool)

OSN_IMPORT voidsetModel(IAlfModel *aModel,
boolaTakeOwnerShip = true
)[virtual]

Sets the model for the Widget.

Since
S60 ?S60_version

Parameters

IAlfModel * aModelModel to be set to this widget.
bool aTakeOwnerShip = true

setPresentation(const char *)

OSN_IMPORT voidsetPresentation(const char *aFilePath)[virtual]
Sets the presentation for the widget using presentation XML file. Destroys any existing presentation.
Exceptions
AlfWidgetException

if no visualization node available in Presentation XML or if no control is associated with the widget.

bad_alloc

Since
S60 ?S60_version

Parameters

const char * aFilePathPath to XML file describing the presentation of the widget. Not Owned.

widgetCount()

OSN_IMPORT intwidgetCount()const [virtual]

Returns total number of widgets contained by this container.

widgetName()

OSN_IMPORT const char *widgetName()const [virtual]

Constructor. The new widget is left on the cleanup stack.

Since
S60 ?S60_version

Member Data Documentation

auto_ptr< AlfWidgetImpl > mImpl

auto_ptr< AlfWidgetImpl >mImpl[private]