本文整理汇总了C++中CFbsBitmap::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ CFbsBitmap::Load方法的具体用法?C++ CFbsBitmap::Load怎么用?C++ CFbsBitmap::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFbsBitmap
的用法示例。
在下文中一共展示了CFbsBitmap::Load方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpriteUpdateMemberNegTestsL
/**
@SYMTestCaseID GRAPHICS-CODEBASE-WSERV-0054-0001
@SYMPREQ PGM027
@SYMTestCaseDesc Negative Tests RWsSpriteBase::UpdateMember API.
@SYMTestPriority 1
@SYMTestStatus Implemented
@SYMTestActions This test calls RWsPointerCursor::UpdateMember
@SYMTestExpectedResults Should run properly with out any Panics.
*/
void CTTSprite::SpriteUpdateMemberNegTestsL()
{
RWsPointerCursor iCursor1;
CFbsBitmap bitmap;
bitmap.Load(TEST_BITMAP_NAME,0);
RWindow win(TheClient->iWs);
win.Construct(*TheClient->iGroup->GroupWin(),1);
win.Activate();
iCursor1=RWsPointerCursor(TheClient->iWs);
TSpriteMember member;
SetUpMember(member);
member.iBitmap=&bitmap;
User::LeaveIfError(iCursor1.Construct(0));
User::LeaveIfError(iCursor1.AppendMember(member));
User::LeaveIfError(iCursor1.Activate());
win.SetCustomPointerCursor(iCursor1);
iCursor1.UpdateMember(-100);
RWsPointerCursor iCursor2;
bitmap.Load(TEST_NEW_BITMAP_NAME,0);
iCursor2=RWsPointerCursor(TheClient->iWs);
User::LeaveIfError(iCursor2.Construct(0));
User::LeaveIfError(iCursor2.AppendMember(member));
User::LeaveIfError(iCursor2.Activate());
win.SetCustomPointerCursor(iCursor2);
iCursor2.UpdateMember(10000);
iCursor1.Close();
iCursor2.Close();
win.Close();
}
示例2: TestIndiCntnerReplaceIndicatorIconL
// -----------------------------------------------------------------------------
// Ctestsdkindicators::TestIndiCntnerReplaceIndicatorIconL
// -----------------------------------------------------------------------------
//
TInt CTestSDKIndicators::TestIndiCntnerReplaceIndicatorIconL( CStifItemParser& /*aItem*/ )
{
// Print to UI
_LIT( Ktestsdkindicators, "testsdkindicators" );
_LIT( KTestIndiCntnerReplaceIndicatorIconL, "In TestIndiCntnerReplaceIndicatorIconL" );
TestModuleIf().Printf( 0, Ktestsdkindicators, KTestIndiCntnerReplaceIndicatorIconL );
// Print to log file
iLog->Log( KTestIndiCntnerReplaceIndicatorIconL );
TInt err = KErrNone;
TUid Id = { EAknIndicatorEnvelope };
_LIT( KFileName, "z:\\resource\\apps\\avkon2.mbm" );
CFbsBitmap* bmp = new (ELeave) CFbsBitmap();
bmp->Load( KFileName, EMbmAvkonQgn_stat_cyphering_on );
CFbsBitmap* bmpMask = new (ELeave) CFbsBitmap();
bmpMask->Load( KFileName, EMbmAvkonQgn_stat_cyphering_on_mask );
iIndicatorContn->CreateIndicatorFromResourceL( R_TEST_INDICATOR,
CAknIndicatorContainer::EMultiColorIndicator );
iIndicatorContn->ReplaceIndicatorIconL(
Id,
EAknIndicatorStateOn,
CAknIndicatorContainer::ELayoutModeUsual,
bmp, bmpMask);
return err;
}
示例3: ConstructL
void CAlfPerfAppAvkonTestCaseBasic::ConstructL(
CAlfEnv& aEnv, TInt aCaseId, const TRect& aVisibleArea )
{
CAlfPerfAppBaseTestCaseControl::ConstructL( aEnv, aCaseId, aVisibleArea );
iWinRect = aVisibleArea;
iAvkonControl = new(ELeave) CAvkonTestCoeControl();
iAvkonControl->ConstructL(iWinRect);
iAnimTimer = CPeriodic::NewL(CActive::EPriorityStandard);
TFontSpec myFontSpec(_L("Arial"), 3*120);
CCoeEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iFont, myFontSpec);
// Find my private path
TFileName pathWithoutDrive;
TFileName driveAndPath;
CEikonEnv::Static()->FsSession().PrivatePath( pathWithoutDrive );
driveAndPath.Copy(CEikonEnv::Static()->EikAppUi()->Application()->AppFullName().Left(2));
driveAndPath.Append(pathWithoutDrive);
// Create pictures
iPictureBm = new(ELeave) CFbsBitmap;
driveAndPath.Append(_L("alfperfapp_test1.mbm"));
User::LeaveIfError(iPictureBm->Load(driveAndPath));
iMaskBm = new(ELeave) CFbsBitmap;
User::LeaveIfError(iMaskBm->Create(iPictureBm->SizeInPixels(), EGray256));
iTestCaseStartTime_ys.UniversalTime();
iTestCaseFrameCount = 0;
}
示例4: Draw
void CUnRegisterView::Draw(const TRect& /* aRect */) const
{
CWindowGc& gc = SystemGc();
gc.Clear();
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
CleanupStack::PushL(bitmap);
TBuf<128> path;
path = CRippleVaultAppUi::ApplicationDriveAndPath();
path.Append(KLogoMbmFileName);
User::LeaveIfError(bitmap->Load(path, EMbmLogoLogo));
TPoint pos(50,60);
gc.BitBlt(pos, bitmap);
CleanupStack::PopAndDestroy();
const CFont* fontUsed;
fontUsed = iEikonEnv->TitleFont();
gc.UseFont(fontUsed);
//TPoint pos1(50,30);
//gc.DrawText(*(iEikonEnv->AllocReadResourceL(R_RIPPLE_VAULT)),pos1);
TPoint pos2(30,180);
gc.DrawText(*(iEikonEnv->AllocReadResourceL(R_PURPLEACE_WEB)),pos2);
// Finished using the font
gc.DiscardFont();
}
示例5: CreateIconL
// ---------------------------------------------------------------------------
// CBCTestButtonCase::CreateIconL
// ---------------------------------------------------------------------------
//
CGulIcon* CBCTestButtonCase::CreateIconL()
{
CFbsBitmap *bitmap = new( ELeave ) CFbsBitmap();
bitmap->Load( AknIconUtils::AvkonIconFileName(),
EMbmAvkonQgn_prop_set_button );
return CGulIcon::NewL( bitmap );
}
示例6: LoadBitmapL
/**
Loads a bitmap from a file
@param aName the filename of the bitmap to load
@param aIndex the index of the bitmap to load in the file
*/
CFbsBitmap* CTe_graphicsperformanceSuiteStepBase::LoadBitmapL(const TDesC& aName, TInt aIndex)
{
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
CleanupStack::PushL(bitmap);
User::LeaveIfError(bitmap->Load(aName, aIndex));
CleanupStack::Pop(bitmap);
return bitmap;
}
示例7: LoadPartialBitmapL
void AknBitmapMirrorUtils::LoadPartialBitmapL(CFbsBitmap* aBitmap, const TDesC& aFileName,TInt32 aId, TRect aRect, TBool aMirrorHorizontally)
{
CFbsBitmap* destinationBitmap = aBitmap;
User::LeaveIfNull(destinationBitmap);
CFbsBitmap* sourceBitmap = new (ELeave) CFbsBitmap();
CleanupStack::PushL(sourceBitmap);
User::LeaveIfError(sourceBitmap->Load(aFileName, aId, ETrue));
TSize sourceBitmapSize = sourceBitmap->SizeInPixels();
TRect sourceRect = TRect(aRect);
if (sourceRect == KWholeBitmapRect)
{
sourceRect.iTl.iX = 0;
sourceRect.iTl.iY = 0;
sourceRect.iBr.iX = sourceBitmapSize.iWidth;
sourceRect.iBr.iY = sourceBitmapSize.iHeight;
}
TSize destinationBitmapSize(sourceRect.Width(), sourceRect.Height());
User::LeaveIfError(destinationBitmap->Create(destinationBitmapSize, sourceBitmap->DisplayMode()));
CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL( destinationBitmap );
CleanupStack::PushL(destinationDevice);
CFbsBitGc* destinationGc;
User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
if (aMirrorHorizontally)
{
TRect sourceBitmapBlittingRect( sourceRect.iTl.iX,sourceRect.iTl.iY,sourceRect.iTl.iX + 1,sourceRect.iBr.iY );
for ( TInt xPos=destinationBitmapSize.iWidth-1; xPos >= 0; xPos-- )
{
destinationGc->BitBlt( TPoint(xPos,0), sourceBitmap, sourceBitmapBlittingRect );
sourceBitmapBlittingRect.iTl.iX++;
sourceBitmapBlittingRect.iBr.iX++;
}
}
else
{
destinationGc->BitBlt( TPoint(0,0), sourceBitmap, sourceRect );
}
delete destinationGc;
CleanupStack::PopAndDestroy(2); // sourceBitmap, destinationDevice
}
示例8: SvgElementL
/**
* Load svg element.
*/
CFbsBitmap* CFuiTheme::SvgElementL( TInt aElementId )
{
TFileName svgFile;
SvgFile( svgFile );
CFbsBitmap* a = new (ELeave)CFbsBitmap();
User::LeaveIfError( a->Load( svgFile, aElementId ) );
TSize contentSize;
AknIconUtils::PreserveIconData( a );
AknIconUtils::GetContentDimensions( a, contentSize );
AknIconUtils::SetSize( a, contentSize );
AknIconUtils::DestroyIconData( a );
iElements.Append( a );
return a;
}
示例9: Draw
// ---------------------------------------------------------
// CUnRegisterContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CUnRegisterContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushColor(KRgbWhite);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
CleanupStack::PushL(bitmap);
TBuf<128> path;
path = CRippleVaultAppUi::ApplicationDriveAndPath();
path.Append(KLogoMbmFileName);
User::LeaveIfError(bitmap->Load(path, EMbmLogoLogo));
TPoint pos(50,30);
gc.BitBlt(pos, bitmap);
CleanupStack::PopAndDestroy();
}
示例10: INFO_PRINTF1
/**
@SYMTestCaseID
GRAPHICS-FBSERV-0512
@SYMTestCaseDesc
Creates bitmaps in different ways and checks if memory allocation succeeded
@SYMTestActions
Creates normal size bitmaps, large bitmaps, loads bitmaps, loads shared bitmaps,
duplicated bitmaps, resizes bitmaps, compresses bitmaps, externalized bitmaps to write store,
internalizes bitmaps back again from write store. All ways of creating bitmaps are tested
against Out Of Memory error conditions
@SYMTestExpectedResults
Test should pass
*/
void CTAlloc::BitmapsL()
{
TInt heapMarkCheckFlag;
if( !iStep->GetIntFromConfig(KDefaultSectionName, KFbsHeapMarkCheckFlag, heapMarkCheckFlag) )
{
INFO_PRINTF1(_L("Error reading ini file"));
User::Leave(KErrNotFound);
}
CFbsBitmap iBitmap;
CFbsBitmap iBitmap2;
iTestBitmapName = KTestBitmapOnZ;
TInt ret = iBitmap.Load(iTestBitmapName,ETfbs,NULL);
TEST2(ret, KErrNone);
ret = iBitmap.Create(KLargeSize,EColor256); // Expand server caches
TEST2(ret, KErrNone);
iBitmap.Reset();
TInt count;
// Create bitmap
INFO_PRINTF1(_L("CFbsBitmap::Create()\r\n"));
for (count = 1; ; count++)
{
iFbs->SendCommand(EFbsMessDefaultAllocFail,count);
if(heapMarkCheckFlag)
{
iFbs->SendCommand(EFbsMessDefaultMark);
iFbs->SendCommand(EFbsMessUserMark);
}
ret = iBitmap.Create(KSmallSize,EColor256);
if (ret == KErrNoMemory)
{
if(heapMarkCheckFlag)
{
iFbs->SendCommand(EFbsMessDefaultMark);
iFbs->SendCommand(EFbsMessUserMark);
}
}
else if (ret == KErrNone)
{
iBitmap.Reset();
if(heapMarkCheckFlag)
{
iFbs->SendCommand(EFbsMessDefaultMark);
iFbs->SendCommand(EFbsMessUserMark);
}
break;
}
else
TEST2(ret, KErrNone);
}
iFbs->SendCommand(EFbsMessDefaultAllocFail,0);
iFbs->SendCommand(EFbsMessUserAllocFail,0);
TEST(iFbs->ResourceCount()==0);
for (count = 1; ; count++)
{
iFbs->SendCommand(EFbsMessUserAllocFail,count);
if(heapMarkCheckFlag)
{
iFbs->SendCommand(EFbsMessDefaultMark);
iFbs->SendCommand(EFbsMessUserMark);
}
ret=iBitmap.Create(KSmallSize,EGray2);
if (ret == KErrNoMemory)
{
if(heapMarkCheckFlag)
{
iFbs->SendCommand(EFbsMessDefaultMarkEnd);
iFbs->SendCommand(EFbsMessUserMarkEnd);
}
}
else if (ret == KErrNone)
{
iBitmap.Reset();
if(heapMarkCheckFlag)
{
//.........这里部分代码省略.........
示例11: RetIcon
/*
-------------------------------------------------------------------------------
internal icon re-sizer function
-------------------------------------------------------------------------------
*/
CGulIcon* CYBRecognizer1::GetListIconL(const TDesC& aFileName,TInt aImage,TInt aMask, TSize aSize)
{
CGulIcon* RetIcon(NULL);
TBool OkToAdd(EFalse);
CFbsBitmap* MyBitmap = new(ELeave)CFbsBitmap();
CleanupStack::PushL(MyBitmap);
CFbsBitmap* MyMask = new(ELeave)CFbsBitmap();
CleanupStack::PushL(MyMask);
if(KErrNone == MyBitmap->Load(aFileName,aImage))
{
if(KErrNone == MyMask->Load(aFileName,aMask))
{
OkToAdd = ETrue;
}
}
if(OkToAdd)
{
TSize ImgSiz = MyBitmap->SizeInPixels();
if(aSize.iWidth != ImgSiz.iWidth
|| aSize.iHeight!= ImgSiz.iHeight)
{
CFbsBitmap* TmpBackBitmap = new(ELeave)CFbsBitmap();
CleanupStack::PushL(TmpBackBitmap);
if(KErrNone == TmpBackBitmap->Create(aSize,MyBitmap->DisplayMode()))
{
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(TmpBackBitmap);
CleanupStack::PushL(bitmapDevice);
CFbsBitGc* graphicsContext = NULL;
User::LeaveIfError(bitmapDevice->CreateContext(graphicsContext));
CleanupStack::PushL(graphicsContext);
graphicsContext->DrawBitmap(TRect(0,0,aSize.iWidth,aSize.iHeight),MyBitmap);
CleanupStack::PopAndDestroy(2);//graphicsContext,bitmapDevice,
}
CFbsBitmap* TmpBackMask = new(ELeave)CFbsBitmap();
CleanupStack::PushL(TmpBackMask);
if(KErrNone == TmpBackMask->Create(aSize,MyMask->DisplayMode()))
{
CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(TmpBackMask);
CleanupStack::PushL(bitmapDevice);
CFbsBitGc* graphicsContext = NULL;
User::LeaveIfError(bitmapDevice->CreateContext(graphicsContext));
CleanupStack::PushL(graphicsContext);
graphicsContext->DrawBitmap(TRect(0,0,aSize.iWidth,aSize.iHeight),MyMask);
CleanupStack::PopAndDestroy(2);//graphicsContext,bitmapDevice,
}
CleanupStack::Pop(2);//TmpBackBitmap, TmpBackMask
RetIcon = CGulIcon::NewL(TmpBackBitmap, TmpBackMask);
}
}
if(!RetIcon && OkToAdd)
{
CleanupStack::Pop(2);//MyBitmap, MyMask
RetIcon = CGulIcon::NewL(MyBitmap, MyMask);
}
else
{
CleanupStack::PopAndDestroy(2);//MyBitmap, MyMask
}
return RetIcon;
}
示例12: PointerCursorVisibleL
void CTTSprite::PointerCursorVisibleL()
{
if (!TestBase()->ConfigurationSupportsPointerEventTesting())
{
INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing"));
return;
}
// The pointer events need time to have an affect on the wserv
static const TInt eventPropagationDelay = 100 * 1000; // 100 ms
TInt screenNumber = TheClient->iScreen->GetScreenNumber();
if(screenNumber != 0) // pointer events only supported on emulator screen 0
{
LOG_MESSAGE(_L("Pointer Cursor Visible only runs on screen 0"));
return;
}
// set up objects used in test
// 50x50 red rectangle colour 24
CFbsBitmap bitmap;
User::LeaveIfError(bitmap.Load(TEST_BITMAP_NAME, 8));
TSize bmSize = bitmap.SizeInPixels();
TPoint bmSample = TPoint(bmSize.iWidth / 2, bmSize.iHeight / 2);
TRgb bmColour;
bitmap.GetPixel(bmColour, bmSample);
TEST(bmColour == KRgbRed);
// single window, size of screen
RWindow win(TheClient->iWs);
User::LeaveIfError(win.Construct(*TheClient->iGroup->GroupWin(),1));
win.Activate();
// setup cursor mode
TheClient->iWs.SetPointerCursorMode(EPointerCursorWindow);
// setup cursor to contain single 50x50 red bitmap
RWsPointerCursor iCursor1 = RWsPointerCursor(TheClient->iWs);
TSpriteMember member;
SetUpMember(member);
member.iBitmap=&bitmap;
User::LeaveIfError(iCursor1.Construct(0));
User::LeaveIfError(iCursor1.AppendMember(member));
User::LeaveIfError(iCursor1.Activate());
win.SetCustomPointerCursor(iCursor1);
iCursor1.UpdateMember(0);
// draw a green rect, size of screen as defined background and wait till it is rendered
win.BeginRedraw();
TheGc->Activate(win);
TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
TheGc->SetBrushColor(KRgbGreen);
TSize wSize = win.Size();
TheGc->DrawRect(TRect(TPoint(0,0), wSize));
TheGc->Deactivate();
win.EndRedraw();
TheClient->iWs.Finish();
// #### do test ####
// define locations of simulated pointer events and sample positions of where we expect to see the cursor
// The cursor will be moved and a check will be made to see if this has actually happened
TPoint pos1(wSize.iWidth / 2, wSize.iHeight / 2); // top left of cursor at centre screen
TPoint sample1(pos1 + bmSample); // centre of sprite at pos1
TPoint pos2 = pos1 - bmSize; // bottom right of cursor at centre screen
TPoint sample2 = pos2 + bmSample; // centre of sprite at pos2
TRgb pixel;
// check initial state of screen at both sample positions
TheClient->iScreen->GetPixel(pixel, sample1);
TEST(pixel == KRgbGreen);
TheClient->iScreen->GetPixel(pixel, sample2);
TEST(pixel == KRgbGreen);
TRawEvent e; // to simulate pointer events
// simulate button 1 down event at pos1
e.Set(TRawEvent::EButton1Down, pos1.iX, pos1.iY);
e.SetDeviceNumber(screenNumber);
UserSvr::AddEvent(e);
User::After(eventPropagationDelay);
// check red cursor visible on top of background
TheClient->iScreen->GetPixel(pixel, sample1);
TEST(pixel == KRgbRed);
// simulate button 1 up event
e.Set(TRawEvent::EButton1Up, pos1.iX, pos1.iY);
UserSvr::AddEvent(e);
User::After(eventPropagationDelay);
// Move cursor away to pos2
e.Set(TRawEvent::EButton1Down, pos2.iX, pos2.iY);
e.SetDeviceNumber(screenNumber);
UserSvr::AddEvent(e);
//.........这里部分代码省略.........
示例13: RedrawSurfaceL
void CCFbsBitmapAnimation::RedrawSurfaceL()
{
CFbsBitmap bitmap;
User::LeaveIfError(bitmap.Load(iBitmapAnimFile, iFrameCounter));
const TSize nativeSize(bitmap.SizeInPixels());
const TSize fullScreenSize(iFullSurfaceBitmap->SizeInPixels());
if(iPixelFormat == EFormatYuv)
{
TInt noOfPixels=fullScreenSize.iWidth * fullScreenSize.iHeight;
TInt counter=noOfPixels;
TUint32* address = iFullSurfaceBitmap->DataAddress();
for(TInt i=0; i<counter; i++)
{
/* The only supported Yuv format is KPixelFormatYUV422Interleaved */
/* Paint the surface white */
address[i] = 0xFF7FFF7F;
}
}
/* Potentially four screen copies will be required in the wrapping case *
* (1) no wrapping (2) wrap in x co-ord (3) wrap in y co-ord *
* (4) wrap in both x and y co-ords *
* There is no problem with specifying negative co-ordinates for the *
* top LH corner as the offscreen section will not be displayed */
//Perform blits to the fullscreen bitmap
//iAnimSize is the size of the square bitmap as it appears on the surface and iDisplayedSize is the size of the
//rectangulara area limiting the animation
TSize sz = iAnimSize;
if(iPixelFormat == EFormatYuv)
{
sz = TSize(iAnimSize.iWidth/2, iAnimSize.iHeight);
}
iFullSurfaceBitmapGc->DrawBitmap(TRect(TPoint(iXPos, iYPos), sz), &bitmap, TRect(TPoint(0,0), nativeSize));
//Wrap in x co-ord
if( (iXPos + iAnimSize.iWidth) > iSurfaceSize.iWidth)
{
iFullSurfaceBitmapGc->DrawBitmap(TRect(TPoint(iXPos - iSurfaceSize.iWidth, iYPos), sz),
&bitmap, TRect(TPoint(0,0), nativeSize));
}
//Wrap in y co-ord
if( (iYPos + iAnimSize.iHeight) > iSurfaceSize.iHeight)
{
iFullSurfaceBitmapGc->DrawBitmap(TRect(TPoint(iXPos, iYPos - iSurfaceSize.iHeight), sz),
&bitmap, TRect(TPoint(0,0), nativeSize));
}
//Wrap in both x and y co-ords
if( ((iXPos + iAnimSize.iWidth) > iSurfaceSize.iWidth) && ((iYPos + iAnimSize.iHeight) > iSurfaceSize.iHeight) )
{
iFullSurfaceBitmapGc->DrawBitmap(TRect(TPoint(iXPos - iSurfaceSize.iWidth, iYPos - iSurfaceSize.iHeight), sz),
&bitmap, TRect(TPoint(0,0), nativeSize));
}
//Increment x and y positions and wrap if necessary
iXPos += iSurfaceSize.iWidth/iHorizontalRate;
iYPos += iSurfaceSize.iHeight/iVerticalRate;
iXPos = iXPos % iSurfaceSize.iWidth;
iYPos = iYPos % iSurfaceSize.iHeight;
iFrameCounter++;
}
示例14: HandleCommandL
//.........这里部分代码省略.........
myDate.HomeTime();
// Format date according to current locale settings
// Format string is universal, so that whatever the locale is,
// date is always formatted correctly
myDate.FormatL(myBuf, _L("%/0%1%/1%2%/2%3%/3%X"));
// Show formatted text
CAknInformationNote* informationNote = new ( ELeave ) CAknInformationNote;
informationNote->ExecuteLD( myBuf );
}
break;
// Time
case ELocalizationCommandTime:
{
// buffer for localized text
TBuf<50> myBuf;
// Object for datetime data
TTime myTime;
// Set current datetime to object
myTime.HomeTime();
// Format time to current locale
// Format string is universal, so that whatever the locale is,
// time is always formatted correctly
myTime.FormatL(myBuf, _L("%-B%:0%J%:1%T%:2%S%:3%+B"));
// Show formatted text
CAknInformationNote* informationNote = new ( ELeave ) CAknInformationNote;
informationNote->ExecuteLD( myBuf );
}
break;
// Text
case ELocalizationCommandText:
{
// buffer for string parameters that may change order
CDesCArrayFlat* strings = new CDesCArrayFlat( 2 );
CleanupStack::PushL( strings );
// Initialize parameter buffer
// First parameter
strings->AppendL( _L("Heidi") );
// Second parameter
strings->AppendL( _L("2") );
// Load a string from the resource file, and append parameters into it
HBufC* textResource = StringLoader::LoadL( R_LOC_COMMANDTEXT_TEXT, *strings );
CleanupStack::PushL( textResource );
// Show formatted text
CAknInformationNote* informationNote = new ( ELeave ) CAknInformationNote;
informationNote->ExecuteLD( *textResource );
// Cleanupstack
CleanupStack::PopAndDestroy( textResource );
CleanupStack::PopAndDestroy( strings );
}
break;
// Image
case ELocalizationCommandImage:
{
// find the drive where the app has been installed
TParse parse;
parse.Set(Application()->AppFullName(),0,0);
// Load bitmap name from the resource file
HBufC* bmpFile = StringLoader::LoadLC( R_LOC_COMMANDIMAGE_BMPFILE, parse.Drive());
// bitmap pointer
CFbsBitmap* bitmap;
// Create and Load the Bitmap
bitmap = new( ELeave )CFbsBitmap;
CleanupStack::PushL( bitmap );
// Load the first bitmap (index 0) from multi-bitmap file
User::LeaveIfError(bitmap->Load( *bmpFile, 0 ));
CleanupStack::Pop( bitmap );
// Draw bitmap to screen
// ownership of bitmap is transferred to view
iAppView->DrawImage( bitmap );
// Cleanupstack
CleanupStack::PopAndDestroy( bmpFile );
}
break;
// Default case
default:
break;
}
}