📄 allgridsappui.cpp
字号:
/*
* ============================================================================
* Name : CAllGridsAppUi from AllGridsAppui.cpp
* 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 <avkon.hrh>
#include <AllGrids.rsg>
#include "AllGrids.hrh"
#include "AllGridsAppui.h"
#include "AllGridsView.h"
#include "AllGridsView2.h"
#include "AllGridsView3.h"
#include "AllGridsView4.h"
// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CAllGridsAppUi::ConstructL()
//
// ----------------------------------------------------------
//
void CAllGridsAppUi::ConstructL()
{
BaseConstructL(EAknEnableSkin);
// Show tabs for main views from resources
CEikStatusPane* sp = StatusPane();
// Fetch pointer to the default navi pane control
iNaviPane = (CAknNavigationControlContainer*)sp->ControlL(
TUid::Uid(EEikStatusPaneUidNavi));
// Tabgroup has been read from resource and it were pushed to the navi pane.
// Get pointer to the navigation decorator with the ResourceDecorator() function.
// Application owns the decorator and it has responsibility to delete the object.
iDecoratedTabGroup = iNaviPane->ResourceDecorator();
if (iDecoratedTabGroup)
{
iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl();
iTabGroup->SetObserver( this );
}
CAllGridsView* view1 = new (ELeave) CAllGridsView;
CleanupStack::PushL( view1 );
view1->ConstructL();
AddViewL( view1 ); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(); // view1
CAllGridsView2* view2 = new (ELeave) CAllGridsView2;
CleanupStack::PushL( view2 );
view2->ConstructL();
AddViewL( view2 ); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(); // view3
CAllGridsView3* view3 = new (ELeave) CAllGridsView3;
CleanupStack::PushL( view3 );
view3->ConstructL();
AddViewL( view3 ); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(); // view3
CAllGridsView4* view4 = new (ELeave) CAllGridsView4;
CleanupStack::PushL( view4 );
view4->ConstructL();
AddViewL( view4 ); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(); // view4
SetDefaultViewL(*view1);
}
// ----------------------------------------------------
// CAllGridsAppUi::~CAllGridsAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CAllGridsAppUi::~CAllGridsAppUi()
{
delete iDecoratedTabGroup;
}
// ------------------------------------------------------------------------------
// CAllGridsAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
// This function is called by the EIKON framework just before it displays
// a menu pane. Its default implementation is empty, and by overriding it,
// the application can set the state of menu items dynamically according
// to the state of application data.
// ------------------------------------------------------------------------------
//
void CAllGridsAppUi::DynInitMenuPaneL(
TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
{
}
// ----------------------------------------------------
// CAllGridsAppUi::HandleKeyEventL(
// const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// takes care of key event handling
// ----------------------------------------------------
//
TKeyResponse CAllGridsAppUi::HandleKeyEventL(
const TKeyEvent& aKeyEvent,TEventCode aType)
{
if ( iTabGroup == NULL )
{
return EKeyWasNotConsumed;
}
if ( aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow )
{
return iTabGroup->OfferKeyEventL( aKeyEvent, aType );
}
else
{
return EKeyWasNotConsumed;
}
}
// ----------------------------------------------------
// CAllGridsAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void CAllGridsAppUi::HandleCommandL(TInt aCommand)
{
switch ( aCommand )
{
case EAllGridsCmdAppCaleView:
case EAllGridsCmdAppGMSView:
case EAllGridsCmdAppPinbView:
case EAllGridsCmdAppQDialView:
{
TInt index = aCommand-EAllGridsCmdAppCaleView;
iTabGroup->SetActiveTabByIndex(index);
TabChangedL(index);
break;
}
case EEikCmdExit:
{
Exit();
break;
}
default:
break;
}
}
// ----------------------------------------------------
// CAllGridsAppUi::TabChangedL(TInt aIndex)
// This method gets called when CAknTabGroup active
// tab has changed.
// ----------------------------------------------------
//
void CAllGridsAppUi::TabChangedL(TInt aIndex)
{
ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(aIndex)));
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -