Skins provide a way of changing the appearance of the UI at runtime. They allow you to customize the default background for applications and modify colors and icons. Skins are a new feature in Series 60 2.x. Some example skins are shown in Figure 5-5.

Not all controls need to provide the same level of support for skins. Series 60 UI controls (sometimes known as Avkon controls) offer different levels of support for skins, depending on their needs. These controls can be compulsory skin-providing, optionally skin-providing, skin-observing, or non-skin-aware.

Compulsory Skin-Providing Controls

Compulsory skin-providing controls always display skins and dynamically comply with skin changes. You do not have to do anything special to get compulsory skin-providing controls to display skins ”this is their default behavior. The control and status panes are examples of this type of control.

Optionally Skin-Providing Controls

The default behavior of optionally skin-providing controls is not to display skins, but they can be enabled to do so if required. Lists and grids are examples of this type of control. Optionally skin-providing controls can be skin-enabled in one of two ways: either each control is enabled individually, or all controls within an application can be enabled simultaneously .

The typical case is to enable skins for all controls together, to give your application a consistent look and feel. This is performed in the AppUI's second-phase constructor by calling the BaseConstructL() method and passing EAknEnableSkin as its argument:

 void CMyAppUi::ConstructL()    {    // Enables skins in all the optionally    // skin-providing controls in this app    BaseConstructL(EAknEnableSkin);    } 

This will ensure that all optionally skin-providing controls will have skins enabled. If you do not want to enable skins, then simply leave out the EAknEnableSkin argument.

To enable skins for optionally skin-providing controls individually, you should call the SetSkinEnabledL() method for the control in question:

 // Enables skin in a single optionally // skin-providing control iSkinProvidingControl->SetSkinEnabledL(ETrue); 

Skin-Observing Controls

Skin-observing controls do not provide any information themselves as to what skin should be used to draw them, but rely instead on their container control to provide this information. If this information is available, then they will use it to draw themselves . In other words, they will use the same skin as used by their parent control.

Non-Skin-Aware Controls

Non-skin-aware controls provide no support for skins, but it is still possible to use them in layouts that use skins. For example, controls such as labels can be instructed not to draw their backgrounds, and so they can be drawn over a skinned background without disrupting it.

Defining Skin-Aware Controls

If you define any controls in your application that need to be made skin-aware, it is up to you to write them so that they explicitly support skins. This may mean changing your control's drawing code so that it uses the methods provided by the skins utility classes AknsUtils and AknsDrawUtils . If a control clears its background, it must do so using methods provided by the AknsDrawUtils class. When setting up your controls, you must also make sure that you have correctly set up the MObjectProvider chain for all skin-aware controls.

Controls are notified of skin changes via their HandleResourceChange() method ”this is called by the application framework with a value of KAknsMessageSkinChange when the skin is changed. If you are using the skin utility classes, then you will have to link against aknskins.lib .

Creating skin-aware controls or actual skins is beyond the scope of this book. However, further information on implementing skin-aware controls is available in the Avkon Skins User's Guide in the Series 60 2.x SDK Documentation and Series 60 Theme Studio from Forum Nokia ( provides a means to create new skin (or "theme") designs.

Developing Series 60 Applications. A Guide for Symbian OS C++ Developers
Developing Series 60 Applications: A Guide for Symbian OS C++ Developers: A Guide for Symbian OS C++ Developers
ISBN: 0321227220
EAN: 2147483647
Year: 2003
Pages: 139 © 2008-2017.
If you may any questions please contact us: