示例#1
0
EXPORT_C void CXzePicture::Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap) const
// Draw this simple picture.
//
{
    aGc.Reset();
    aGc.SetClippingRect(aClipRect);
    TSize size;  // Size of graphics device in pixels
    GetSizeInPixels(aMap,size);
    TRect box;  // The rectangle that exactly fits the picture
    box.iTl=aTopLeft;
    box.iBr.iX=aTopLeft.iX+size.iWidth;
    box.iBr.iY=aTopLeft.iY+size.iHeight;
    TRgb white(255,255,255);
// First draw outer box and fill in rest of box.
    aGc.SetBrushColor(white);
    aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    aGc.DrawRect(box);
// Now draw label
    CFont* font;
    TFontSpec fontSpec(_L("Arial"),213);
    if (aMap->GetNearestFontInTwips(font,fontSpec)<0)
    {
        return;
    }
    aGc.UseFont(font);
    TBuf<1> label;
    label.Append(iLabel);
    TInt baselineOffset=(box.Height()+font->AscentInPixels())/2;
    aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
    aGc.DrawText(label,box,baselineOffset,CGraphicsContext::ECenter);
    aGc.DiscardFont();
    aMap->ReleaseFont(font);
}
示例#2
0
void CPage::Draw(CGraphicsContext& aGc) const
{
	ASSERT(iLayout);

	TPoint point = iRect.iTl;
	point.iY += iTextHeight;

	aGc.UseFont(CCoeEnv::Static()->NormalFont());

	for (int i = iStartIndex ; i < iEndIndex && i < iWidgetGroupArray.Count() ; i++)
	{
		CWidgetGroup* wg = iWidgetGroupArray[i];
		wg->SetPoint(point);
		wg->Draw(aGc);
		//point.iY += iTextHeight;
		point.iY += wg->Height();
	}
	ASSERT(iScrollBar);
	iScrollBar->Draw(aGc);
}