📄 statuscontainer.cpp
字号:
/*
* ============================================================================
* Name : CStatusContainer from StatusContainer.h
* Part of : GridDemo
* Created : 2006-11-28 by tomken
* Implementation notes:
* Initial content was generated by Series 60 AppWizard.
* Version :
* Copyright: Copyright (c) 2006-2008
* ============================================================================
*/
// INCLUDE FILES
#include "StatusContainer.h"
#include <gulutil.h>
#include <AknUtils.h>
#include <eikenv.h>
CStatusContainer::CStatusContainer()
{
iText = NULL;
}
void CStatusContainer::ConstructL(const TRect& aRect, CCoeControl* aParent)
{
if(aParent)
this->SetContainerWindowL(*aParent);
else
CreateWindowL();
SetRect(aRect);
ActivateL();
}
CStatusContainer::~CStatusContainer()
{
if(iText)
delete iText;
iText = NULL;
}
void CStatusContainer::SizeChanged()
{
DrawDeferred();
}
void CStatusContainer::Draw(const TRect& /*aRect*/) const
{
CWindowGc& gc = SystemGc();
TRect wholeRect = Rect();
gc.SetPenColor(KRgbWhite);
gc.SetPenStyle(CGraphicsContext::ESolidPen);
gc.SetBrushColor(KRgbWhite);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(wholeRect);
wholeRect.Shrink(TSize(1,1));
gc.SetPenColor(0x962D00); //0x80ff32); // light green ee9911
gc.SetBrushColor(0xFEECDD);
gc.DrawRoundRect(wholeRect,TSize(3,3));
wholeRect.Shrink(TSize(1,1));
gc.SetPenColor(0x570D37);
if(iText)
{
TBuf<256> buf;
if(iText->Length() > buf.MaxLength())
buf.Copy(iText->Left(buf.MaxLength()));
else
buf.Copy(*iText);
const CFont* iFont ;
if(ApacPlain16()->TextWidthInPixels(buf) > wholeRect.Width())
iFont = ApacPlain12();
else
iFont = ApacPlain16();
gc.UseFont(iFont);
TInt baseline = wholeRect.Height() /2 + iFont->AscentInPixels()/2;
TextUtils::ClipToFit(buf, *iFont, wholeRect.Width());
DrawUtils::DrawText(gc, buf, wholeRect, baseline, CGraphicsContext::ECenter, 0, iFont);
gc.DiscardFont();
}
}
void CStatusContainer::SetTextL(const TDesC& aText)
{
if(iText)
delete iText;
iText = aText.AllocL();
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -