Пример #1
0
// 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
	
}
Пример #2
0
// ---------------------------------------------------------------------------
// 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;
    }