📄 allgridscontainer.cpp
字号:
/*
* ============================================================================
* Name : CAllGridsContainer from AllGridsContainer.h
* Part of : AllGrids
* Created : 22.03.2006 by ToBeReplacedByAuthor
* Implementation notes:
* Initial content was generated by Series 60 Application Wizard.
* Version :
* Copyright: ToBeReplacedByCopyright
* ============================================================================
*/
// INCLUDE FILES
#include <barsread.h> // for TResourceReader
#include <eikapp.h> // for CEikApplication
#include <akniconarray.h>
#include <aknlists.h> // for CAknGrid
#include <allgrids.mbg> //
#include <allgrids.rsg> //
#include "AllGridsContainer.h"
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CAllGridsContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CAllGridsContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
// Create the grid
iGrid = new( ELeave )CAknCaleMonthStyleGrid;
iGrid->SetContainerWindowL( *this );
TResourceReader reader;
CEikonEnv::Static()->CreateResourceReaderLC( reader, R_ALLGRIDS_CALEMONTH_GRID);
iGrid->ConstructFromResourceL( reader );
CleanupStack::PopAndDestroy();
// 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(6);
CleanupStack::PushL(icons);
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale0, EMbmAllgridsCalem0));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale1, EMbmAllgridsCalem1));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale2));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale31));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale32));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale33));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale34));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale35));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale36));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale37));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale4, EMbmAllgridsCalem4));
icons->AppendL(eikonEnv->CreateIconL(mbmFile, EMbmAllgridsCale5, EMbmAllgridsCalem5));
CleanupStack::Pop(icons);
// Transfer ownership
iGrid->ItemDrawer()->FormattedCellData()->SetIconArray(icons);
SetRect(aRect);
ActivateL();
}
// Destructor
CAllGridsContainer::~CAllGridsContainer()
{
delete iGrid;
}
// ---------------------------------------------------------
// CAllGridsContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CAllGridsContainer::SizeChanged()
{
iGrid->SetRect(Rect());
// Apply layout
TRAPD(err, iGrid->SetLayoutL(EFalse, ETrue, ETrue, 8, 7, TSize(21,19), 1, 1));
}
// ---------------------------------------------------------
// CAllGridsContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CAllGridsContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CAllGridsContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CAllGridsContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iGrid;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CAllGridsContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CAllGridsContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// TODO: Add your drawing code here
// example code...
gc.SetPenStyle( CGraphicsContext::ENullPen );
gc.SetBrushColor( KRgbGray );
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
gc.DrawRect( aRect );
}
TKeyResponse CAllGridsContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
return iGrid->OfferKeyEventL(aKeyEvent, aType);
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -