?? megcontainer.cpp
字號:
/*
* ============================================================================
* Name : CMegContainer from CCoeControl, MCoeControlObserver
* Part of : Hello
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <EveryDay.rsg>
#include "EveryDay.hrh"
#include "MegContainer.h"
#include <barsread.h>
#include <aknnotewrappers.h>
#include "EveryDayAppUi.h"
#include "common.h"
#include <aknlists.h>
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CMegContainer::CMegContainer()
{
m_pList = NULL;
}
// EPOC default constructor can leave.
void CMegContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
m_pList = new( ELeave ) CAknDoubleLargeStyleListBox();
CleanupStack::PushL(m_pList);
m_pList->SetContainerWindowL(*this);
TResourceReader rReader;
iCoeEnv->CreateResourceReaderLC(rReader, R_MESSAGE_LISTBOX);
m_pList->ConstructFromResourceL(rReader);
m_pList->CreateScrollBarFrameL( ETrue );
m_pList->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
CleanupStack::PopAndDestroy();
CArrayPtr<CGulIcon>* icons = new( ELeave ) CAknIconArray(4);
CleanupStack::PushL(icons);
CEveryDayAppUi* pApp = (CEveryDayAppUi*)CEikonEnv::Static()->AppUi();
icons->AppendL(pApp->LoadGraphicsL(10));
icons->AppendL(pApp->LoadGraphicsL(11));
icons->AppendL(pApp->LoadGraphicsL(12));
icons->AppendL(pApp->LoadGraphicsL(13));
CleanupStack::Pop(icons);
m_pList->ItemDrawer()->ColumnData()->SetIconArrayL(icons);
m_pList->ActivateL();
CleanupStack::Pop(m_pList);
m_pList->SetFocus(ETrue);
SetRect(aRect);
ActivateL();
}
// Destructor
CMegContainer::~CMegContainer()
{
MEM_FREE(m_pList);
}
// ---------------------------------------------------------
// CMegContainer::FocusTo(TInt aCommand)
// Change foccused control.
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CMegContainer::FocusTo(TInt aCommand)
{
}
// ---------------------------------------------------------
// CMegContainer::SizeChanged()
// Called by framework when the view size is changed
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CMegContainer::SizeChanged()
{
if( NULL != m_pList )
{
m_pList->SetRect(Rect());
}
}
// ---------------------------------------------------------
// CMegContainer::CountComponentControls() const
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CMegContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CMegContainer::ComponentControl(TInt aIndex) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
CCoeControl* CMegContainer::ComponentControl(TInt aIndex) const
{
return m_pList;
}
// ---------------------------------------------------------
// CMegContainer::Draw(const TRect& aRect) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CMegContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushColor(KRgbYellow);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
}
// ---------------------------------------------------------
// CMegContainer::OfferKeyEventL(...)
// Notify key events to editors.
// (other items were commented in a header).
// ---------------------------------------------------------
//
TKeyResponse CMegContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent, TEventCode aType)
{
if(m_pList != NULL)
{
if((aType == EEventKey) && (aKeyEvent.iCode == EKeyDownArrow))
{
return m_pList->OfferKeyEventL(aKeyEvent, aType);
}
else if((aType == EEventKey) && (aKeyEvent.iCode == EKeyUpArrow))
{
return m_pList->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasConsumed;
}
else
{
return EKeyWasNotConsumed;
}
}
// ---------------------------------------------------------
// CMegContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CMegContainer::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
}
TInt CMegContainer::GetIndex()
{
TInt nIndex = m_pList->CurrentItemIndex();
return nIndex;
}
// End of File
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -