WEB开发网
开发学院手机开发Symbian 开发 MAknsSkinInstance::GetCachedItemData() return ... 阅读

MAknsSkinInstance::GetCachedItemData() return NuLL

 2010-04-14 01:48:00 来源:WEB开发网   
核心提示:element.Because of this, it is not possible for the MAknsSkinInstance to return a single CFbsBitmap instance for skin items of type EAknsITEffectQueue. This sol
element.

Because of this, it is not possible for the MAknsSkinInstance to return a single CFbsBitmap instance for skin items of type EAknsITEffectQueue. This solution describes what applications should do in such situations.

Solution

The solution is to use AknsDrawUtils.

1) If the application needs to draw the current (background) skin content within one of its controls (derived from CCoeControl), then it can use AknsDrawUtils::Background():

The following example code demonstrates this:

// Create a background context (in ConstructL(), as a class member)

iSkinContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,

Rect(),

EFalse );

Then, in the Draw() function:

CWindowGc& gc = SystemGc();

TRect rect = Rect();

gc.Clear( rect );

AknsDrawUtils::Background( AknsUtils::SkinInstance(),

iSkinContext,

this,

gc,

rect );

(2) If the application needs a bitmap instance, then AknsDrawUtils::DrawBackground() can be used to draw the current skin content on to a CFbsBitGc:

// Create an off-screen bitmap and context (CFbsBitGc)

// Also remember to take care of destruction / cleanup during leaves

CFbsBitmap* offScreenBitmap = new (ELeave) CFbsBitmap();

User::LeaveIfError( offScreenBitmap->Create( aSize, aDisplayMode ) );

CFbsBitGc* bitGc = 0;

CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( offScreenBitmap );

User::LeaveIfError( bitmapDevice->CreateContext( bitGc ) );

// Draw the content on the off-screen bitmap

AknsDrawUtils::DrawBackground( AknsUtils::SkinInstance(),

iSkinContext,

this,

*bitGc,

TPoint(0,0),

rect,

KAknsDrawParamDefault );

// offScreenBitmap now contains current skin content

by:http://wiki.forum.nokia.com/index.php/TSS000716_-_Why_does_MAknsSkinInstance::GetCachedItemData%28%29_return_NULL%3F

上一页  1 2 

Tags:MAknsSkinInstance GetCachedItemData return

编辑录入:coldstar [复制链接] [打 印]
赞助商链接