📄 sttspanestitlecontainer.cpp
字号:
/*
* ============================================================================
* Name : CSttsPanesTitleContainer from SttsPanesTitleContainer.h
* Part of : SttsPanes
* Created : 02.04.2005 by ToBeReplacedByAuthor
* Implementation notes:
* Initial content was generated by Series 60 Application Wizard.
* Version :
* Copyright: ToBeReplacedByCopyright
* ============================================================================
*/
// INCLUDE FILES
#include "SttsPanesTitleContainer.h"
#include <barsread.h> // BAFL, for resource reader
#include <eikspane.h>
#include <avkon.hrh>
#include <akntitle.h> // for title pane
#include <SttsPanes.mbg>
#include <SttsPanes.rsg>
#include "SttsPanes.hrh"
_LIT( KSttsPanesBitMapFile, "\\system\\apps\\sttspanes\\sttspanes.mbm" );
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CSttsPanesTitleContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSttsPanesTitleContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
iTitlePane = static_cast< CAknTitlePane* >(sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ));
iListBox = new(ELeave)CAknSingleStyleListBox();
iListBox->SetContainerWindowL(*this);
TResourceReader reader;
CEikonEnv::Static()->CreateResourceReaderLC(reader, R_TITLECONTAINER_LISTBOX);
iListBox->ConstructFromResourceL( reader );
CleanupStack::PopAndDestroy(); // resource stuffs.
iListBox->ActivateL();
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EOn);
SetRect(aRect);
ActivateL();
}
// Destructor
CSttsPanesTitleContainer::~CSttsPanesTitleContainer()
{
delete iListBox;
}
// ---------------------------------------------------------
// CSttsPanesTitleContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CSttsPanesTitleContainer::SizeChanged()
{
// TODO: Add here control resize code etc.
iListBox->SetRect( Rect());
}
// ---------------------------------------------------------
// CSttsPanesTitleContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CSttsPanesTitleContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CSttsPanesTitleContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CSttsPanesTitleContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iListBox;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CSttsPanesTitleContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CSttsPanesTitleContainer::Draw(const TRect& /*aRect*/) const
{
CWindowGc& gc = SystemGc();
gc.Clear();
}
// ---------------------------------------------------------
// CSttsPanesTitleContainer::OfferKeyEventL(...)
// Notify key events to editors.
// ---------------------------------------------------------
//
TKeyResponse CSttsPanesTitleContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent, TEventCode aType)
{
if ( aType != EEventKey )
{
return EKeyWasNotConsumed;
}
if (aKeyEvent.iCode == EKeyRightArrow || aKeyEvent.iCode == EKeyLeftArrow)
{
return EKeyWasNotConsumed;
}
if (iListBox)
{
TKeyResponse ret = iListBox->OfferKeyEventL(aKeyEvent, aType);
if (aKeyEvent.iCode == EKeyUpArrow || aKeyEvent.iCode == EKeyDownArrow)
{
TInt idx (iListBox->CurrentItemIndex());
ChangeTitlePaneL(idx);
}
return ret;
}
return EKeyWasNotConsumed;
}
void CSttsPanesTitleContainer::ChangeTitlePaneL(const TInt& aIdx)
{
switch (aIdx)
{
case 0:
{
iTitlePane->SetTextToDefaultL();
break;
}
case 1:
{
iTitlePane->SetTextL(_L("Short Title"));
break;
}
case 2:
{
iTitlePane->SetTextL(_L("This is a long title that wraps"));
break;
}
case 3:
{
iTitlePane->SetTextL(_L("This is a very very long title and can't display in two lines"));
break;
}
case 4:
{
iTitlePane->SetPictureFromFileL(KSttsPanesBitMapFile,EMbmSttspanesTitle1);
break;
}
case 5:
{
iTitlePane->SetPictureFromFileL(KSttsPanesBitMapFile,EMbmSttspanesTitle2, EMbmSttspanesTitle2mask);
break;
}
default:
{
iTitlePane->SetTextToDefaultL();
break;
}
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -