コード例 #1
0
ファイル: LAFMENUP.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
 * 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));
			}
		}
	}
コード例 #2
0
ファイル: LAFMENUP.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
 * 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);
	}
コード例 #3
0
void CCalendarManagerContainer::DrawCurrentDay(CWindowGc& gc, MAknsSkinInstance* p_BgSkin, const TRgb& p_Default_Select_Color, const CFont& p_Font) const
	{
	TInt i_Col = (g_CalendarClass->g_SelectDay + g_CalendarClass->g_FirstWeek - 1) % 7 + 2;
	TInt i_Row = (g_CalendarClass->g_SelectDay + g_CalendarClass->g_FirstWeek - 1) / 7 + 1;
	
	TInt i_Pos_X = (i_Col - 1) * g_Space_X + i_Col - 1;
	TInt i_Pos_Y = (i_Row - 1) * g_Space_Y + (i_Row - 1) * 2 + g_Pos_Y;
		
	TRect i_OuterRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X + 1, i_Pos_Y + g_Space_Y + 2);
	i_OuterRect.Shrink(2, 2);
	TRect i_InnerRect(i_OuterRect);
	i_InnerRect.Shrink(4, 4);
	
	AknsDrawUtils::DrawFrame(p_BgSkin, gc, i_OuterRect, i_InnerRect, KAknsIIDQsnFrList, KAknsIIDQsnFrListCenter);
	
	gc.SetPenColor(p_Default_Select_Color);
	TBuf<5> i_Num;
	i_Num.AppendNum(g_CalendarClass->g_SelectDay);	
	
	if (g_CalendarClass->g_SelectYear == g_CalendarClass->g_Year && g_CalendarClass->g_SelectMonth == g_CalendarClass->g_Month && g_CalendarClass->g_SelectDay == g_CalendarClass->g_Day)		
		gc.SetUnderlineStyle(EUnderlineOn);		
	else				
		gc.SetUnderlineStyle(EUnderlineOff);
				
	gc.DrawText(i_Num, TRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X, i_Pos_Y + g_Space_Y), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels() + 1, CGraphicsContext::ECenter, 0);	
	}
コード例 #4
0
ファイル: LAFMENUP.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
 * 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);
	}
コード例 #5
0
ファイル: Custom.cpp プロジェクト: huellif/symbian-example
void CSmiley::DrawFace(CWindowGc &aGc) const
	{
	// Draw the smiley face, smiling or looking sad
	aGc.SetPenColor(KRgbBlack);
	// Draw a circle for the face
	aGc.DrawEllipse(iSmileyRect);
	}
コード例 #6
0
ファイル: LAFMENUP.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
 * 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));
	}
コード例 #7
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 ) ;	
	}
コード例 #8
0
void CZXingBarcodeReaderAppView::DrawTexts(CWindowGc& gc) const
		{
	if (iTitle.Length()>0)
		{
	TRect rect(Rect());
	gc.SetPenColor(KRgbWhite);
	gc.UseFont(iTitleFont);
	gc.DrawText(iTitle, rect, rect.Height()/10, CGraphicsContext::ECenter );
	gc.DiscardFont();
		}
		}
コード例 #9
0
ファイル: COECCNTX.CPP プロジェクト: cdaffara/symbiandump-mw1
/** Prepares the graphics context for drawing the control in its normal state. 

The function uses the brush and pen properties which have been set, or uses 
a black pen and a black solid brush by default. When a bitmap has been set 
a patterned style brush is selected 

@param aGc The window graphics context. */
EXPORT_C void CCoeBrushAndPenContext::PrepareContext(CWindowGc& aGc) const
	{
	if (iBitmap)
		{
		aGc.UseBrushPattern(iBitmap);
		aGc.SetBrushStyle(CGraphicsContext::EPatternedBrush);
		return;
		}
	aGc.SetBrushStyle(iBrushStyle);
	aGc.SetBrushColor(iBrushColor);
	aGc.SetPenColor(iPenColor);
	}
コード例 #10
0
ファイル: Custom.cpp プロジェクト: huellif/symbian-example
void CSmiley::DrawMouth(CWindowGc& aGc, TBool bSmiling) const
	{
	aGc.SetPenColor(KRgbBlack);
	if (bSmiling)
		{
		aGc.DrawArc(iSmileRect,
				iSmileRect.iTl + TPoint(0, iSmileRect.Height() / 2),
				iSmileRect.iTl + TPoint(iSmileyWidth / 2, iSmileRect.Height() / 2));
		}
	else
		{
		aGc.DrawArc(iFrownRect,
				iFrownRect.iTl + TPoint(iSmileyWidth / 2, iFrownRect.Height() / 2),
				iFrownRect.iTl + TPoint(0, iFrownRect.Height() / 2));
		}
	}
コード例 #11
0
void CCalendarManagerContainer::DrawWeek(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Font_Color1, const CFont& p_Font) const
	{
	gc.SetPenColor(p_Default_Font_Color1);
	gc.SetUnderlineStyle(EUnderlineOff);
	
	TInt i_Pos_X = 0;
	TInt i_Pos_Y = g_Pos_Y;
	
	for (TInt i = 0;i < sizeof(g_CalendarClass->g_Week) / sizeof(TInt);i++)
		{
		TBuf<10> i_Num;
		i_Num.AppendNum(g_CalendarClass->g_Week[i]);
		
		gc.DrawText(i_Num, TRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X, i_Pos_Y + g_Space_Y), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels() + 1, CGraphicsContext::ECenter, 0);
		i_Pos_Y += g_Space_Y + 2;
		}					
	}
コード例 #12
0
ファイル: Custom.cpp プロジェクト: huellif/symbian-example
void CSmiley::DrawEyebrow(CWindowGc & aGc, TBool bSmiling) const
	{
	//Draw the mouth, smiling or looking sad.
	aGc.SetPenSize(TSize(1, 1));
	aGc.SetPenColor(KRgbWhite);
	if (bSmiling)
		{
		aGc.DrawArc(iFrownRect,
				iFrownRect.iTl + TPoint(iSmileyWidth / 2, iFrownRect.Height() / 2),
				iFrownRect.iTl + TPoint(0, iFrownRect.Height() / 2));
		}
	else
		{
		aGc.DrawArc(iSmileRect,
				iSmileRect.iTl + TPoint(0, iSmileRect.Height() / 2),
				iSmileRect.iTl + TPoint(iSmileyWidth / 2, iSmileRect.Height() / 2));
		}
	}
コード例 #13
0
void CSpaceInvadersAppView::DrawQuitCommand(CWindowGc& aGc) const
{
    TRgb pencolor = TRgb(255,255,255);
    aGc.SetPenColor(pencolor);
    _LIT(KQuitText, "Quit");

    TBufC<4> quitText;
    TPtr quitPtr = quitText.Des();
    quitPtr.Append(KQuitText);

    const CFont* menuFont =
        AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont, NULL);
    aGc.UseFont(menuFont);
    TInt textLength = menuFont->TextWidthInPixels(quitPtr);
    TInt textHeight = menuFont->HeightInPixels();
    TPoint textpoint(Rect().Width() - ( textLength + 10 ),
                     Rect().Height() - textHeight);
    aGc.DrawText(quitPtr, textpoint);
}
コード例 #14
0
void CSpaceInvadersAppView::DrawPoints(CWindowGc& aGc) const
{
    TRgb pencolor = TRgb(255,255,255);
    aGc.SetPenColor(pencolor);
    _LIT(KPointsText, "Points: ");

    TBufC<15> pointsText;
    TPtr pointsPtr = pointsText.Des();
    pointsPtr.Append(KPointsText);
    pointsPtr.AppendNum(iHolder->ActivePoints());

    const CFont* menuFont =
        AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont, NULL);
    aGc.UseFont(menuFont);
    TInt textLength = menuFont->TextWidthInPixels(pointsPtr);
    TInt textHeight = menuFont->HeightInPixels();
    TPoint textpoint(Rect().Width() / 2 - textLength / 2, textHeight);
    aGc.DrawText(pointsPtr, textpoint);
}
コード例 #15
0
void CMainWindow::HandlePointerMoveBufferReady()
	{
	TPoint pnts[KPointerMoveBufferSize];
	TPtr8 ptr((TUint8 *) &pnts, sizeof(pnts));
	TInt numPnts = Window().RetrievePointerMoveBuffer(ptr);
	TRect redrawRect(Window().Position(), Window().Size());

	CWindowGc* gc = SystemGc();
	gc->Activate(Window());
	gc->SetPenColor(KRgbBlue);
	gc->SetPenSize(TSize(2, 2));
	Window().Invalidate();
	Window().BeginRedraw(redrawRect); // N.B. Redrawer::RunL() gets called with this 
	// rectangle - must give it a non-zero value
	for (TInt index = 0; index < numPnts; index++)
		{
		gc->DrawLineTo(pnts[index]);
		}
	Window().EndRedraw();
	gc->Deactivate();
	}
コード例 #16
0
ファイル: Ordinal.cpp プロジェクト: huellif/symbian-example
/****************************************************************************\
|	Function:	CNumberedWindow::Draw
 |	Purpose:	Redraws the contents of CNumberedWindow within a given
 |				rectangle.  CNumberedWindow displays a number in the window.
 |	Input:		aRect	Rectangle that needs redrawing
 |	Output:		None
 \****************************************************************************/
void CNumberedWindow::Draw(const TRect& aRect)
    {
    const TBufC<1> strings[5] =
        {
        *&KString1, *&KString2, *&KString3, *&KString4, *&KString5
        };

    CWindowGc* gc = SystemGc(); // get a graphics context
    gc->SetClippingRect(aRect); // clip outside the redraw area
    gc->Clear(aRect); // clear the redraw area
    TSize size = iWindow.Size();
    TInt height = size.iHeight; // Need window height to calculate vertical text offset
    TInt ascent = Font()->AscentInPixels();
    TInt descent = Font()->DescentInPixels();
    TInt offset = (height + (ascent + descent)) / 2; // Calculate vertical text offset
    gc->SetPenColor(TRgb(0, 0, 0)); // Set pen to black
    gc->UseFont(Font());
    gc->DrawText(strings[iNumber], TRect(TPoint(0, 0), size), offset,
            CGraphicsContext::ECenter);
    gc->DiscardFont();
    }
コード例 #17
0
void CCalendarManagerContainer::DrawSchedule(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Font_Color1, const CFont& p_Font) const
	{		
	g_Pos_Y += g_Space_Y;	
	gc.SetPenColor(p_Default_Font_Color1);
	TInt i_Count = GetScheduleCount();
	
	if (i_Count == 0)
		{		
		gc.DrawText(_L("\x6CA1\x6709\x65E5\x7A0B"), TRect(0, 0, aRect.Width(), g_Pos_Y), (g_Pos_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
		}			
	else
		{
		TBuf<20> i_NUM;
		i_NUM.Append(_L("\x6709"));
		i_NUM.AppendNum(i_Count);
		i_NUM.Append(_L("\x4E2A\x65E5\x7A0B"));
		
		gc.DrawText(i_NUM, TRect(0, 0, aRect.Width(), g_Pos_Y), (g_Pos_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
		}
	//gc.DrawLine(TPoint(0, g_Pos_Y), TPoint(aRect.Width(), g_Pos_Y));	
	}
コード例 #18
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);
	}
コード例 #19
0
void CCalendarManagerContainer::DrawGrid(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Grid_Color1) const
	{
	gc.SetPenColor(p_Default_Grid_Color1);
	gc.SetPenSize(TSize(2, 2));	
	gc.DrawLine(TPoint(0, g_Pos_Y), TPoint(aRect.Width(), g_Pos_Y));
		
	gc.SetPenSize(TSize(1, 1));
	TInt i_Pos_X = g_Space_X;
	for (TInt i = 0; i < 7; i++)
		{
		gc.DrawLine(TPoint(i_Pos_X, g_Pos_Y), TPoint(i_Pos_X, aRect.Height()));
		i_Pos_X += g_Space_X + 1;
		}
	
	g_Pos_Y += 1;
	TInt i_Pos_Y = g_Pos_Y;	
	for (TInt i = 0; i < 6; i++)
		{
		gc.DrawLine(TPoint(g_Space_X, i_Pos_Y), TPoint(aRect.Width(), i_Pos_Y));
		i_Pos_Y += g_Space_Y + 2;
		}
	}
コード例 #20
0
/*
-----------------------------------------------------------------------

-----------------------------------------------------------------------
*/
void CTraceContainer::DrawMemory(const TRect& aRect, CWindowGc& gc) const
{
	if(iMaskImg)
	{
		if(iMaskImg->Bitmap() && iMaskImg->Mask())
		{
			if(iMaskImg->Bitmap()->Handle() && iMaskImg->Mask()->Handle())
			{
				TSize ButtonSiz(iMaskImg->Bitmap()->SizeInPixels());
				gc.DrawBitmapMasked(aRect,iMaskImg->Bitmap(),TRect(0,0,ButtonSiz.iWidth,ButtonSiz.iHeight),iMaskImg->Mask(),EFalse);
			}
		}
	}
	
	gc.SetPenColor(KRgbBlack);
	
	gc.DrawLine(aRect.iTl,TPoint(aRect.iTl.iX,aRect.iBr.iY));
	gc.DrawLine(aRect.iTl,TPoint(aRect.iBr.iX,aRect.iTl.iY));
	gc.DrawLine(aRect.iBr,TPoint(aRect.iTl.iX,aRect.iBr.iY));
	gc.DrawLine(aRect.iBr,TPoint(aRect.iBr.iX,aRect.iTl.iY)); 
	
	gc.SetPenColor(KRgbRed);
	
	TInt Prosentages(0);
	
	TBuf<100> FreeBuffer(_L("Free: "));
	TBuf<100> TotalBuffer(_L("Total: "));
	if(iArray.Count())
	{
		if(iArray[iArray.Count() - 1])
		{
			FreeBuffer.AppendNum(iArray[iArray.Count() - 1]->iMemory,EDecimal);
			TotalBuffer.AppendNum(iTotalRamInBytes,EDecimal);
			
			Prosentages = ((iArray[iArray.Count() - 1]->iMemory * 100) / iTotalRamInBytes);
		}
	}
	
	TInt SizPie = (aRect.Height() / 3);
	PieDrawer(gc,aRect.iTl,SizPie,Prosentages,EFalse);
	
	const CFont* MuFonr = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);

	TInt TextHeight= MuFonr->HeightInPixels();
	TInt StartX = (aRect.iTl.iX + SizPie);
	TInt StartY = (aRect.iTl.iY + 2);

	gc.SetPenColor(KRgbBlack);
	gc.UseFont(MuFonr);
	
	gc.DrawText(FreeBuffer,TRect(StartX,StartY,aRect.iBr.iX,StartY + TextHeight),MuFonr->AscentInPixels(), CGraphicsContext::ELeft, 0);			
	gc.DrawText(TotalBuffer,TRect(StartX,(StartY + TextHeight),aRect.iBr.iX,(StartY + (TextHeight * 2))),MuFonr->AscentInPixels(), CGraphicsContext::ELeft, 0);			

	gc.SetPenColor(KRgbRed);
	
	StartX = 0;
	
	if(iArray.Count() > aRect.Width())
	{
		StartX = (iArray.Count() - aRect.Width());
	}

	TPoint MePoint1(aRect.iTl.iX,aRect.iBr.iY);
	TPoint MePoint2(aRect.iTl);
	
	TInt Valll(0);
	
	for(TInt i = StartX; i < iArray.Count(); i++)
	{
		if(iArray[i] && iTotalRamInBytes > 0)
		{
			Valll = ((aRect.Height() * iArray[i]->iMemory) / iTotalRamInBytes);
		}
	
		MePoint2.iY = (aRect.iBr.iY - Valll);
		
		if(StartX != 1)
		{
			gc.DrawLine(MePoint1,MePoint2);
		}
		
		MePoint1 = MePoint2;
		MePoint2.iX = MePoint2.iX + 1;	
	}
}
コード例 #21
0
void CCalendarManagerContainer::DrawWeekName(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Font_Color1, const CFont& p_Font) const
	{
	//TInt i_Pos_X = g_Space_X + 1;
	TInt i_Pos_X = 0;
	TInt i_Width = 0;
	TInt i_Height = g_Pos_Y + g_Space_Y;
	
	gc.SetPenColor(p_Default_Font_Color1);
	i_Width = i_Pos_X + g_Space_X;
	gc.DrawText(_L("\x5468"), TRect(i_Pos_X, g_Pos_Y, i_Width, i_Height), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
	i_Pos_X += g_Space_X + 1;
	
	for (TInt i = 0;i < 7;i++)
		{
		switch (i)
			{
			case 0:
				i_Width = i_Pos_X + g_Space_X;
				gc.DrawText(_L("\x65E5"), TRect(i_Pos_X, g_Pos_Y, i_Width, i_Height), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
				i_Pos_X += g_Space_X + 1;
				break;
				
			case 1:
				i_Width = i_Pos_X + g_Space_X;
				gc.DrawText(_L("\x4E00"), TRect(i_Pos_X, g_Pos_Y, i_Width, i_Height), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
				i_Pos_X += g_Space_X + 1;
				break;
				
			case 2:
				i_Width = i_Pos_X + g_Space_X;
				gc.DrawText(_L("\x4E8C"), TRect(i_Pos_X, g_Pos_Y, i_Width, i_Height), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
				i_Pos_X += g_Space_X + 1;
				break;
				
			case 3:
				i_Width = i_Pos_X + g_Space_X;
				gc.DrawText(_L("\x4E09"), TRect(i_Pos_X, g_Pos_Y, i_Width, i_Height), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
				i_Pos_X += g_Space_X + 1;
				break;
				
			case 4:
				i_Width = i_Pos_X + g_Space_X;
				gc.DrawText(_L("\x56DB"), TRect(i_Pos_X, g_Pos_Y, i_Width, i_Height), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
				i_Pos_X += g_Space_X + 1;
				break;
				
			case 5:
				i_Width = i_Pos_X + g_Space_X;
				gc.DrawText(_L("\x4E94"), TRect(i_Pos_X, g_Pos_Y, i_Width, i_Height), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
				i_Pos_X += g_Space_X + 1;
				break;
				
			case 6:				
				i_Width = i_Pos_X + g_Space_X;
				gc.DrawText(_L("\x516D"), TRect(i_Pos_X, g_Pos_Y, i_Width, i_Height), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels(), CGraphicsContext::ECenter, 0);
				i_Pos_X += g_Space_X + 1;
				break;
			}			
		}
	
	g_Pos_Y += g_Space_Y;
	//gc.DrawLine(TPoint(0, g_Pos_Y), TPoint(aRect.Width(), g_Pos_Y));
	}
コード例 #22
0
void CCalendarManagerContainer::DrawRoundRect(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Grid_Color2) const
	{
	gc.SetPenColor(p_Default_Grid_Color2);
	gc.DrawRoundRect(TRect(0, g_Pos_Y, aRect.Width(), aRect.Height()), TSize(4, 4));
	g_Pos_Y += 1;
	}
コード例 #23
0
ファイル: LAFMENUP.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
 * Draws a line seperator between two items into the graphics context aGc, in the rectangle aRect.
 */
EXPORT_C void LafMenuPane::DrawSeperator(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TRect& aRect, const TItemAttributes& /*aItemAttributes*/)
	{
	aGc.SetPenColor(aLafEnv.ControlColor(EColorMenuPaneText, aMenuPane));
	aGc.DrawLine(aRect.iTl, aRect.iBr);
	}
コード例 #24
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);
}
コード例 #25
0
void CCalendarManagerContainer::DrawDay(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Font_Color1, const TRgb& p_Default_Font_Color2, const CFont& p_Font) const
	{
	gc.SetPenColor(p_Default_Font_Color1);
	
	TInt i_Total = 0;
	TInt i_WeekPos = g_CalendarClass->g_FirstWeek;	
	//TInt i_Pos_X = g_Space_X * (i_WeekPos + 1) + i_WeekPos + 1;
	//TInt i_Pos_Y = g_Pos_Y;
	
	TInt i_Pos_X = g_Space_X + 1;
	TInt i_Pos_Y = g_Pos_Y;
	
	if (i_WeekPos != 7)
		{
		gc.SetPenColor(p_Default_Font_Color2);
		for (TInt i = g_CalendarClass->g_MaxDay_PreMonth - i_WeekPos + 1;i <= g_CalendarClass->g_MaxDay_PreMonth;i++)
			{
			TBuf<5> i_Num;
			i_Num.AppendNum(i);
			
			gc.DrawText(i_Num, TRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X, i_Pos_Y + g_Space_Y), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels() + 1, CGraphicsContext::ECenter, 0);
			
			i_Pos_X += g_Space_X + 1;
			i_Total++;
			}
		}
	
	i_Pos_X = g_Space_X * (i_WeekPos + 1) + i_WeekPos + 1;
	
	for (TInt i = 1; i <= g_CalendarClass->g_MaxDay; i++)
		{
		TBuf<5> i_Num;
		i_Num.AppendNum(i);
		
		if (i_WeekPos == 0)
			gc.SetPenColor(KRgbRed);
		else
			gc.SetPenColor(p_Default_Font_Color1);
			
		if (g_CalendarClass->g_SelectYear == g_CalendarClass->g_Year && g_CalendarClass->g_SelectMonth == g_CalendarClass->g_Month && i == g_CalendarClass->g_Day)			
			gc.SetUnderlineStyle(EUnderlineOn);		
		else			
			gc.SetUnderlineStyle(EUnderlineOff);			
		
		gc.DrawText(i_Num, TRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X, i_Pos_Y + g_Space_Y), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels() + 1, CGraphicsContext::ECenter, 0);
				
		i_WeekPos++;		
		if (i_WeekPos >= 7)
			{
			i_WeekPos = 0;			
			i_Pos_Y += g_Space_Y + 2;			
			}				
		
		i_Pos_X = g_Space_X * (i_WeekPos + 1) + i_WeekPos + 1;
		i_Total++;
		}
	
	TInt j = 1;
	gc.SetPenColor(p_Default_Font_Color2);
	for (TInt i = i_Total + 1;i <= 42;i++)
		{
		TBuf<5> i_Num;
		i_Num.AppendNum(j);
		
		gc.DrawText(i_Num, TRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X, i_Pos_Y + g_Space_Y), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels() + 1, CGraphicsContext::ECenter, 0);
		
		i_WeekPos++;		
		if (i_WeekPos >= 7)
			{
			i_WeekPos = 0;			
			i_Pos_Y += g_Space_Y + 2;
			}
			
		i_Pos_X = g_Space_X * (i_WeekPos + 1) + i_WeekPos + 1;		
		j++;
		}
	}
コード例 #26
0
/*
-----------------------------------------------------------------------

-----------------------------------------------------------------------
*/
void CTraceContainer::DrawCPU(const TRect& aRect, CWindowGc& gc) const
{
	if(iMaskImg)
	{
		if(iMaskImg->Bitmap() && iMaskImg->Mask())
		{
			if(iMaskImg->Bitmap()->Handle() && iMaskImg->Mask()->Handle())
			{
				TSize ButtonSiz(iMaskImg->Bitmap()->SizeInPixels());
				gc.DrawBitmapMasked(aRect,iMaskImg->Bitmap(),TRect(0,0,ButtonSiz.iWidth,ButtonSiz.iHeight),iMaskImg->Mask(),EFalse);
			}
		}
	}
	
	gc.SetPenColor(KRgbBlack);
	gc.DrawLine(aRect.iTl,TPoint(aRect.iTl.iX,aRect.iBr.iY));
	gc.DrawLine(aRect.iTl,TPoint(aRect.iBr.iX,aRect.iTl.iY));
	gc.DrawLine(aRect.iBr,TPoint(aRect.iTl.iX,aRect.iBr.iY));
	gc.DrawLine(aRect.iBr,TPoint(aRect.iBr.iX,aRect.iTl.iY)); 

	TInt Prosentages(0);

	if(iArray.Count() && iMaxCpuCount)
	{
		if(iArray[iArray.Count() - 1])
		{
			Prosentages = ((iArray[iArray.Count() - 1]->iCpuLoad * 100) / iMaxCpuCount);
			Prosentages = (100 - Prosentages);
		}
	}
	
	TInt SizPie = (aRect.Height() / 3);
	//TPoint(aRect.iTl.iX, (aRect.iBr.iY - SizPie))
	PieDrawer(gc,aRect.iTl,SizPie,Prosentages,ETrue);
	
	gc.SetPenColor(KRgbRed);
	
	TInt StartX(0);
	
	if(iArray.Count() > aRect.Width())
	{
		StartX = (iArray.Count() - aRect.Width());
	}

	TPoint MePoint1(aRect.iTl.iX,aRect.iBr.iY);
	TPoint MePoint2(aRect.iTl);
	
	TInt Valll(0);
	
	if(iMaxCpuCount > 0)
	{
		for(TInt i = StartX; i < iArray.Count(); i++)
		{
			if(iArray[i])
			{
				TUint32 Curr = (iMaxCpuCount - iArray[i]->iCpuLoad);
				if(Curr < 0)
				{
					Curr = 0;
				}
				else if(iMaxCpuCount < Curr)
				{
					Curr = iMaxCpuCount;
				}
				
				Valll = ((aRect.Height() * Curr) / iMaxCpuCount);
			}
		
			MePoint2.iY = (aRect.iBr.iY - Valll);
			
			if(StartX != 1)
			{
				gc.DrawLine(MePoint1,MePoint2);
			}
		
			MePoint1 = MePoint2;
			MePoint2.iX = MePoint2.iX + 1;	
		}
	}
}