phonebkexcontainer2.cpp

来自「应用于symbian series60平台上」· C++ 代码 · 共 97 行

CPP
97
字号
/*
* ============================================================================
*  Name     : CPhoneBkExContainer2 from PhoneBkExContainer2.cpp
*  Part of  : PhoneBkEx
*  Created  : 13/06/2003 by 
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: Forum Nokia
* ============================================================================
*/

// INCLUDE FILES
#include "PhoneBkExContainer2.h"

#include <eiklabel.h>  // for example label control
#include <stringloader.h>
#include <PhoneBkEx.rsg>
const TInt KLabelCoOrdinate = 10;
// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CPhoneBkExContainer2::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CPhoneBkExContainer2::ConstructL(const TRect& aRect)
    {
	HBufC* labelText = StringLoader::LoadLC(R_VIEW2_TEXT);

    CreateWindowL();
	
    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL( *this );
    iLabel->SetTextL(*labelText);
	CleanupStack::PopAndDestroy();
    SetRect(aRect);
    ActivateL();
    }

// Destructor
CPhoneBkExContainer2::~CPhoneBkExContainer2()
    {
    delete iLabel;
    }

// ---------------------------------------------------------
// CPhoneBkExContainer2::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CPhoneBkExContainer2::SizeChanged()
    {
    iLabel->SetExtent( TPoint(KLabelCoOrdinate,KLabelCoOrdinate), iLabel->MinimumSize() );
    }

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

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

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


// End of File  

⌨️ 快捷键说明

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