📄 vrexnavidecoratortime.cpp
字号:
/*
* ============================================================================
* Name : CVideoNaviDecoratorTime from VRexNaviDecoratorTime.cpp
* Part of : Video Example
* Created : 30/08/2006 by Forum Nokia
* Implementation notes:
* Version : 2.0
* Copyright: Nokia Corporation, 2006
* ============================================================================
*/
// INCLUDE FILES
#include <aknsutils.h>
#include "VRexNaviDecoratorTime.h"
#include <vrex.rsg>
/*
-----------------------------------------------------------------------------
CVideoNaviDecoratorTime::CVideoNaviDecoratorTime()
Description: C++ default constructor can NOT contain any code, that
might leave.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
CVideoNaviDecoratorTime::CVideoNaviDecoratorTime()
{
}
/*
-----------------------------------------------------------------------------
void CVideoNaviDecoratorTime::ConstructL()
Description: Symbian 2nd phase constructor can leave.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVideoNaviDecoratorTime::ConstructL()
{
iLabel = HBufC16::NewL(0);
}
/*
-----------------------------------------------------------------------------
CVideoNaviDecoratorTime* CVideoNaviDecoratorTime::NewL()
Description: Two-phased construtor
Comments :
Return values: CVideoNaviDecoratorTime object pointer
-----------------------------------------------------------------------------
*/
CVideoNaviDecoratorTime* CVideoNaviDecoratorTime::NewL()
{
CVideoNaviDecoratorTime* self = new( ELeave ) CVideoNaviDecoratorTime();
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop( self );
return self;
}
/*
-----------------------------------------------------------------------------
CVideoNaviDecoratorTime::~CVideoNaviDecoratorTime()
Description: Destructor
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
CVideoNaviDecoratorTime::~CVideoNaviDecoratorTime()
{
delete iLabel;
iLabel = NULL;
}
/*
-----------------------------------------------------------------------------
void CVideoNaviDecoratorTime::SetLabelL(const TDesC& aLabel)
Description: This method sets the label to the navi pane.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVideoNaviDecoratorTime::SetLabelL(const TDesC& aLabel)
{
HBufC* newLabel = aLabel.AllocL();
delete iLabel; // after the AllocL succeeds
iLabel = newLabel;
ReportEventL(MCoeControlObserver::EEventStateChanged);
}
/*
-----------------------------------------------------------------------------
void CVideoNaviDecoratorTime::SizeChanged()
Description: This method is called by the framework when size is changed.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVideoNaviDecoratorTime::SizeChanged()
{
// Values from LAF
TRect parentRect(KLeftX,KLeftY,KRightX,KRightY);
iTextLayout.LayoutText(parentRect,R_VREX_TIME_TEXT_LAYOUT);
}
/*
-----------------------------------------------------------------------------
void CVideoNaviDecoratorTime::Draw(const TRect& aRect) const
Description: This method is called by the framework, draws the screen.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CVideoNaviDecoratorTime::Draw(const TRect& /*aRect*/) const
{
CWindowGc& gc=SystemGc();
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
// Draw time indicator
TRgb color = iTextLayout.Color();
// Color is not updated if it not found from the skin
AknsUtils::GetCachedColor(skin,color,KAknsIIDQsnComponentColors,
EAknsCIQsnComponentColorsCG2);
gc.SetPenColor(color);
gc.UseFont(iTextLayout.Font());
gc.DrawText(*iLabel,iTextLayout.TextRect(),
iTextLayout.Font()->AscentInPixels(),iTextLayout.Align());
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -