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

📄 s60clientservlabcontainer.cpp

📁 symbian phonebook source code.
💻 CPP
字号:
// Copyright (c) 2006 Nokia Corporation.

// INCLUDE FILES
#include "S60ClientServLabContainer.h"

#include <eiklabel.h>  // for example label control
#include <f32file.h>   // for file server usage

_LIT(KClientServerLabText, "Client/Server Lab");
_LIT(KFileWriterText, "File Writer");
_LIT(KOutputFileSizeText, "Output file size:");
_LIT(KNumBytes, "%d bytes");
_LIT(KDataFilePath, "c:\\system\\apps\\S60ClientServLab\\S60ClientServLab.txt");
_LIT8(KDataEntry, "A line of ASCII text\r\n");
// ================= MEMBER FUNCTIONS =======================

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

    iTopLabel = new (ELeave) CEikLabel;
    iTopLabel->SetContainerWindowL( *this );
    iTopLabel->SetTextL(KClientServerLabText);

    iBottomLabel = new (ELeave) CEikLabel;
    iBottomLabel->SetContainerWindowL( *this );
    iBottomLabel->SetTextL(KFileWriterText);

    SetRect(aRect);
    ActivateL();
    }

// Destructor
CS60ClientServLabContainer::~CS60ClientServLabContainer()
    {
    delete iTopLabel;
    delete iBottomLabel;
    }

// ---------------------------------------------------------
// CS60ClientServLabContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CS60ClientServLabContainer::SizeChanged()
    {
    iTopLabel->SetExtent( TPoint(0,0), TSize(Rect().Width(), Rect().Height()/2));
    iBottomLabel->SetExtent( TPoint(0,Rect().Height()/2), TSize(Rect().Width(),Rect().Height()/2));
    }

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

// ---------------------------------------------------------
// CS60ClientServLabContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CS60ClientServLabContainer::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
        {
        case 0:
            return iTopLabel;
        case 1:
            return iBottomLabel;
        default:
            return NULL;
        }
    }

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

// ---------------------------------------------------------
// CS60ClientServLabContainer::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CS60ClientServLabContainer::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    }
    
// ---------------------------------------------------------
// CS60ClientServLabContainer::WriteFileL()
// ---------------------------------------------------------
//
void CS60ClientServLabContainer::WriteFileL()
    {
    }

// End of File  

⌨️ 快捷键说明

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