Skinning the application-Symbian中所有的系统颜色设置

转贴自:http://wiki.forum.nokia.com/index.php/CS001459_-_Skinning_the_application

 

ID CS001459 Creation date September 8th, 2009
Platform S60 3rd Edition FP2,
S60 5th Edition
Tested on devices Nokia N78, Nokia 5800 XpressMusic
Category Symbian C++ Subcategory UI, Themes

Overview

This code can be used to skin the application using MAknsSkinInstance.

MMP file

The following capabilities and libraries are required:

CAPABILITY ReadUserData
 
LIBRARY aknskins.lib aknskinsrv.lib aknswallpaperutils.lib

Header file

//includes
#include <aknsutils.h>
#include <AknsItemDef.h>
#include <aknsskininstance.h>

Source file

This code can be used to change the skin background:

MAknsSkinInstance* skin = AknsUtils::SkinInstance();
TAknsItemID elementID;<br>
//Changing the status pane skin background
elementID.Set(EAknsMajorSkin, EAknsMinorQsnBgAreaStatus);
skin->SetLocalItemDefL(AknsUtils::CreateBitmapItemDefL(elementID,KMbmFileName,EMbmSkinchange_0xe5c4b7eeGray));<br>
//Changing the navi pane skin background
elementID.Set(EAknsMajorAvkon, EAknsMinorQsnBgNavipaneSolid);
skin->SetLocalItemDefL(AknsUtils::CreateBitmapItemDefL(elementID,KMbmFileName,EMbmSkinchange_0xe5c4b7eePink));<br>
//Changing the list background
elementID.Set(EAknsMajorSkin, EAknsMinorQsnBgAreaMainListGene);
skin->SetLocalItemDefL(AknsUtils::CreateBitmapItemDefL(elementID,KMbmFileName,EMbmSkinchange_0xe5c4b7eeGray));
 
//Changing the control pane skin background
elementID.Set(EAknsMajorSkin, EAknsMinorQsnBgAreaControl);
skin->SetLocalItemDefL(AknsUtils::CreateBitmapItemDefL(elementID,KMbmFileName,EMbmSkinchange_0xe5c4b7eeGray));

This code can be used to change the text colors:

MAknsSkinInstance* skin = AknsUtils::SkinInstance();
CAknsItemData* itemData = skin->GetCachedItemData(KAknsIIDQsnTextColors, EAknsITColorTable);
CAknsColorTableItemData* colorItemData = static_cast<CAknsColorTableItemData*>(itemData);
TAknsColorTableEntry textColors[50];
for (TInt i = 0; i < 50; i++)
{
TUint32 color;
switch (i)
{
case EAknsCIQsnTextColorsCG1: //status area title text
case EAknsCIQsnTextColorsCG2: //navi pane texts
{
color = 0xFF0000;
}
break;<br>
case EAknsCIQsnTextColorsCG3: //active tab text
case EAknsCIQsnTextColorsCG4: //passive tab text
{
color = 0x00FF00;
}
break;<br>
case EAknsCIQsnTextColorsCG10: //list highlight list texts
{
color = 0x00FF00;
}
break;<br>
case EAknsCIQsnTextColorsCG13: //control pane general left softkey text
case EAknsCIQsnTextColorsCG14: //control pane general right softkey text
case EAknsCIQsnTextColorsCG15: //control pane idle left softkey text
case EAknsCIQsnTextColorsCG16: //control pane idle right softkey text
{
color=0xFF0000;
}
break;<br>
default:
{
color = colorItemData->ColorRgb(i).Value();
}
break;
}
 
textColors[i].iIndex=-1;
textColors[i].iRgb=color;
}
colorItemData->SetColorsL(50, textColors);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值