?? skinexamplecontainer.cpp
字號:
/*
* ============================================================================
* Name : CSkinExampleContainer from SkinExampleContainer.h
* Part of : SkinExample
* Created : 18.05.2006 by li yongfei
* Implementation notes:
* Initial content was generated by Series 60 Application Wizard.
* Version :
* WebSite: http://www.symbianer.com
* Copyright: n-office@163.com
* ============================================================================
*/
// INCLUDE FILES
#include "SkinExampleContainer.h"
#include <eiklabel.h> // for example label control
#include <AknsDrawUtils.h>// add this inlcude file skin
#include <AknsBasicBackgroundControlContext.h> //add this inlcude file skin
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CSkinExampleContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
_LIT(KSTRING,"Author: Li Yongfei \nWebSite: Http://www.symbianer.com\nE-Mail: N-office@163.com");
void CSkinExampleContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
iLabel = new (ELeave) CEikLabel;
iLabel->SetContainerWindowL( *this );
iLabel->SetTextL( KSTRING);
SetRect(aRect);
iBackGround = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );
ActivateL();
}
// Destructor
CSkinExampleContainer::~CSkinExampleContainer()
{
delete iLabel;
delete iBackGround;
}
// ---------------------------------------------------------
// CSkinExampleContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CSkinExampleContainer::SizeChanged()
{
// TODO: Add here control resize code etc.
iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
}
// ---------------------------------------------------------
// CSkinExampleContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CSkinExampleContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CSkinExampleContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CSkinExampleContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iLabel;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CSkinExampleContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CSkinExampleContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// TODO: Add your drawing code here
// example code...
// draw background
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
AknsDrawUtils::Background( skin, cc, this, gc, aRect );
}
// ---------------------------------------------------------
// CSkinExampleContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CSkinExampleContainer::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
}
// ---------------------------------------------------------
// CSkinExampleContainer::MopSupplyObject()
// Pass skin information if needed.
// ---------------------------------------------------------
//
TTypeUid::Ptr CSkinExampleContainer::MopSupplyObject(TTypeUid aId)
{
if(aId.iUid == MAknsControlContext::ETypeId && iBackGround)
{
return MAknsControlContext::SupplyMopObject( aId, iBackGround);
}
return CCoeControl::MopSupplyObject( aId );
}
// End of File
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -