VideoNaviDecoratorTime.cpp
上传用户:xinrui0099
上传日期:2010-03-05
资源大小:48k
文件大小:4k
- /*
- * ==============================================================================
- * Name : CVideoNaviDecoratorTime from VideoNaviDecoratorTime.h
- * Part of : Video
- * Created : 10/14/2003 by Forum Nokia
- * Interface :
- * Description : Declares Navi decorator for time
- * Version :
- * Copyright : Nokia Corporation, 2003
- * ==============================================================================
- */
- #include <aknsutils.h>
- #include "VideoNaviDecoratorTime.h"
- #include <video.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();
- return self;
- }
- /*
- -----------------------------------------------------------------------------
- CVideoNaviDecoratorTime::~CVideoNaviDecoratorTime()
- Description: Destructor, frees allocated resources
- Comments :
- Return values: N/A
- -----------------------------------------------------------------------------
- */
- CVideoNaviDecoratorTime::~CVideoNaviDecoratorTime()
- {
- delete iLabel;
- }
- /*
- -----------------------------------------------------------------------------
- void CVideoNaviDecoratorTime::SetLabelL(const TDesC& aLabel)
- Description: Set the label 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: Called by the framework when size is changed.
- Comments :
- Return values: N/A
- -----------------------------------------------------------------------------
- */
- void CVideoNaviDecoratorTime::SizeChanged()
- {
- // Values from LAF
- TRect parentRect(0,0,120,16);
- iTextLayout.LayoutText(parentRect,R_VIDEO_TIME_TEXT_LAYOUT);
- }
- /*
- -----------------------------------------------------------------------------
- void CVideoNaviDecoratorTime::Draw(const TRect& aRect) const
- Description: Draws 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());
- }