Exemplo n.º 1
0
/**
 * Draws the icon for the item to the graphics context aGc, in the middle of the rectangle aRect
 */
EXPORT_C void LafMenuPaneItem::DrawIcon(const MLafEnv& /*aLafEnv*/, const CCoeControl& /*aMenuPane*/, CWindowGc& aGc, const TRect& aRect, const CGulIcon* aIcon, SLafMenuPane::THighlightType aHighlightType)
	{
	if (aIcon)
		{
		if (aHighlightType == SLafMenuPane::EDrawHighlight)
			aGc.SetBrushStyle(CGraphicsContext::ENullBrush);

		// Determine the rect available for the bitmap
		TRect rect = aRect;
		// put the image in the middle of available rect
		const CFbsBitmap* bitmap = aIcon->Bitmap();
		const TSize bmpSize(bitmap->SizeInPixels());
		const TSize rectSize(aRect.Size());
		const TPoint offset(((rectSize.iWidth - bmpSize.iWidth) / 2), ((rectSize.iHeight - bmpSize.iHeight) / 2));
		const CFbsBitmap* mask = aIcon->Mask();
		if (mask)
			{
			const TRect bmpRect(0, 0, bmpSize.iWidth, bmpSize.iHeight);
			aGc.BitBltMasked(rect.iTl+offset, bitmap, bmpRect, mask, ETrue);
			}
		else
			aGc.BitBlt(rect.iTl+offset, bitmap);
		if (aHighlightType == SLafMenuPane::EDrawHighlight)
			aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
		}
	}
Exemplo n.º 2
0
EXPORT_C TBool AknsDrawUtils::DrawFramePart( MAknsSkinInstance* aInstance,
    CWindowGc& aGc, const TRect& aRect, const TAknsItemID& aFrameID,
    const TAknsFrameElementIndex aFrameElement )
    {
    if( !aInstance )
        {
        return EFalse;
        }

    CAknsImageTableItemData* data = static_cast<CAknsImageTableItemData*>(
        aInstance->GetCachedItemData( aFrameID, EAknsITImageTable ) );
    if( data && (data->NumberOfImages()==EAknsFrameElementsN) )
        {
        aGc.SetPenStyle(CGraphicsContext::ENullPen);
        aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);

        TBool retVal = CheckAndDrawCachedImage( aInstance, aGc, aRect,
            data->ImageIID( aFrameElement ), KAknsDrawParamDefault );

        aGc.SetPenStyle(CGraphicsContext::ESolidPen);
        aGc.SetBrushStyle(CGraphicsContext::ENullBrush);

        return retVal;
        }

    return EFalse;
    }
Exemplo n.º 3
0
/**
 * Prepares the graphics context aGc according of aHighlightType before drawing an item. At the
 * same time it determines and returns the text color to be used during the drawing of all components
 * of an item.
 */
EXPORT_C void LafMenuPane::PrepareGcForHighlight(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TItemAttributes& aItemAttributes)
	{
	TRgb textColor = aLafEnv.ControlColor(EColorMenuPaneText, aMenuPane); //KEikMenuPaneTextColor;
	switch (aItemAttributes.iHighlightType)
		{
	case SLafMenuPane::EDrawHighlight:
		aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
		textColor = aLafEnv.ControlColor(EColorMenuPaneTextHighlight, aMenuPane);
		if (aMenuPane.IsFocused())
			{
			aGc.SetBrushColor(aLafEnv.ControlColor(EColorMenuPaneHighlight, aMenuPane));
			if (aItemAttributes.iFlags&EEikMenuItemDimmed)
				textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedTextHighlight, aMenuPane);
			}
		else
			{
			aGc.SetBrushColor(aLafEnv.ControlColor(EColorMenuPaneDimmedHighlight, aMenuPane));
			textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedTextHighlight, aMenuPane);
			}
		break;
	case SLafMenuPane::ERemoveHighlight:
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
		if (aItemAttributes.iFlags&EEikMenuItemDimmed)
			textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedText, aMenuPane);
		break;
	case SLafMenuPane::ENoHighlight:
		aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
		if (aItemAttributes.iFlags&EEikMenuItemDimmed)
			textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedText, aMenuPane);
		break;
	default:
		break;
		}
	aGc.SetPenColor(textColor);
	}
Exemplo n.º 4
0
//Background drawing function
void CTestRectGc::Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const
	{		
		if (iBmpBackground) 
		{
						
			TPoint a = PositionRelativeToScreen();
			TPoint b = aControl.PositionRelativeToScreen();

			//The source rect of the background is the relationship between this control and the control being drawn (child)
			//plus the subrect (aRect) to be drawn.
			TRect SourceRect(b-a+aRect.iTl, aRect.Size());

			aGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
			aGc.BitBlt(aRect.iTl, iBmpBackground, SourceRect);			
			aGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
		}
		else
		{
			TRect rc;
			aGc.SetClippingRect(aRect);
			aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    		aGc.SetBrushColor(iBrushColor);
    		aGc.SetBrushStyle(iBrushStyle);
			aGc.DrawRect(rc);
			aGc.CancelClippingRect();

		}		
	}
Exemplo n.º 5
0
/** Sets the brush settings for the specified graphics context. 

If iBitmap is set, it sets this as the brush pattern and sets the brush style 
to EPatternedBrush. Otherwise, it sets the brush style and brush colour using 
the values of iBrushStyle and iBrushColor.

@param aGc The graphics context to set. */
EXPORT_C void MCoeControlBrushContext::PrepareContext(CWindowGc& aGc) const
	{
	if (iBitmap)
		{
		aGc.UseBrushPattern(iBitmap);
		aGc.SetBrushStyle(CGraphicsContext::EPatternedBrush);
		return;
		}
	aGc.SetBrushStyle(iBrushStyle);
	aGc.SetBrushColor(iBrushColor);
	}
static void DrawIconL(CWindowGc& aGc, CGulIcon& aIcon, const TJuikLayoutItem& aL, TBool aDoCenter=ETrue) 
{
	CALLSTACKITEMSTATIC_N(_CL(""), _CL("DrawIconL"));
	CFbsBitmap* bmp = aIcon.Bitmap();
	CFbsBitmap* mask = aIcon.Mask();
	
	aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
	// center 
	TInt bmpW = bmp->SizeInPixels().iWidth;
	TInt areaW = aL.Size().iWidth;
	
	TInt dx = 0;
	TInt dy = 0;
	if ( aDoCenter && bmpW < areaW )
		{
			dx = (areaW - bmpW) / 2;
		}


	TPoint tl = aL.TopLeft();
	tl += TPoint(dx,dy);
	TRect r(TPoint(0,0), bmp->SizeInPixels());
 	if ( mask )
 		{
 			aGc.BitBltMasked( tl, bmp, r, mask, ETrue);
 		}
 	else
 		{
			aGc.BitBlt( tl, bmp, r);
  		}
}
Exemplo n.º 7
0
/**
 * Draws visual feedback for a menu item to indicate that it has been selected. This is shown for
 * the brief interval between the item being selected and the menu being dismissed. Uses the
 * environment aLafEnv for setting up the context aGc for the menu pane aMenuPane and draws inside
 * the item rectangle aRect.
 *
 * @since App-Framework_6.1
 */
EXPORT_C void LafMenuPane::DrawVisualFeedback(const MLafEnv& /*aLafEnv*/, const CCoeControl& /*aMenuPane*/,
												CWindowGc& aGc, const TRect& aRect)
	{
	aGc.SetPenColor(KRgbBlack);
	aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
	aGc.DrawRect(aRect);
	}
Exemplo n.º 8
0
/**
  Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
  Sets the brush style to Solid Brush and Pen Style to Null Pen.\n
  Sets the brush colour to Blue and paints an ellipse on  the control.\n
*/
void CConeBackgroundTestDrawer2::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
	{
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	aGc.SetBrushColor(TRgb(0x0000ff));
	aGc.DrawEllipse(aRect);
	}
Exemplo n.º 9
0
/**
  Draw function for the CCtlBase class.\n
  
*/	
void CCtlBase::DoDraw( CWindowGc& aGc, TRect aRect ) const
	{
	aGc.DrawRect( aRect ) ;
	aRect.Shrink( 1, 1 ) ;
	aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
	aGc.DrawRect( aRect ) ;
	WriteName( aGc, *iName ) ;
	}
Exemplo n.º 10
0
/**
 * Prepares the graphics context aGc for drawing the items by setting the pen and brush.
 */
EXPORT_C void LafMenuPane::PrepareGcForDrawingItems(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc)
	{
	const CFont* font = NormalFont(aLafEnv);
	aGc.UseFont(font);
	aGc.SetPenColor(aLafEnv.ControlColor(EColorMenuPaneText, aMenuPane));
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	aGc.SetBrushColor(aLafEnv.ControlColor(EColorMenuPaneBackground, aMenuPane));
	}
Exemplo n.º 11
0
/**
  Writes the text "aText" on the control.\n
  Sets the font,pen colour,brush style used for writing the text.\n
  Draws the text uisng Draw Text function of Graphics context.\n
*/	
void CCtlBase::WriteName( CWindowGc& aGc, const TDesC& aText ) const 
	{
    TRect rect = Rect() ;
    rect.Shrink( 3, 3 ) ;
    aGc.UseFont( iFont ) ;
    TInt ascent = ( rect.iBr.iY - rect.iTl.iY-iFont->HeightInPixels() ) / 2 + iFont->AscentInPixels() ;
    aGc.SetPenColor( KRgbBlack ) ;
    aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
    aGc.DrawText( aText, rect, ascent, CGraphicsContext::ECenter ) ;	
	}
Exemplo n.º 12
0
/**
  Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
  Sets the background style for Drawing.\n
  1. if aStyle is zero , the brush style is EVerticalHatchBrush.\n
  2. if aStyle is one , the brush style is EForwardDiagonalHatchBrush.\n
  3. if aStyle is two , the brush style is EHorizontalHatchBrush.\n
  4. if aStyle is three , the brush style is ERearwardDiagonalHatchBrush.\n
  Sets the brush colour to Red and paints the top left part of the control.\n
  Sets the brush colour and points the bottom right part of the control.\n
*/
void CConeBackgroundTestDrawer0::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
	{
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	aGc.SetBrushColor(TRgb(0xffffff));
	aGc.Clear();

	switch (iBgStyle)
		{
		case 0:
			aGc.SetBrushStyle(CGraphicsContext::EVerticalHatchBrush);
			break;
			
		case 1:
			aGc.SetBrushStyle(CGraphicsContext::EForwardDiagonalHatchBrush);
			break;
			
		case 2:
			aGc.SetBrushStyle(CGraphicsContext::EHorizontalHatchBrush);
			break;
			
		case 3:
			aGc.SetBrushStyle(CGraphicsContext::ERearwardDiagonalHatchBrush);
			break;
		}

	aGc.SetPenColor(TRgb(0xff0000));
	aGc.DrawRect(aRect);
	
	TRect tlRect = aRect;
	tlRect.iBr.iX = (tlRect.iBr.iX - tlRect.iTl.iX)/2 + tlRect.iTl.iX;
	tlRect.iBr.iY = (tlRect.iBr.iY - tlRect.iTl.iY)/2 + tlRect.iTl.iY;
	
	aGc.SetBrushColor(TRgb(0xff00ff));
	aGc.DrawRect(tlRect);
	
	TRect brRect = tlRect;
	brRect.Move(tlRect.Width(), tlRect.Height());
	aGc.SetBrushColor(TRgb(0x00ff00));
	aGc.DrawRect(brRect);
	}
Exemplo n.º 13
0
/**
  Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
  Sets the brush style to Solid Brush and Pen Style to Null Pen.\n
  Sets the brush colour to Red and paints the top left part of the control.\n
  Sets the brush colour and points the bottom right part of the control.\n
*/
void CConeBackgroundTestDrawer1::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
	{
	
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	
	TRect tlRect = aRect;
	tlRect.iBr.iX = (tlRect.iBr.iX - tlRect.iTl.iX)/2 + tlRect.iTl.iX;
	tlRect.iBr.iY = (tlRect.iBr.iY - tlRect.iTl.iY)/2 + tlRect.iTl.iY;
	
	aGc.SetBrushColor(TRgb(0xff0000));
	aGc.DrawRect(tlRect);
	
	TRect brRect = tlRect;
	brRect.Move(tlRect.Width(), tlRect.Height());
	aGc.SetBrushColor(TRgb(0x00ff00));
	aGc.DrawRect(brRect);
	}
Exemplo n.º 14
0
void MainL()	
	{	
	RWsSession ws;
	ws.Connect();
 	CWsScreenDevice* scr = new(ELeave) CWsScreenDevice(ws);
	scr->Construct();
 	CWindowGc* gc = new(ELeave) CWindowGc(scr);
	gc->Construct();
 	RWindowGroup grp(ws);
	grp.Construct(0xc0decafe, ETrue);
 	RWindow win(ws);
	win.Construct(grp, 0xbeefcafe);
	win.SetExtent(TPoint(20,160), TSize(320,240));
	win.Activate();
 	win.Invalidate();
	win.BeginRedraw();
	gc->Activate(win);
 	gc->SetPenStyle(CGraphicsContext::ENullPen);
	gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
 	TBool color = EFalse;

if (Profiler::Start() == KErrNotFound)
	{
	_LIT(KProfiler,"profiler");
	_LIT(KStart,"start -noui -drive=S");
	RProcess p;
	if (p.Create(KProfiler,KStart) == KErrNone)
		{
		p.Resume();
		p.Close();
		}
	}

	for (TInt col=0; col<KCol; ++col)
		{
		color = !color;		
		for (TInt row=0; row<KRow; ++row)
			{
			TRect rect;
			rect.iTl.iX = col * KSize.iWidth;
			rect.iTl.iY = row * KSize.iHeight;
			rect.SetSize(KSize);
			color = !color;
			gc->SetBrushColor(color? KRgbBlue : KRgbBlack);
			gc->DrawRect(rect);
			}
	}
	
	
	
	gc->Deactivate();
	win.EndRedraw();
	ws.Flush();
 	User::After(3000000);
 	win.Close();
	grp.Close();
	delete gc;
	delete scr;
	ws.Close();

	Profiler::Stop();
	Profiler::Close();
	Profiler::Unload();

	} 
Exemplo n.º 15
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTraceContainer::PieDrawer(CWindowGc& aGc, TPoint aLeftTop, TInt aSize, TInt aProsentages, const TBool& aReverceColor) const
{
	TBuf<50> Buffer;
	Buffer.Num(aProsentages);
	Buffer.Append(_L("%"));

	aGc.SetPenColor(KRgbBlack);
	
	if(aReverceColor)
		aGc.SetBrushColor(KRgbGreen);
	else
		aGc.SetBrushColor(KRgbRed);
	
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	aGc.DrawEllipse(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize));

	if(aProsentages < 0)
	{
		Buffer.Copy(_L("N/A"));
		
		if(aReverceColor)
			aGc.SetBrushColor(KRgbGreen);
		else
			aGc.SetBrushColor(KRgbRed);
	}
	else
	{
		TInt HelpPie = 0;
		
		if(aReverceColor)
			aGc.SetBrushColor(KRgbRed);
		else
			aGc.SetBrushColor(KRgbGreen);

		TInt Angle =((aProsentages * 360) / 100);

		if(Angle == 360)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),aLeftTop,aLeftTop);
		}
		else if(Angle == 45)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX,aLeftTop.iY));
		}
		else if(Angle == 135)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX,aLeftTop.iY + aSize));
		}
		else if(Angle == 225)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX + aSize,aLeftTop.iY + aSize));
		}
		else if(Angle == 315)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX + aSize,aLeftTop.iY));
		}
		else if(Angle > 45 && Angle < 135)
		{				
			HelpPie = ((((Angle - 45) * aSize) / 90) + aLeftTop.iY);
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX,HelpPie));
		}
		else if(Angle > 135 && Angle < 225)
		{
			HelpPie = ((((Angle - 135) * aSize) / 90) + aLeftTop.iX);
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(HelpPie,aLeftTop.iY + aSize));
		}
		else if(Angle > 225 && Angle < 315)
		{
			HelpPie = (((aLeftTop.iY + aSize) - ((Angle - 225) * aSize) / 90));
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX + aSize,HelpPie));
		}
		else if(Angle > 0 && Angle < 45)
		{
			HelpPie = (((aLeftTop.iX + (aSize/2)) - ((Angle) * (aSize/2)) / 45));
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(HelpPie,aLeftTop.iY));
		}
		else if(Angle > 315 && Angle < 360)
		{
			HelpPie = (((aLeftTop.iX + aSize) - ((Angle - 315) * (aSize/2)) / 45));
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(HelpPie,aLeftTop.iY));
		}

		if(aReverceColor)
		{
			if(Angle > 180)
				aGc.SetBrushColor(KRgbGreen);
			else	
				aGc.SetBrushColor(KRgbRed);
		}
		else
		{
			if(Angle > 180)
				aGc.SetBrushColor(KRgbRed);
			else	
				aGc.SetBrushColor(KRgbGreen);
		}		
	}

	const CFont* MuFonr = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);

	TInt TextHeight= MuFonr->HeightInPixels();
	TInt TextWidth = MuFonr->TextWidthInPixels(Buffer);

	TInt StartX = (aLeftTop.iX + ((aSize - TextWidth) / 2));
	TInt StartY = (aLeftTop.iY + ((aSize - TextHeight) / 2));

	aGc.UseFont(MuFonr);
	aGc.SetPenColor(KRgbBlack);
	aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
	
	aGc.DrawText(Buffer,TRect(StartX,StartY,StartX + TextWidth,StartY + TextHeight),MuFonr->AscentInPixels(), CGraphicsContext::ELeft, 0);			

	aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
}
Exemplo n.º 16
0
// -----------------------------------------------------------------------------
// AknsDrawUtils::BackgroundBetweenRects()
// (commented in the header).
// -----------------------------------------------------------------------------
//
EXPORT_C TBool AknsDrawUtils::BackgroundBetweenRects(
    MAknsSkinInstance* aInstance, MAknsControlContext* aContext,
    const CCoeControl* aControl, CWindowGc& aGc,
    const TRect& aOuterRect,const TRect& aInnerRect, const TInt aDrawParam )
    {
    TInt drawParam = aDrawParam;
    TInt originalParam = aDrawParam;
    TBool retVal = EFalse;
    TBool blitFailed = EFalse;
    TBool blitAttempted = EFalse;

    if ( !&aGc )
        {
        return retVal;
        }

    MAknsControlContext* parentContext = GetParentContext( aContext );
    if( parentContext )
        {
        retVal = BackgroundBetweenRects( aInstance, parentContext, aControl, aGc,
            aOuterRect, aInnerRect, aDrawParam );
        drawParam |= KAknsDrawParamNoClearUnderImage;
        }
    else if( drawParam & KAknsDrawParamBottomLevelRGBOnly )
        {
        drawParam |= KAknsDrawParamRGBOnly;
        }

    originalParam = drawParam;

    if( aContext )
        {
        aContext->UpdateContext();
        }

    TAknsBackground* bgLayout = RetrieveBackgroundLayout( aContext );

    TAknsItemID imgIID( KAknsIIDNone );
    CAknsImageItemData* imgData = RetrieveBackgroundImage(
        aInstance, bgLayout, imgIID );

    // chained background
    if (imgData && imgData->ParentIID() != KAknsIIDNone)
        {
        TAknsItemID parentiid = imgData->ParentIID();
        TRect parentDrawRect = imgData->DrawRect();

        imgData = RetrieveKnownBackgroundImage(
            aInstance, parentiid );
        if (imgData)
            {
            imgData->SetDrawRect(parentDrawRect);
            drawParam |= KAknsDrawParamChained ;
            }
        }

    TPoint paDelta = GetParentAbsoluteDelta( bgLayout, aControl );

    if (!(aDrawParam & KAknsDrawParamPrepareOnly))
        {
        aGc.SetPenStyle(CGraphicsContext::ENullPen);
        aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
        }

    TBool blit = EFalse;
    //Rect for frame border
    TRect rlist[4];
    rlist[0] = aOuterRect;
    rlist[0].iBr.iY=aInnerRect.iTl.iY;
    rlist[1] = rlist[0];
    rlist[1].iBr.iY=aOuterRect.iBr.iY;
    rlist[1].iTl.iY=aInnerRect.iBr.iY;
    rlist[2] = aInnerRect;
    rlist[2].iTl.iX=aOuterRect.iTl.iX;
    rlist[2].iBr.iX=aInnerRect.iTl.iX;
    rlist[3] = rlist[2];
    rlist[3].iTl.iX=aInnerRect.iBr.iX;
    rlist[3].iBr.iX=aOuterRect.iBr.iX;
    if( imgData )
        {        
        blitAttempted = ETrue;
        for ( TInt i=0; i <4 ; i++ )
            {
            if( (drawParam & KAknsDrawParamNoClearUnderImage) == 0 )
                {            
                blit = BlitAndClear( aInstance, aGc, rlist[i],
                        imgData, imgIID, bgLayout, paDelta, drawParam );
                }
            else
                {
                blit = Blit( aInstance, aGc, rlist[i],
                        imgData, imgIID, bgLayout, paDelta, drawParam );
                }
            if ( !blit )
                {
                blitFailed = ETrue;
                }
            }
        }
    else
        {
        if( !(drawParam & KAknsDrawParamNoClearUnderImage) &&
            !(drawParam & KAknsDrawParamPrepareOnly) )
            {
            // Clear only if permitted
            for (TInt i=0; i<4; i++)
                {
                aGc.DrawRect(rlist[i]);
                }
            }
        }

    if( bgLayout )
        {
        TAknsBackground* nextLayout = bgLayout->iNext;
        while( nextLayout && (drawParam!=KAknsDrawParamLimitToFirstLevel) )
            {
            imgData = RetrieveKnownBackgroundImage( aInstance,
                nextLayout->iImageID );
            if (imgData && imgData->ParentIID() != KAknsIIDNone)
                {
                TAknsItemID parentiid = imgData->ParentIID();
                TRect parentDrawRect = imgData->DrawRect();

                imgData = RetrieveKnownBackgroundImage(
                aInstance, parentiid );
                if (imgData)
                    {
                    imgData->SetDrawRect(parentDrawRect);
                    drawParam |= KAknsDrawParamChained;
                    }
                }
            else
                {
                drawParam=originalParam;
                }

            if( imgData )
                {                
                blitAttempted = ETrue;
                for ( TInt i=0; i < 4; i++ )
                    {
                    blit = Blit( aInstance, aGc, rlist[i], imgData,
                            nextLayout->iImageID, nextLayout, paDelta, drawParam );
                    if ( !blit )
                        {
                        blitFailed = ETrue;
                        }
                    }
                }

            nextLayout = nextLayout->iNext;
            }
        }

    if (!(aDrawParam & KAknsDrawParamPrepareOnly))
        {
        aGc.SetPenStyle(CGraphicsContext::ESolidPen);
        aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
        }

    if ( blitFailed )
        {
        retVal = EFalse;
        }
    else if ( !retVal )
        {
        retVal = blitAttempted;
        }

    return retVal;
    }