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

📄 audio1view.cpp

📁 symbian,uiq 2.0以上平台运行
💻 CPP
字号:
/* Copyright (c) 2004, Symbian Software Ltd. All rights reserved */

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

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

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

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

CAudio1View::CAudio1View()
    {
    }

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

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

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

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

void CAudio1View::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 + -