systemsoundscontainer2.cpp

来自「symbian for c++ 系统声音调用例子」· C++ 代码 · 共 113 行

CPP
113
字号
/*
* ============================================================================
*  Name     : CSystemSoundsContainer2 from SystemSoundsContainer2.cpp
*  Part of  : SystemSounds
*  Created  : 06/12/2003 by Forum Nokia
*  Implementation notes:
*     Initial content was generated by Nokia Series 60 AppWizard.
*  Version  :
*  Copyright: Nokia
* ============================================================================
*/

// INCLUDE FILES
#include "SystemSoundsContainer2.h"

#include <eiklabel.h>  // for example label control

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CSystemSoundsContainer2::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSystemSoundsContainer2::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL( *this );
    iLabel->SetTextL( _L("CoeSoundPlayer") );

    iToDoLabel = new (ELeave) CEikLabel;
    iToDoLabel->SetContainerWindowL( *this );
    iToDoLabel->SetTextL( _L("example") );

    SetRect(aRect);
    ActivateL();
    }

// Destructor
CSystemSoundsContainer2::~CSystemSoundsContainer2()
    {
    delete iLabel;
    delete iToDoLabel;
    }

// ---------------------------------------------------------
// CSystemSoundsContainer2::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CSystemSoundsContainer2::SizeChanged()
    {
    // TODO: Add here control resize code etc.
    iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
    iToDoLabel->SetExtent( TPoint(10,50), iToDoLabel->MinimumSize() );
    }

// ---------------------------------------------------------
// CSystemSoundsContainer2::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CSystemSoundsContainer2::CountComponentControls() const
    {
    return 2; // return nbr of controls inside this container
    }

// ---------------------------------------------------------
// CSystemSoundsContainer2::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CSystemSoundsContainer2::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
        {
        case 0:
            return iLabel;
        case 1:
            return iToDoLabel;
        default:
            return NULL;
        }
    }

// ---------------------------------------------------------
// CSystemSoundsContainer2::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CSystemSoundsContainer2::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    // TODO: Add your drawing code here
    // example code...
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.SetBrushColor(KRgbGray);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.DrawRect(aRect);
    }

// ---------------------------------------------------------
// CSystemSoundsContainer2::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CSystemSoundsContainer2::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    // TODO: Add your control event handler code here
    }

// End of File  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?