Symbian 中大段文本显示控件详解
2010-02-22 20:53:00 来源:WEB开发网#include "TextDisplay.h"
//#include "AuditionContainer.h"
_LIT(KLineStart,"
_LIT(KLineEnd,"");
#define MAXDISPLAYLINE 10
#define LINESPACE 3
#define LASTSPACE 25
CTextDisplay::CTextDisplay()
{
// No implementation required
// iBackGroundBitmap = NULL;
iStartLine = 0;
iTotalLine = 0;
iFontColour = KRgbBlack; // default
iStartPoit = TPoint(3,5);
iLineToLineSpace = LINESPACE;
iScrollBarWidth = 10;
}
CTextDisplay::~CTextDisplay()
{
if (iDisplayContent)
{
iDisplayContent->ResetAndDestroy();
delete iDisplayContent;
iDisplayContent = NULL;
}
if(iSBFrame)
{
delete iSBFrame;
iSBFrame = NULL;
}
}
CTextDisplay* CTextDisplay::NewLC(const TRect &aRect,CCoeControl* aParent)
{
CTextDisplay* self = new (ELeave)CTextDisplay();
CleanupStack::PushL(self);
self->ConstructL(aRect,aParent);
return self;
}
CTextDisplay* CTextDisplay::NewL(const TRect &aRect,CCoeControl* aParent)
{
CTextDisplay* self=CTextDisplay::NewLC(aRect,aParent);
CleanupStack::Pop(); // self;
return self;
}
void CTextDisplay::ConstructL(const TRect &aRect,CCoeControl* aParent)
{
// SetRect(aRect);
iRect = aRect;
TFontSpec fontSpec = iEikonEnv->DenseFont()->FontSpecInTwips();
fontSpec.iHeight *= 1;
iCoeEnv->ScreenDevice()->GetNearestFontInTwips(iFont,fontSpec);
iMaxDisplayLine = GetMaxDisplay();
iParent = aParent;
}
TKeyResponse CTextDisplay::OfferKeyEventL(const TKeyEvent &aKeyEvent,
更多精彩
赞助商链接