📄 hwrmtestappcontainer.cpp
字号:
/*
* ==============================================================================
* Name : HWRMTestAppContainer.h
* Part of : HWRMTestApp
* Interface :
* Description : HWRM Test application container implementation
* Version :
*
* Copyright (c) 2002-2006 Nokia Corporation.
* This material, including documentation and any related
* computer programs, is protected by copyright controlled by
* Nokia Corporation.
* ==============================================================================
*/
// INCLUDE FILES
#include <eikedwin.h>
#include <aknutils.h>
#include <HWRMTestApp.rsg>
#include "HWRMTestAppContainer.h"
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// CHWRMTestAppContainer::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CHWRMTestAppContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
// Set up a read-only editor window for displaying messages
iEdwin = new ( ELeave ) CEikEdwin();
iEdwin->SetContainerWindowL( *this );
TInt edwinFlags = CEikEdwin::ENoAutoSelection;
edwinFlags |= CEikEdwin::EJustAutoCurEnd;
edwinFlags |= CEikEdwin::EReadOnly;
edwinFlags |= CEikEdwin::EInclusiveSizeFixed;
iEdwin->ConstructL( edwinFlags );
iEdwin->CreateScrollBarFrameL();
iEdwin->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
SetRect(aRect);
ActivateL();
}
// -----------------------------------------------------------------------------
// CHWRMTestAppContainer::~CHWRMTestAppContainer
// Destructor
// -----------------------------------------------------------------------------
//
CHWRMTestAppContainer::~CHWRMTestAppContainer()
{
delete iEdwin;
}
// -----------------------------------------------------------------------------
// CHWRMTestAppContainer::SizeChanged
// Called by framework when the view size is changed
// -----------------------------------------------------------------------------
//
void CHWRMTestAppContainer::SizeChanged()
{
iEdwin->SetRect( Rect() );
}
// -----------------------------------------------------------------------------
// CHWRMTestAppContainer::CountComponentControls
// Return number of controls in container
// -----------------------------------------------------------------------------
//
TInt CHWRMTestAppContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// -----------------------------------------------------------------------------
// CHWRMTestAppContainer::ComponentControl
// Return component control
// -----------------------------------------------------------------------------
//
CCoeControl* CHWRMTestAppContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iEdwin;
default:
return NULL;
}
}
// -----------------------------------------------------------------------------
// CHWRMTestAppContainer::Draw
// -----------------------------------------------------------------------------
//
void CHWRMTestAppContainer::Draw(const TRect& /*aRect*/) const
{
}
// -----------------------------------------------------------------------------
// CHWRMTestAppContainer::HandleControlEventL
// -----------------------------------------------------------------------------
//
void CHWRMTestAppContainer::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
}
// -----------------------------------------------------------------------------
// CHWRMTestAppContainer::AddMessageL
// Add message to editor window in the container
// -----------------------------------------------------------------------------
//
void CHWRMTestAppContainer::AddMessageL( const TDesC& aMsg ) const
{
CPlainText* text = iEdwin->Text();
text->InsertL( text->DocumentLength(), aMsg );
text->InsertL( text->DocumentLength(), CEditableText::ELineBreak );
iEdwin->HandleTextChangedL();
iEdwin->SetSelectionL( text->DocumentLength(), text->DocumentLength() );
iEdwin->SetFocus( ETrue );
}
// -----------------------------------------------------------------------------
// CHWRMTestAppContainer::OfferKeyEventL
// Pass key event to appropriate controls
// -----------------------------------------------------------------------------
//
TKeyResponse CHWRMTestAppContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType )
{
return iEdwin->OfferKeyEventL( aKeyEvent, aType );
}
// ---------------------------------------------------------
// CHWRMTestAppContainer::HandleResourceChange()
// Called by framework when layout is changed.
// ---------------------------------------------------------
//
void CHWRMTestAppContainer::HandleResourceChange(TInt aType)
{
CCoeControl::HandleResourceChange(aType);
// ADDED FOR SCALABLE UI SUPPORT
// *****************************
if ( aType==KEikDynamicLayoutVariantSwitch )
{
TRect rect;
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
SetRect(rect);
}
// Redraw the editor window
iEdwin->DrawNow();
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -