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

📄 sysinfo60container4.cpp

📁 基于SYMBIAN OS 的Moblile硬件管理器. 支持series 70平台
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CSYSINFO60Container4 from SYSINFO60Container4.cpp
*  Part of  : SYSINFO60
*  Created  : 13.01.2004 by Petri-Veikko Alaj鋜vi OH1GIU
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: (c) 2004, Petri-Veikko Alaj鋜vi OH1GIU
* ============================================================================
*/

// INCLUDE FILES
#include "SYSINFO60Container4.h"
#include "SYSINFO60.pan"

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

// ---------------------------------------------------------
// CSYSINFO60Container4::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSYSINFO60Container4::ConstructL(const TRect& aRect)
    {
	iMonitor = 0;
	iOutputText = HBufC::NewL(KMaxLineLength);
    CreateWindowL();
    SetRect(aRect);

    iMsgIndex = 0;
    iListBox = new (ELeave) CAknSingleStyleListBox;
    iListBox->SetContainerWindowL(*this);
    iListBox->ConstructL(this, 0);

    iListBox->SetRect(aRect.Size());

    iListBox->ActivateL();
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
    //iListBox->SetDimmed(ETrue);

    iMessageList = new (ELeave) CDesCArrayFlat(KGranularityOfArray);

    CTextListBoxModel* model = iListBox->Model();
    model->SetItemTextArray(iMessageList);
    model->SetOwnershipType(ELbmOwnsItemArray); // transfer ownership of iMessageList

    ActivateL();
	MakeVisible(ETrue);
	PrintLine(_L("Start mon"));
	PrintLine(_L("Init of the signal"));
	PrintLine(_L("notification engine"));
	PrintLine(_L("takes 2 - 10 seconds"));
    }

// Destructor
CSYSINFO60Container4::~CSYSINFO60Container4()
    {
	delete iListBox;
    iListBox = NULL;
    delete iOutputText;
    iOutputText = NULL;
    }

// ---------------------------------------------------------
// CSYSINFO60Container4::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CSYSINFO60Container4::SizeChanged()
    {
	//
    }

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

// ---------------------------------------------------------
// CSYSINFO60Container4::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CSYSINFO60Container4::ComponentControl(TInt aIndex) const
    {
    __ASSERT_DEBUG(aIndex == 0, Panic(EInvalidComponentIndex));
    return iListBox;
    }

TKeyResponse CSYSINFO60Container4::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
	if (iMonitor)
		return iListBox->OfferKeyEventL(aKeyEvent, aType);

	if ((aKeyEvent.iCode == EKeyUpArrow) || (aKeyEvent.iCode == EKeyDownArrow))
	{
		return iListBox->OfferKeyEventL(aKeyEvent, aType);
	}
	else
	{
		return EKeyWasNotConsumed;
	}
}


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

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

void CSYSINFO60Container4::ClearL()
{
    iMessageList->Reset();
    iListBox->HandleItemRemovalL();
    iListBox->Reset();
    iMsgIndex = 0;
}

void CSYSINFO60Container4::Print(const TDesC& aText)
{
    if (!iOutputText->Des().Length())
    {
        iOutputText->Des().Append(_L("\t"));
    }

    TInt spaceRemaining = KMaxLineLength - iOutputText->Des().Length();
    iOutputText->Des().Append(aText.Left(spaceRemaining));
}

void CSYSINFO60Container4::PrintLine(const TDesC& aText)
{
    Print(aText);
    PrintNewLine();
    iOutputText->Des().Zero();
}

void CSYSINFO60Container4::PrintNewLine()
{
    TRAPD(err,
        {
        iMessageList->AppendL(*iOutputText);
        iListBox->HandleItemAdditionL();
        });
    if (err != KErrNone)
	{
        Panic(EPrintNewLine);
    }
}


// End of File

⌨️ 快捷键说明

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