Exemplo n.º 1
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.º 2
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.º 3
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.º 4
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.º 5
0
/**
 * Draws the joints between menu pane and menu pane title into the graphics
 * context aGc, in the rectangle aRect.
 */
EXPORT_C void LafMenuPane::DrawTitlePaneJoint(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const CCoeControl* aMenuPaneTitle, const TRect& aInnerRect)
	{
	PrepareGcForDrawingItems(aLafEnv, aMenuPane, aGc);
    aGc.SetPenStyle(CGraphicsContext::ENullPen);
    aGc.DrawRect(aInnerRect);
	if (aMenuPaneTitle)
		{// pane has title, so make sure they are joined up correctly
		const TPoint titlePos = aMenuPaneTitle->Position();
		const TInt width = aMenuPaneTitle->Size().iWidth;
		const TPoint position = aMenuPane.Position();

		// left straight join
		aGc.SetPenStyle(CGraphicsContext::ESolidPen);
		aGc.SetPenColor(aLafEnv.ControlColor(EColorMenuPaneBackground, aMenuPane));
		// get rid of the gray bit of border
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+5,4),TPoint(titlePos.iX-position.iX+width-5,4));
		// get rid of the black bit of border
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+4,0),TPoint(titlePos.iX-position.iX+width-4,0));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+4,1),TPoint(titlePos.iX-position.iX+width-4,1));

		aGc.DrawLine(TPoint(titlePos.iX-position.iX+5,4),TPoint(titlePos.iX-position.iX+width-5,4));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,0),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),0));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,1),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),1));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,2),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),2));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,3),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),3));

		// draw in black line seperator
		aGc.SetPenColor(KRgbBlack);
		aGc.DrawLine(TPoint(titlePos.iX-position.iX +MenuPaneSeparatorMargin(),0),TPoint(titlePos.iX-position.iX+width-3-MenuPaneSeparatorMargin(),0));

		TGulBorder::TColors borderColors;
		GetBorderColors(borderColors, aLafEnv, *aMenuPaneTitle);

		aGc.SetPenColor(borderColors.iMidlight);
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+1,0),TPoint(titlePos.iX-position.iX+4,0));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+1,1),TPoint(titlePos.iX-position.iX+4,1));

		if (aMenuPaneTitle->Rect().iBr.iX==aMenuPane.Rect().iBr.iX)
			{// right straight join
			aGc.SetPenColor(borderColors.iMid);
			aGc.DrawLine(TPoint(aInnerRect.iBr.iX,0),TPoint(aInnerRect.iBr.iX,5));
			aGc.DrawLine(TPoint(aInnerRect.iBr.iX+1,0),TPoint(aInnerRect.iBr.iX+1,4));
			aGc.DrawLine(TPoint(aInnerRect.iBr.iX+2,0),TPoint(aInnerRect.iBr.iX+2,3));
			}
		else
			{// right corner join
			TInt xPos=titlePos.iX-position.iX+width-4;
			aGc.SetPenColor(borderColors.iMid);
			aGc.DrawLine(TPoint(xPos,0),TPoint(xPos,4));
			aGc.DrawLine(TPoint(xPos+1,0),TPoint(xPos+1,3));
			aGc.DrawLine(TPoint(xPos+2,0),TPoint(xPos+2,2));
			}
		}
	}
Exemplo n.º 6
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.º 7
0
/**
 * Draws the left adornment to the graphics context aGc, in the rectangle aRect. The menu pane
 * flags determines the type of adornment to be drawn.
 */
EXPORT_C void LafMenuPane::DrawLeftAdornment(const MLafEnv& aLafEnv, const CCoeControl& /*aMenuPane*/, CWindowGc& aGc, const TRect& aRect, const TItemAttributes& aItemAttributes)
	{
// Brush the background of the rect.
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	aGc.DrawRect(aRect);
	aGc.SetPenStyle(CGraphicsContext::ESolidPen);
	const TInt itemFlags = aItemAttributes.iFlags;
	if (itemFlags&EEikMenuItemSymbolOn)
		{
		if (itemFlags&EEikMenuItemCheckBox)
			{
			TRect rect = aRect;
			rect.iTl.iY += aItemAttributes.iBaseLine;
			TBuf<1> buf;
			buf.Append(TChar(ESymFontTick));
			aGc.UseFont(SymbolFont(aLafEnv));
			aGc.SetPenStyle(CGraphicsContext::ESolidPen);
			// as the tick is big, ignore KPreLeftAdornment and steal 1 pixels from left.
			aGc.DrawText(buf,TPoint(rect.iTl.iX-1, rect.iTl.iY));
			aGc.UseFont(NormalFont(aLafEnv));
			}
		else if (itemFlags&KLafMenuItemRadio)
			{
			TUid bmpUid(TUid::Uid(KLafUidEikonOptiVal));
			const CFbsBitmap* bitmap = aLafEnv.Bitmap(bmpUid);
			TSize bitsize = bitmap->SizeInPixels();
			TRect butRect(TPoint(0,0), TPoint(bitsize.iWidth,bitsize.iHeight));
			TInt yoffset = (aRect.Size().iHeight - bitsize.iHeight) / 2;
			TInt xoffset = KLafPreLeftAdornmentSpace;
			TPoint offset(xoffset,yoffset);
			if (aItemAttributes.iHighlightType == SLafMenuPane::EDrawHighlight)
				{
				bmpUid=TUid::Uid(KLafUidEikonOptihVal);
				bitmap = aLafEnv.Bitmap(bmpUid);
				}
			bmpUid=TUid::Uid(KLafUidEikonOptimVal);
			const CFbsBitmap* mask = aLafEnv.Bitmap(bmpUid);
			aGc.BitBltMasked((aRect.iTl+offset), bitmap, butRect, mask,ETrue);
			}
		}
	}
Exemplo n.º 8
0
/**
 * Draws the cascade symbol into the graphics context aGc, in the rectangle aRect and sets
 * the pen color depending on whether the menu item is dimmed or focused.
 */
EXPORT_C void LafMenuPane::DrawRightAdornment(const MLafEnv& aLafEnv, const CCoeControl& /*aMenuPane*/, CWindowGc& aGc, const TRect& aRect, const TItemAttributes& aItemAttributes)
	{
	const TInt cascadeSize=Min(KLafRightAdornmentSpace,aItemAttributes.iHeight);

// Brush the background of the rect.
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	aGc.DrawRect(aRect);
	aGc.SetPenStyle(CGraphicsContext::ESolidPen);
	if (aItemAttributes.iInternalFlags&EMenuIsRightAdornment)
		{
		//Sort out rect for cascade symbol
		TRect cascadeRect=TRect(TPoint(aRect.iBr.iX-cascadeSize-PostRightAdornmentSpace(),aItemAttributes.iHPosition),
					TSize(cascadeSize,aItemAttributes.iHeight));
		cascadeRect.iTl.iY+=((aItemAttributes.iHeight-cascadeSize)/2);
		cascadeRect.iBr.iY-=((aItemAttributes.iHeight-cascadeSize)/2);
		TBuf<1> cascade;
		cascade.Append(TChar(ESymFontMenuCascade));
		aGc.UseFont(SymbolFont(aLafEnv));
		aGc.DrawText(cascade,cascadeRect,cascadeRect.Height(),CGraphicsContext::ERight);
		aGc.UseFont(NormalFont(aLafEnv));
		}
	}
Exemplo n.º 9
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();

	} 
void CWelcomePageBase::DrawRectL(CWindowGc& aGc, const TRgb& aColor, const TJuikLayoutItem& aL) const
{
	aGc.SetBrushColor( aColor );
	aGc.DrawRect( aL.Rect() );	
}
Exemplo n.º 11
0
// -----------------------------------------------------------------------------
// TRectangle::Draw() const
// Virtual method that draws the shape to the specified graphics context.
// -----------------------------------------------------------------------------
//
EXPORT_C void TRectangle::Draw( CWindowGc& aActiveGraphicsContext ) const
    {
    aActiveGraphicsContext.DrawRect( GetRect() );
    }
Exemplo n.º 12
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;
    }