inline void CRecognizerContainer::DrawCross(CWindowGc& gc, const TPoint& center) const { CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("DrawCross")); gc.DrawLine(TPoint(center.iX-5, center.iY), TPoint(center.iX+6, center.iY)); gc.DrawLine(TPoint(center.iX, center.iY-5), TPoint(center.iX, center.iY+6)); }
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; } }
/* ----------------------------------------------------------------------- ----------------------------------------------------------------------- */ 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; } }
/* ----------------------------------------------------------------------- ----------------------------------------------------------------------- */ 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; } } }
/** * 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); }
/** * 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)); } } }