// ---------------------------------------------------------------------------- // CAknExQueryContainer::SetIconL() // Set Icon dynamically // ---------------------------------------------------------------------------- void CAknExQueryContainer::SetIconL( CAknQueryDialog* aDlg, TInt32 aBitmap, TInt32 aMask ) { CEikImage* image = new ( ELeave ) CEikImage(); CleanupStack::PushL( image ); CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL( KAknExQueryMbmFilePath, aBitmap ); CleanupStack::PushL( bitmap ); CFbsBitmap* mask = iEikonEnv->CreateBitmapL( KAknExQueryMbmFilePath, aMask ); CleanupStack::PushL( mask ); image->SetBitmap( bitmap ); image->SetMask( mask ); CleanupStack::Pop( 2 ); //mask and bitmap aDlg->QueryHeading()->SetHeaderImageL( image ); CleanupStack::PopAndDestroy(); //image }
// --------------------------------------------------------------------------- // 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; }