MAknsSkinInstance::GetCachedItemData() return NuLL
2010-04-14 01:48:00 来源:WEB开发网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
Tags:MAknsSkinInstance GetCachedItemData return
编辑录入:coldstar [复制链接] [打 印]更多精彩
赞助商链接