📄 allmlistscontainer4.cpp
字号:
/*
* ============================================================================
* Name : CAllMListsContainer4 from AllMListsContainer4.cpp
* Part of : AllMLists
* Created : 16.03.4006 by ToBeReplacedByAuthor
* Implementation notes:
* Initial content was generated by Series 60 Application Wizard.
* Version :
* Copyright: ToBeReplacedByCopyright
* ============================================================================
*/
// INCLUDE FILES
#include <barsread.h> // for TResourceReader
#include <eikfrlbd.h> // for CFormattedCellListBoxData
#include <eikfrlb.h> // for CEikFormattedCellListBox
#include <eikapp.h>
#include <aknlists.h>
#include <akniconarray.h>
#include <AllMLists.rsg>
#include <AllMLists.mbg>
#include "AllMListsContainer4.h"
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CAllMListsContainer4::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CAllMListsContainer4::ConstructL(const TRect& aRect)
{
CreateWindowL();
ShowListBoxL(R_ALLMLISTS_SINGLEPOPUP_LISTBOX);
SetRect(aRect);
ActivateL();
}
// Destructor
CAllMListsContainer4::~CAllMListsContainer4()
{
delete iListBox;
}
// New functions
void CAllMListsContainer4::ShowListBoxL(TInt aResourceId)
{
delete iListBox;
iListBox = NULL;
switch(aResourceId)
{
case R_ALLMLISTS_SINGLEGRAPHICPOPUP_LISTBOX:
{
iListBox = new(ELeave) CAknSingleGraphicPopupMenuStyleListBox;
break;
}
case R_ALLMLISTS_SINGLEGRAPHICPOPUPBT_LISTBOX:
{
iListBox = new(ELeave) CAknSingleGraphicBtPopupMenuStyleListBox;
break;
}
case R_ALLMLISTS_SINGLEHEADINGPOPUP_LISTBOX:
{
iListBox = new(ELeave) CAknSingleHeadingPopupMenuStyleListBox;
break;
}
case R_ALLMLISTS_SINGLEGRAPHICHEADINGPOPUP_LISTBOX:
{
iListBox = new(ELeave) CAknSingleGraphicHeadingPopupMenuStyleListBox;
break;
}
case R_ALLMLISTS_DOUBLEPOPUP_LISTBOX:
{
iListBox = new(ELeave) CAknDoublePopupMenuStyleListBox;
break;
}
case R_ALLMLISTS_DOUBLELARGEGRAPHICPOPUP_LISTBOX:
{
iListBox = new(ELeave) CAknDoubleLargeGraphicPopupMenuStyleListBox;
break;
}
case R_ALLMLISTS_DOUBLE2POPUP_LISTBOX:
{
iListBox = new(ELeave) CAknDouble2PopupMenuStyleListBox;
break;
}
case R_ALLMLISTS_SET_LISTBOX:
{
iListBox = new(ELeave) CAknSetStyleListBox;
break;
}
case R_ALLMLISTS_FORMGRAPHIC_LISTBOX:
{
iListBox = new(ELeave) CAknFormGraphicStyleListBox;
break;
}
case R_ALLMLISTS_FORMGRAPHICWIDE_LISTBOX:
{
iListBox = new(ELeave) CAknFormGraphicWideStyleListBox;
break;
}
case R_ALLMLISTS_SINGLEPOPUP_LISTBOX:
default:
{
iListBox = new(ELeave) CAknSinglePopupMenuStyleListBox;
break;
}
}
// Create listbox
iListBox->SetContainerWindowL( *this );
TResourceReader reader;
CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId );
iListBox->ConstructFromResourceL( reader );
CleanupStack::PopAndDestroy();
// Creates scrollbar.
iListBox->CreateScrollBarFrameL( ETrue );
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
SizeChanged();
// Create an array of icons, reading them from the file
CEikonEnv* eikonEnv = CEikonEnv::Static();
TFileName mbmFile = eikonEnv->EikAppUi()->Application()->BitmapStoreName();
CArrayPtr<CGulIcon>* icons = new(ELeave) CAknIconArray(4);
CleanupStack::PushL(icons);
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllmlistsTick, EMbmAllmlistsTickmask));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllmlistsG1, EMbmAllmlistsGm1));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllmlistsG2, EMbmAllmlistsGm2));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllmlistsG3, EMbmAllmlistsGm3));
CleanupStack::Pop(icons);
// Transfer ownership
iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons );
}
/**
* Handles marking commands for all currently selected games, by passing them
* to the AknSelectionService
*/
void CAllMListsContainer4::HandleMarkCommandL(TInt aCommand)
{
AknSelectionService::HandleMarkableListProcessCommandL (aCommand, iListBox);
}
// ---------------------------------------------------------
// CAllMListsContainer4::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CAllMListsContainer4::SizeChanged()
{
// TODO: Add here control resize code etc.
iListBox->SetRect(Rect());
}
// ---------------------------------------------------------
// CAllMListsContainer4::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CAllMListsContainer4::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CAllMListsContainer4::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CAllMListsContainer4::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iListBox;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CAllMListsContainer4::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CAllMListsContainer4::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// TODO: Add your drawing code here
// example code...
gc.SetPenStyle( CGraphicsContext::ENullPen );
gc.SetBrushColor( KRgbWhite );
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
gc.DrawRect( aRect );
}
TKeyResponse CAllMListsContainer4::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
if((aKeyEvent.iCode == EKeyLeftArrow) ||
(aKeyEvent.iCode == EKeyRightArrow))
{
return EKeyWasNotConsumed;
}
return iListBox->OfferKeyEventL(aKeyEvent, aType);
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -