Alf::IAlfWidgetControl Class Reference

class Alf::IAlfWidgetControl : public Alf::IAlfInterfaceBase

The interface for widget controls. Widget controls are derived from Alfred controls. This is the primary interface to access the widget control functionality. Alfred control interface can be queried, but direct access should not be needed. Widget controls are responsible for the widget logic, i.e., storing and controlling the state of the widget. This usually includes input event handling, updating the presentation, and communication with the model, the application, and other controls. Event handlers can be used to implement parts of the widget logic.

alfwidgetmodel.lib
Since
S60 ?S60_version Draft

Inherits from

Constructor & Destructor Documentation

~IAlfWidgetControl()

~IAlfWidgetControl()[inline, virtual]

Virtual destructor.

Since
S60 ?S60_version

Member Functions Documentation

addElement(IAlfElement *)

voidaddElement(IAlfElement *aElement)[pure virtual]

Add a new element. The control takes the ownership of the element.

Since
S60 ?S60_version

Parameters

IAlfElement * aElementThe element to be added.

addEventHandler(IAlfWidgetEventHandler *, int)

voidaddEventHandler(IAlfWidgetEventHandler *aEventHandler,
intaIndex = -1
)[pure virtual]

Add a new event handler. The control takes the ownership of the event handler.

Since
S60 ?S60_version

Parameters

IAlfWidgetEventHandler * aEventHandlerThe event handler to be added.
int aIndex = -1The index of the new event handler, or -1 to append the event handler after the existing event handlers.

checkState(uint)

boolcheckState(uintaState)const [pure virtual]

Checks the current state of the widget control for a single aspect. This is equal to enabled = State() & aState

The parameter passed in should usually be a single bit state aspect e.g. IAlfWidgetControl::Focusable If a pattern with more than one bit set is passed in, the result is not easily usable.

Since
S60 ?S60_version

Parameters

uint aStatea state bit pattern to test

dataIdRange(const IAlfElement &)

uint dataIdRange(const IAlfElement &aElement)[pure virtual]
Get the range of data ids for the given element. The range is used for data mapping in ElementDataId() and ElementData(). SetDataIdRange().
Since
S60 ?S60_version

Parameters

const IAlfElement & aElementThe element.

dataIdToIndex(const IAlfElement &, uint)

uint dataIdToIndex(const IAlfElement &aElement,
uintaDataId
)[pure virtual]

Get the index of the given child data id in the parent data container. In the default implementation, the parent data id is calculated as follows: \[ index = aDataId % DataIdRange( aElement ) \] The implementation should match the functionality of ElementDataId().

Since
S60 ?S60_version

Parameters

const IAlfElement & aElementThe element associated with the given data id.
uint aDataIdThe data id.

destroyPresentation(int)

voiddestroyPresentation(intaTimeMilliseconds)[pure virtual]

Remove visuals from all elements. The visuals are destroyed after the given delay. This allows executing an animation sequence before the actual destruction of visuals.

Since
S60 ?S60_version

Parameters

int aTimeMillisecondsThe remaining time to destruction of all visuals.

destroyVisualsAndElements(int)

voiddestroyVisualsAndElements(intaTimeMilliseconds = 0)[pure virtual]

Remove visuals from all elements and destroy all elements. The visuals and elements are destroyed after the given delay. This allows executing an animation sequence before the actual destruction of visuals.

Since
S60 ?S60_version

Parameters

int aTimeMilliseconds = 0The remaining time to destruction of all visuals.

disableState(uint)

voiddisableState(uintaState)[pure virtual]

Disable given states.

This method modifies a state by clearing bits. No bits are set. This is equal to SetState( State() & ( 0xFFFFFFFF ^ aState ) ).

The resulting state is tested for the invariants documented with setState() and throws the same exceptions.

Since
S60 ?S60_version

Parameters

uint aStateThe states to be disabled.

element(int)

IAlfElement &element(intaIndex)[pure virtual]

Get an element by index.

Since
S60 ?S60_version

Parameters

int aIndexThe index of the element to get.

elementData(const IAlfElement &, uint)

IAlfVariantType *elementData(const IAlfElement &aElement,
uintaDataId
)[pure virtual]

Get data for a visual tree created by the given element.

Since
S60 ?S60_version

Parameters

const IAlfElement & aElementThe element containing the visual tree.
uint aDataIdThe data id of the visual tree.

elementDataId(const IAlfElement &, uint, uint)

uint elementDataId(const IAlfElement &aElement,
uintaIndex,
uintaParentDataId
)[pure virtual]

Get an id for mapping data to a visual tree created by an element. The data id is required to be unique withing the scope of the element. The parent data id and data id ranges specified by SetDataIdRange can be used to calculate data ids in hierarchical element structures. In the default implementation, the data id is calculated as follows: \[ data id = aParentDataId * DataIdRange( aElement ) + aIndex \]

Since
S60 ?S60_version

Parameters

const IAlfElement & aElementThe element to associate the data id with.
uint aIndexThe index of the data field.
uint aParentDataIdThe parent data id in the data hierarchy.

enableState(uint)

voidenableState(uintaState)[pure virtual]

Enable given states.

This method modifies a state by enabling bits. No bits are disabled. This is equal to SetState( State() | aState ).

The resulting state is tested for the invariants documented with setState() and throws the same exceptions.

Since
S60 ?S60_version

Parameters

uint aStateThe states to be enabled.

eventHandler(int)

IAlfWidgetEventHandler &eventHandler(intaIndex)[pure virtual]

Get an event handler by index.

Since
S60 ?S60_version

Parameters

int aIndexThe index of the event handler to get.

eventHandlerIndex(IAlfWidgetEventHandler &)

inteventHandlerIndex(IAlfWidgetEventHandler &aEventHandler)const [pure virtual]

Get the index of the given event handler. The index specifies the order in which the event handlers are processed.

Since
S60 ?S60_version

Parameters

IAlfWidgetEventHandler & aEventHandlerThe event handler.

findElement(const char *)

IAlfElement *findElement(const char *aName)[pure virtual]

Find an element by name.

Since
S60 ?S60_version

Parameters

const char * aNameThe name of the element to find.

findEventHandler(const TAlfEvent &)

IAlfWidgetEventHandler *findEventHandler(const TAlfEvent &aEvent)[pure virtual]

Find an event handler responsible for the given event.

Since
S60 ?S60_version

Parameters

const TAlfEvent & aEventThe event.

handleEvent(const TAlfEvent &)

AlfEventStatus handleEvent(const TAlfEvent &aEvent)[pure virtual]

Handles events sent to widget control.

Since
S60 ?S60_version

Parameters

const TAlfEvent & aEventThe event to be handled.

numElements()

intnumElements()const [pure virtual]

Get the number of elements in the control.

Since
S60 ?S60_version

numEventHandlers()

intnumEventHandlers()const [pure virtual]

Get the number of event handlers in the control.

Since
S60 ?S60_version

parentElementDataId(const IAlfElement &, uint)

uint parentElementDataId(const IAlfElement &aElement,
uintaDataId
)[pure virtual]

Get the parent data id from the given data id. In the default implementation, the parent data id is calculated as follows: \[ parent data id = aDataId / DataIdRange( aElement ) \] The implementation should match the functionality of ElementDataId().

Since
S60 ?S60_version

Parameters

const IAlfElement & aElementThe element associated with the given data id.
uint aDataIdThe data id.

removeAndDestroyElement(const IAlfElement &)

voidremoveAndDestroyElement(const IAlfElement &aElement)[pure virtual]

Remove and destroy an element. All visuals created by the element are destroyed.

Since
S60 ?S60_version

Parameters

const IAlfElement & aElementThe element to be removed and destroyed.

removeAndDestroyEventHandler(IAlfWidgetEventHandler &)

voidremoveAndDestroyEventHandler(IAlfWidgetEventHandler &aEventHandler)[pure virtual]

Remove and destroy an event handler.

Since
S60 ?S60_version

Parameters

IAlfWidgetEventHandler & aEventHandlerThe event handler to be removed and destroyed.

removeAndDestroyEventHandler(const UString &)

voidremoveAndDestroyEventHandler(const UString &aHandlerId)[pure virtual]

Remove and destroy an event handler from the control bases on its name.

Since
S60 ?S60_version

Parameters

const UString & aHandlerIdThe name/Id of the event handler to be removed and destroyed.

removeAndDestroyPresentationEventHandlers()

voidremoveAndDestroyPresentationEventHandlers()[pure virtual]

Remove and destroy all event handlers associated with presentation.

Since
S60 ?S60_version

removeElement(const IAlfElement &)

voidremoveElement(const IAlfElement &aElement)[pure virtual]

Remove an element.

Since
S60 ?S60_version

Parameters

const IAlfElement & aElementThe element to be removed.

removeEventHandler(IAlfWidgetEventHandler &)

voidremoveEventHandler(IAlfWidgetEventHandler &aEventHandler)[pure virtual]

Remove and destroy an event handler.

Since
S60 ?S60_version

Parameters

IAlfWidgetEventHandler & aEventHandlerThe event handler to be removed and destroyed.

removePresentationEventHandlers()

voidremovePresentationEventHandlers()[pure virtual]

Removes all event handlers associated with presentation from this control.

Since
S60 ?S60_version

setDataIdRange(const IAlfElement &, uint)

voidsetDataIdRange(const IAlfElement &aElement,
uintaRange
)[pure virtual]
Set the range of data ids for an element. The range is used for data mapping in ElementDataId() and ElementData(). The default range for all elements is 0xFFFFFFFF. The ranges need to be adjusted for child elements in hierarchical element structures. Otherwise,the data ids will overflow and not remain unique. ElementDataId().
Since
S60 ?S60_version

Parameters

const IAlfElement & aElementThe element.
uint aRangeThe range of data ids.

setState(uint)

voidsetState(uintaState)[pure virtual]

Sets the widget control's state.

The entire state of the widget is set to the passed-in value.

The new state must conform to the following invariants:

If IAlfWidgetControl::Focus is set, then IAlfWidgetControl::Focusable must also be set If IAlfWidgetControl::Focusable is set, then IAlfWidgetControl::Enabled must also be set

If these invariants are violated, then this method will throw AlfException::EInvalidArgument

Since
S60 ?S60_version

Parameters

uint aStateThe new state of the control.

state()

uint state()const [pure virtual]

Get the state of the control. The state is a combination of binary state flags.

The individual aspects of the state can be queried by testing for the bits in the return value.

Since
S60 ?S60_version

type()

const IfId &type()[static, inline]

updatePresentation()

voidupdatePresentation()[pure virtual]

Create or update the presentation for the widget.

Since
S60 ?S60_version

widget()

AlfWidget *widget()[pure virtual]

Get the owner widget of this control.

Since
S60 ?S60_version

Member Data Documentation

const uint Enabled

const uintEnabled[static]

const uint Focusable

const uintFocusable[static]

const uint Focused

const uintFocused[static]

const uint Visible

const uintVisible[static]

Defines the bitflags used with the state interfaces.