⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skinexamplecontainer.cpp

📁 symbian皮肤
💻 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 + -