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

📄 audio3view.cpp

📁 Symbian OS C++ 程序开发事例
💻 CPP
字号:
/* Copyright (c) 2004, Symbian Software Ltd. All rights reserved */

#include <eikenv.h>
#include <gdi.h>
#include <eiklabel.h>
#include "Audio3view.h"

CAudio3View* CAudio3View::NewL(const TRect& aRect)
    {
    CAudio3View* self = CAudio3View::NewLC(aRect);
    CleanupStack::Pop(self);
    return self;
    }

CAudio3View* CAudio3View::NewLC(const TRect& aRect)
    {
    CAudio3View* self = new (ELeave) CAudio3View;
    CleanupStack::PushL(self);
    self->ConstructL(aRect);
    return self;
    }

void CAudio3View::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
    SetRect(aRect);
	
    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL(*this);
    ActivateL();
	}

CAudio3View::CAudio3View()
    {
    }

CAudio3View::~CAudio3View()
    {
	delete iLabel;
	iLabel=NULL;
    }

void CAudio3View::Draw(const TRect& /*aRect*/) const
    {
	CWindowGc& gc = SystemGc();
    gc.Clear(Rect());
    }

TInt CAudio3View::CountComponentControls() const
    {
    return 1; 
    }

CCoeControl* CAudio3View::ComponentControl(TInt aIndex) const
    {
    switch(aIndex)
        {
    case 0:
        return iLabel;
    default:
		User::Invariant();
        return 0;
        }
    }

void CAudio3View::UpdateLabelL(const TDesC& aText)
    {
	iLabel->SetTextL(aText);

    TRect rect = Rect();

    TSize labelSize = iLabel->MinimumSize();
    rect.iTl.iX += (rect.Width() - labelSize.iWidth) / 2;
    rect.iTl.iY += (rect.Height() - labelSize.iHeight) / 2;
    rect.iBr = rect.iTl + labelSize;

    iLabel->SetRect(rect);
    }

⌨️ 快捷键说明

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