📄 sysinfo60container3.cpp
字号:
/*
* ============================================================================
* Name : CSYSINFO60Container3 from SYSINFO60Container3.cpp
* Part of : SYSINFO60
* Created : 09.09.2003 by Petri-Veikko Alaj鋜vi OH1GIU
* Implementation notes:
* Initial content was generated by Series 60 AppWizard.
* Version :
* Copyright: (c) 2003, Petri-Veikko Alaj鋜vi OH1GIU
* ============================================================================
*/
// INCLUDE FILES
#include "SYSINFO60Container3.h"
#include "SYSINFO60.pan"
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CSYSINFO60Container3::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSYSINFO60Container3::ConstructL(const TRect& aRect)
{
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);
}
// Destructor
CSYSINFO60Container3::~CSYSINFO60Container3()
{
delete iListBox;
iListBox = NULL;
delete iOutputText;
iOutputText = NULL;
}
// ---------------------------------------------------------
// CSYSINFO60Container3::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CSYSINFO60Container3::SizeChanged()
{
//
}
// ---------------------------------------------------------
// CSYSINFO60Container3::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CSYSINFO60Container3::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CSYSINFO60Container3::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CSYSINFO60Container3::ComponentControl(TInt aIndex) const
{
__ASSERT_DEBUG(aIndex == 0, Panic(EInvalidComponentIndex));
return iListBox;
}
TKeyResponse CSYSINFO60Container3::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
if ((aKeyEvent.iCode == EKeyUpArrow) || (aKeyEvent.iCode == EKeyDownArrow))
{
return iListBox->OfferKeyEventL(aKeyEvent, aType);
}
else
{
return EKeyWasNotConsumed;
}
}
// ---------------------------------------------------------
// CSYSINFO60Container3::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CSYSINFO60Container3::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushColor(KRgbGray);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
}
// ---------------------------------------------------------
// CSYSINFO60Container3::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CSYSINFO60Container3::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
}
void CSYSINFO60Container3::ClearL()
{
iMessageList->Reset();
iListBox->HandleItemRemovalL();
iListBox->Reset();
iMsgIndex = 0;
}
void CSYSINFO60Container3::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 CSYSINFO60Container3::PrintLine(const TDesC& aText)
{
Print(aText);
PrintNewLine();
iOutputText->Des().Zero();
}
void CSYSINFO60Container3::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 + -