MAknsSkinInstance Class Reference

#include <mw/AknsSkinInstance.h>

class MAknsSkinInstance
Public Member Functions
virtual ~MAknsSkinInstance()
pure virtual CAknsItemData *CreateUncachedItemDataL(const TAknsItemID &, const TAknsItemType)
pure virtual CAknsItemData *CreateUncachedItemDataL(const TAknsItemID &)
pure virtual CAknsItemData *GetCachedItemData(const TAknsItemID &, const TAknsItemType)
pure virtual CAknsItemData *GetCachedItemData(const TAknsItemID &)
pure virtual TBool IsUpdateInProgress()
pure virtual voidNotifyClientError(const TAknsClientError)
pure virtual voidRemoveLocalItemDefs()
pure virtual MAknsDataContext *RootDataContext()
pure virtual voidSetChangeEventsEnabled(TBool)
pure virtual voidSetLocalItemDefL(CAknsItemDef *)
pure virtual TAknsSkinChangeReason SkinChangeReason()

Detailed Description

Interface to skin instance. Skin instance is a singleton object that can be retrieved using AknsUtils::SkinInstance(). It maintains item cache, but also local item definition list and root data context. While skin instance can be used directly by client code, it is often easier to use utility methods provided in AknsUtils and AknsDrawUtils.

This is a public interface class that contains no exported functions. The class is not intended for derivation outside the library.

Since
2.0

Constructor & Destructor Documentation

~MAknsSkinInstance ( )

~MAknsSkinInstance()[inline, virtual]

Destructor for internal use. Destructor is reserved for internal use and should be never called by client code on singleton instance.

Member Function Documentation

CreateUncachedItemDataL ( const TAknsItemID &, const TAknsItemType )

CAknsItemData *CreateUncachedItemDataL(const TAknsItemID &aID,
const TAknsItemTypeaType
)[pure virtual]

Creates a new non-cached item data object. The method constructs a new instance of item data of the specified skin item and returns it.

Since
2.0
Exceptions:
If item data construction fails, function leaves with an error code.
Parameters
aIDItem ID of the item to be created.
aTypeType of the item.
Return Value
Newly created item data object. Ownership of the object is transferred to the caller. If no item definition for the specified ID was found, NULL value is returned. The caller can assume that a non-NULL value is a pointer that can be casted to the subclass corresponding to aType.

CreateUncachedItemDataL ( const TAknsItemID & )

CAknsItemData *CreateUncachedItemDataL(const TAknsItemID &aID)[pure virtual]

Creates a new non-cached item data object. The method constructs a new instance of item data of the specified skin item and returns it.

This overload can be used to create items if the type of the item is not known beforehand. In other cases, the first overload shold be preferred, since it may be considerably faster.

Since
2.0
Exceptions:
If item data construction fails, function leaves with an error code.
Parameters
aIDItem ID of the item to be created.
Return Value
Newly created item data object. Ownership of the object is transferred to the caller. If no item definition for the specified ID was found, NULL value is returned.

GetCachedItemData ( const TAknsItemID &, const TAknsItemType )

CAknsItemData *GetCachedItemData(const TAknsItemID &aID,
const TAknsItemTypeaType
)[pure virtual]

Returns (and constructs if necessary) cached item data object. The method first searches the cache for the specified item. If none is found, it creates and caches a new instance of the item data.

Since
2.0
Exceptions:
Since this is a non-leaving method, the skin instance may perform error handling, e.g., by instructing the system to switch to the default skin.
Parameters
aIDItem ID of the item to be retrieved.
aTypeType of the item.
Return Value
Item data for the specified item, or NULL value if none was found or an error occured. The caller can assume that a non-NULL value is a pointer that can be casted to the subclass corresponding to aType.

GetCachedItemData ( const TAknsItemID & )

CAknsItemData *GetCachedItemData(const TAknsItemID &aID)[pure virtual]

Returns (and constructs if necessary) cached item data object. The method first searches the cache for the specified item. If none is found, it creates and caches a new instance of the item data.

This overload can be used to retrieve items if the type of the item is not known beforehand. In other cases, the first overload shold be preferred, since it may be considerably faster.

Since
2.0
Exceptions:
Since this is a non-leaving method, the skin instance may perform error handling, e.g., by instructing the system to switch to the default skin.
Parameters
aIDItem ID of the item to be retrieved.
Return Value
Item data for the specified item, or NULL value if none was found or an error occured.

IsUpdateInProgress ( )

TBool IsUpdateInProgress()[pure virtual]

Checks whether a skin update is currently being done.

Since
5.0

NotifyClientError ( const TAknsClientError )

voidNotifyClientError(const TAknsClientErroraError)[pure virtual]

Notifies the skin instance about an error condition. Errors that can be reported to the skin instance include incorrect skin content (e.g., a bitmap that can not be constructed) or out of memory situations. The error condition is usually handled by switching to the default system skin. Error notifications will be ignored when there is no reasonable recovery operation available.

Since
2.0
Parameters
aErrorError type. Currently only EAknsClientErrorUnspecified is supported.

RemoveLocalItemDefs ( )

voidRemoveLocalItemDefs()[pure virtual]

Removes all local item defs from this instance set by SetLocalItemDefL

RootDataContext ( )

MAknsDataContext *RootDataContext()[pure virtual]

Returns root data context. Root data context is used by other data context instances to indicate data reservations and releases. It may also be used directly by application code, if no other context is available. Nearest data context can be retrieved using AknsUtils::DataContext(MObjectProvider* aMop) utility method.

Since
2.0
Return Value
Pointer to root data context. Skin instance still owns the data context and its lifetime is that of skin instance itself.

SetChangeEventsEnabled ( TBool )

voidSetChangeEventsEnabled(TBoolaEnabled)[pure virtual]

Enables or disables change notifications. When enabled, resource change events are sent to the application when item definitions change. If a change occurs when events are disabled, it will be sent (collated, only one event) when events are re-enabled.

Since
2.0
Parameters
aEnabledETrue to enable events, EFalse to disable them.

SetLocalItemDefL ( CAknsItemDef * )

voidSetLocalItemDefL(CAknsItemDef *aDef)[pure virtual]

Sets local item definition. Adds (or replaces if one already exists) a local item definition.

Since
2.0
Exceptions:
If an error occurs, function leaves with an error code. Item definition object is either added into local definition list or destroyed depending on when the error occured.
Note:
Since the method always assumes ownership of aDef, it must not be pushed into the cleanup stack.
Parameters
aDefNew local item definition. Ownership of definition object is transferred to skin instance and caller should make no access to it after this call.

SkinChangeReason ( )

TAknsSkinChangeReason SkinChangeReason()[pure virtual]

Queries the last skin change reason. This function can be used to query the last reason why skin change occurred. Usually client would use this inside the HandleResourceChange call. If no skin change events have been reported for the application, the function returns ENormalSkinChange.

Since
3.1
Return Value
the last skin change reason.