📄 sttspanescontextcontainer.cpp
字号:
/*
* ============================================================================
* Name : CSttsPanesContextContainer from SttsPanesContextContainer.cpp
* 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 "SttsPanesContextContainer.h"
#include <barsread.h> // BAFL, for resource reader
#include <akntitle.h> // for title pane
#include <akncontext.h>
#include <avkon.hrh>
#include <SttsPanes.mbg>
#include <SttsPanes.rsg>
#include "SttsPanes.hrh"
_LIT( KSttsPanesBitMapFile, "\\system\\apps\\sttspanes\\sttspanes.mbm" );
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CSttsPanesContextContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSttsPanesContextContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
iContextPane = static_cast<CAknContextPane*>(sp->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ));
iListBox = new(ELeave)CAknSingleStyleListBox();
iListBox->SetContainerWindowL(*this);
TResourceReader reader;
CEikonEnv::Static()->CreateResourceReaderLC(reader, R_CONTEXTCONTAINER_LISTBOX);
iListBox->ConstructFromResourceL( reader );
CleanupStack::PopAndDestroy(); // resource stuffs.
iListBox->ActivateL();
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EOn);
SetRect(aRect);
ActivateL();
}
// Destructor
CSttsPanesContextContainer::~CSttsPanesContextContainer()
{
delete iListBox;
}
// ---------------------------------------------------------
// CSttsPanesContextContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CSttsPanesContextContainer::SizeChanged()
{
iListBox->SetRect( Rect());
}
// ---------------------------------------------------------
// CSttsPanesContextContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CSttsPanesContextContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CSttsPanesContextContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CSttsPanesContextContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iListBox;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CSttsPanesContextContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CSttsPanesContextContainer::Draw(const TRect& /*aRect*/) const
{
}
// ---------------------------------------------------------
// CSttsPanesContextContainer::OfferKeyEventL(...)
// Notify key events to editors.
// ---------------------------------------------------------
//
TKeyResponse CSttsPanesContextContainer::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());
ChangeContextPaneL(idx);
}
return ret;
}
return EKeyWasNotConsumed;
}
void CSttsPanesContextContainer::ChangeContextPaneL(const TInt& aIdx)
{
switch (aIdx)
{
case 0: // default
{
iContextPane->SetPictureToDefaultL();
break;
}
case 1: // small indicator
{
iContextPane->SetPictureFromFileL (KSttsPanesBitMapFile, EMbmSttspanesContext1,EMbmSttspanesContext1mask);
break;
}
case 2: // standard image
{
iContextPane->SetPictureFromFileL (KSttsPanesBitMapFile, EMbmSttspanesContext2,EMbmSttspanesContext2mask);
break;
}
case 3: // from resource
{
TResourceReader reader;
iCoeEnv->CreateResourceReaderLC( reader,R_STTSPANES_IMAGE_RESOURCE );
iContextPane->SetFromResourceL( reader );
CleanupStack::PopAndDestroy(); // resource reader
break;
}
default:
{
iContextPane->SetPictureToDefaultL();
break;
}
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -