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 void addWidget ( IAlfWidget &)
OSN_IMPORT void applyLayout ( IAlfLayoutManager &)
OSN_IMPORT CAlfWidgetControl * control ()
OSN_IMPORT IAlfWidget * getWidget (int)
OSN_IMPORT int getWidgetIndex ( 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 ()
void removeWidget (int)
OSN_IMPORT void removeWidget ( IAlfWidget &)
OSN_IMPORT void setChildFocus (bool)
OSN_IMPORT void setControl ( CAlfWidgetControl *, bool)
OSN_IMPORT void setModel ( IAlfModel *, bool)
OSN_IMPORT void setPresentation (const char *)
OSN_IMPORT int widgetCount ()
OSN_IMPORT const char * widgetName ()
Protected Member Functions
AlfWidget ()
Private Member Functions
void addCommonWidgetProperties ()
void removeReferenceFromControl ()
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_IMPORT AlfWidget ( 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 * aWidgetName The name of the widget.
IAlfContainerWidget & aContainer Container widget that will contain this widget.
CAlfEnv & aEnv Toolkit environment object that will be used to create the default control.

AlfWidget(const char *)

OSN_IMPORT AlfWidget ( 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 * aWidgetName The name of the widget.

AlfWidget()

OSN_IMPORT AlfWidget ( ) [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()

void addCommonWidgetProperties ( ) [private]

Adds the Common Properties for the widget

Since
S60 ?S60_version

addWidget(IAlfWidget &)

OSN_IMPORT void addWidget ( IAlfWidget & aWidget ) [virtual]

Adds a child widget to the container.

Parameters

IAlfWidget & aWidget Child widget to be added to container. return void

applyLayout(IAlfLayoutManager &)

OSN_IMPORT void applyLayout ( IAlfLayoutManager & aLayout ) [virtual]

Sets the base layout of container widget.

Parameters

IAlfLayoutManager & aLayout New 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 ( int aIndex ) const [virtual]

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

Parameters

int aIndex Index of widget to be returned.

getWidgetIndex(IAlfWidget &)

OSN_IMPORT int getWidgetIndex ( IAlfWidget & aWidget ) const [virtual]

Returns the child index, when given the child widget.

Parameters

IAlfWidget & aWidget child 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 * aWidget The widget to get the interface for.
const IfId & aType The 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 * aWidget The 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 & aType A 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()

void removeReferenceFromControl ( ) [private]

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

removeWidget(int)

void removeWidget ( int aIndex ) [virtual]

Removes the child widget from given index.

Parameters

int aIndex Index from which widget has to be removed. return void

removeWidget(IAlfWidget &)

OSN_IMPORT void removeWidget ( 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 & aWidget Reference to a widget that is searched from the widget array of this widget and removed of found.

setChildFocus(bool)

OSN_IMPORT void setChildFocus ( bool aFocus ) [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 aFocus boolean value for focused status return void

setControl(CAlfWidgetControl *, bool)

OSN_IMPORT void setControl ( CAlfWidgetControl * aControl,
bool aDeletePreviousControl = 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 * aControl Control to be set to the widget.
bool aDeletePreviousControl = true If true, the previous widget control is destroyed.

setModel(IAlfModel *, bool)

OSN_IMPORT void setModel ( IAlfModel * aModel,
bool aTakeOwnerShip = true
) [virtual]

Sets the model for the Widget.

Since
S60 ?S60_version

Parameters

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

setPresentation(const char *)

OSN_IMPORT void setPresentation ( 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 * aFilePath Path to XML file describing the presentation of the widget. Not Owned.

widgetCount()

OSN_IMPORT int widgetCount ( ) 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]