// Populates given icon array. Icons are defined in R_GRID_ICONS resource. void CIconsList::SetIconArray( CArrayPtr<CGulIcon>* aIconArray ) { TResourceReader reader; if(iScreenValue == 0) { CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSCREEN_ICONS); } else if(iScreenValue == 1) { CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSUBSCREEN_CONTACTS_ICONS); } else if(iScreenValue == 2) { CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSUBSCREEN_PHOTOS_ICONS); } else if(iScreenValue == 3) { CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSUBSCREEN_VIDEOS_ICONS); } else if(iScreenValue == 4) { CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSUBSCREEN_SMS_ICONS); } TInt numIcons = reader.ReadInt16(); for (TInt count = 0; count < numIcons; ++count) { CEikImage* image = new (ELeave) CEikImage; CleanupStack::PushL(image); //image->ConstructFromResourceL(reader); TBuf<128> imagename = CRippleVaultAppUi::ApplicationDriveAndPath(); imagename.Append(KSmsMbmFileName); image->CreatePictureFromFileL(imagename,0,0); image->SetPictureOwnedExternally(ETrue); CGulIcon* icon = CGulIcon::NewL(const_cast<CFbsBitmap*>(image->Bitmap()), const_cast<CFbsBitmap*>(image->Mask())); CleanupStack::PushL(icon); aIconArray->AppendL(icon); CleanupStack::Pop(icon); CleanupStack::PopAndDestroy(image); } CleanupStack::PopAndDestroy(); // reader }
// --------------------------------------------------------------------------- // CBCTestImageCase::TestLayoutDecorator // --------------------------------------------------------------------------- // void CBCTestImageCase::TestFunctionL() { _LIT( strBitmap,"Class CEikImage Function Bitmap tested" ); _LIT( strConstructFromResourceL,"Class CEikImage Function ConstructFromResourceL tested" ); _LIT( strCreatePictureFromFileL,"Class CEikImage Function CreatePictureFromFileL tested" ); _LIT( strHandlePointerEventL,"Class CEikImage Function HandlePointerEventL tested" ); _LIT( strIsPictureOwnedExternally,"Class CEikImage Function IsPictureOwnedExternally tested" ); _LIT( strMask,"Class CEikImage Function Masktested" ); _LIT( strMinimumSize,"Class CEikImage Function MinimumSize tested" ); _LIT( strSetBitmap,"Class CEikImage Function SetBitmap tested" ); _LIT( strSetBrushStyle,"Class CEikImage Function SetBrushStyle tested" ); _LIT( strSetEmphasis,"Class CEikImage Function SetSetEmphasis tested" ); _LIT( strSetMask,"Class CEikImage Function SetMask tested" ); _LIT( strSetNewBitmaps,"Class CEikImage Function SetNewBitmaps tested" ); _LIT( strSetPicture,"Class CEikImage Function SetPicture tested" ); _LIT( strSetPictureOwnedExternally,"Class CEikImage Function SetPictureOwnedExternally tested" ); _LIT( strWriteInternalStateL,"Class CEikImage Function WriteInternalStateL tested" ); //create hEikImge, hBitmap, hMask CEikImage* hEikImage = new ( ELeave ) CEikImage(); CFbsBitmap* hBitmap = new (ELeave) CFbsBitmap(); CFbsBitmap* hMask = new (ELeave) CFbsBitmap(); hEikImage ->SetBitmap(hBitmap); AssertNotNullL( hEikImage, strSetBitmap ); hEikImage->SetMask(hMask); AssertNotNullL( hEikImage, strSetMask ); hEikImage->Bitmap(); AssertNotNullL( hEikImage, strBitmap ); hEikImage->Mask(); AssertNotNullL( hEikImage, strMask); hEikImage->SetPicture(hBitmap, hMask); AssertNotNullL( hEikImage, strSetPicture); CFbsBitmap* jBitmap = new (ELeave) CFbsBitmap(); CFbsBitmap* jMask = new (ELeave) CFbsBitmap(); hEikImage->SetNewBitmaps(jBitmap, jMask); AssertNotNullL( hEikImage, strSetNewBitmaps); //================================================= hEikImage->SetEmphasis(ETrue); AssertTrueL( ETrue, strSetEmphasis); hEikImage->SetPictureOwnedExternally(ETrue); AssertTrueL( ETrue, strSetPictureOwnedExternally); TBool abool = hEikImage->IsPictureOwnedExternally(); AssertTrueL( ETrue, strIsPictureOwnedExternally); hEikImage->SetBrushStyle(CGraphicsContext::ESolidBrush); AssertTrueL( ETrue, strSetBrushStyle); TPointerEvent pointerEvent; CleanupStack::PushL( hEikImage ); hEikImage->HandlePointerEventL( pointerEvent ); AssertNotNullL( hEikImage,strHandlePointerEventL ); CleanupStack::PopAndDestroy(hEikImage ); hEikImage = NULL; //================================================== CEikImage* jEikImage = new ( ELeave ) CEikImage(); CleanupStack::PushL( jEikImage ); _LIT(KAknResourceFileName, "z:\\resource\\apps\\BCTestImage_Aif.mbm"); jEikImage->CreatePictureFromFileL(KAknResourceFileName, 0); AssertTrueL( ETrue,strCreatePictureFromFileL ); jEikImage->MinimumSize(); AssertTrueL( ETrue, strMinimumSize ); CleanupStack::PopAndDestroy(jEikImage); jEikImage=NULL; //================================================== CEikImage* kEikImage = new ( ELeave ) CEikImage(); CleanupStack::PushL( kEikImage ); TResourceReader reader; CEikonEnv::Static()->CreateResourceReaderLC( reader, R_BCTESTIMAGE_AIMAGE ); kEikImage->ConstructFromResourceL( reader ); AssertTrueL( ETrue,strConstructFromResourceL ); CleanupStack::PopAndDestroy(2, kEikImage); kEikImage=NULL; //================================================== CBCTestImage_pro* testImagePtr = new (ELeave) CBCTestImage_pro(); CleanupStack::PushL(testImagePtr); testImagePtr->testWriteInternalL(); AssertTrueL( ETrue, strWriteInternalStateL); CleanupStack::PopAndDestroy(testImagePtr); testImagePtr=NULL; }
// --------------------------------------------------------------------------- // CBCTestHeadingPaneCase::TestHeadingPaneL // --------------------------------------------------------------------------- // void CBCTestHeadingPaneCase::TestHeadingPaneL() { CEikFormattedCellListBox* listBox = new( ELeave ) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL( listBox ); CAknPopupList* popupList = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_SELECT_BACK, AknPopupLayouts::EPopupSNotePopupWindow ); CleanupStack::PushL( popupList ); AssertNotNullL( popupList, KAknPopupList ); listBox->ConstructL( popupList, EAknListBoxMenuList ); CAknPopupHeadingPane* head = new( ELeave ) CAknPopupHeadingPane(); CleanupStack::PushL( head ); AssertNotNullL( head, KAknPopupHeadingPane ); head->SetContainerWindowL( *iContainer ); TBufC<KFifteen> bufc( KHeading ); TPtrC ptrc = bufc.Des(); // Invoke CAknPopupHeadingPane's ConstructL() head->ConstructL( ptrc ); AssertTrueL( ETrue, KConstructL ); // Invoke CAknPopupHeadingPane's MinimumSize() TSize s = head->MinimumSize(); AssertTrueL( ETrue, KMinimumSize ); // Invoke CAknPopupHeadingPane's HandlePointerEventL() TPointerEvent pointEvent; pointEvent.iType = TPointerEvent::EButton1Down; head->HandlePointerEventL( pointEvent ); AssertTrueL( ETrue, KHandlePointerEventL ); // Invoke CAknPopupHeadingPane's SizeChanged() head->SizeChanged(); AssertTrueL( ETrue, KSizeChanged ); // Invoke CAknPopupHeadingPane's Prompt() head->Prompt(); AssertTrueL( ETrue, KPrompt ); // Invoke CAknPopupHeadingPane's PromptText() head->PromptText(); AssertTrueL( ETrue, KPromptText ); // Invoke CAknPopupHeadingPane's SetTextL() TBufC<KTwenty> otherBufc( KOtherHeading ); TPtrC otherPtrc = otherBufc.Des(); head->SetTextL( otherPtrc ); AssertTrueL( ETrue, KSetTextL ); // Invoke CAknPopupHeadingPane's SetLayout() head->SetLayout( CAknPopupHeadingPane::EListHeadingPane ); AssertTrueL( ETrue, KSetLayout ); // Invoke CAknPopupHeadingPane's SetHeaderImageL() TBuf<KMaxFileName> iconFile; iContainer->GetCoeEnv()->ReadResource( iconFile, R_BCTESTPOPUPS_ICONFILE ); CEikImage* image = new( ELeave ) CEikImage; CleanupStack::PushL( image ); // image CFbsBitmap* bitmap = NULL; CFbsBitmap* bitmapM = NULL; AknIconUtils::CreateIconL( bitmap, bitmapM, iconFile, EMbmBctestpopupsTel, EMbmBctestpopupsTelm ); CleanupStack::PushL( bitmap ); // bitmap CleanupStack::PushL( bitmapM ); // bitmap mask image->SetPictureOwnedExternally( TBool( 0 ) ); image->SetPicture( bitmap, bitmapM ); head->SetHeaderImageL( image ); AssertTrueL( ETrue, KSetHeaderImageL ); CleanupStack::Pop( bitmapM ); CleanupStack::Pop( bitmap ); CleanupStack::Pop( image ); // Invoke CAknPopupHeadingPane's SetSkinFrameId() TAknsItemID aknsItemID; head->SetSkinFrameId( aknsItemID ); AssertTrueL( ETrue, KSetSkinFrameId ); // Invoke CAknPopupHeadingPane's SetSkinFrameCenterId() head->SetSkinFrameCenterId( aknsItemID ); AssertTrueL( ETrue, KSetSkinFrameCenterId ); // Invoke CAknPopupHeadingPane's SetHeaderAnimationL() head->SetHeaderAnimationL( R_BCTESTPOPUPS_BITMAP_ANIMATION ); AssertTrueL( ETrue, KSetHeaderAnimationL ); // Invoke CAknPopupHeadingPane's StartAnimationL() head->StartAnimationL(); AssertTrueL( ETrue, KStartAnimationL ); // Invoke CAknPopupHeadingPane's CancelAnimation() head->CancelAnimation(); AssertTrueL( ETrue, KCancelAnimation ); CleanupStack::PopAndDestroy( head ); head = NULL; head = new( ELeave ) CAknPopupHeadingPane(); CleanupStack::PushL( head ); // Invoke CAknPopupHeadingPane's ConstructFromResourceL() TResourceReader reader; iContainer->GetCoeEnv()->CreateResourceReaderLC( reader, R_BCTESTPOPUPS_AVKON_HEADING ); head->ConstructFromResourceL( reader ); AssertTrueL( ETrue, KConstructFromResourceL ); CleanupStack::PopAndDestroy(); //reader CleanupStack::PopAndDestroy( head ); CleanupStack::PopAndDestroy( popupList ); CleanupStack::PopAndDestroy( listBox ); delete image; }