shapesappui.cpp
来自「series60 应用程序开发的源代码 series60 应用程序开发的源代码」· C++ 代码 · 共 130 行
CPP
130 行
/**
*
* @brief Definition of CShapesAppUi
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDE FILES
// Class includes
#include "ShapesAppUi.h"
// System includes
#include <eikmenup.h> // CEikMenuPane
#include <Shapes.rsg> // R_SHAPES_APP_MENU, R_SHAPES_DATA_DIALOG
// User includes
#include "Shapes.hrh" // Command IDs
#include "ShapesBarChartView.h" // CShapesBarChartView
#include "ShapesForm.h" // CShapesForm
#include "ShapesLineChartView.h" // CShapesLineChartView
#include "ShapesModel.h" // CShapesModel
#include "ShapesPieChartView.h" // CShapesPieChartView
#include "ShapesSplashView.h" // CShapesSplashView
// ================= MEMBER FUNCTIONS =======================
/**
* Symbian OS 2nd phase constructor. Constructs the application views,
* transferring ownership to the AppUi.
*/
void CShapesAppUi::ConstructL()
{
BaseConstructL();
iShapesModel = CShapesModel::NewL();
CShapesSplashView* splashView = CShapesSplashView::NewLC();
AddViewL(splashView); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(splashView);
CShapesBarChartView* barView = CShapesBarChartView::NewLC(*iShapesModel);
AddViewL( barView ); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(barView);
CShapesPieChartView* pieView = CShapesPieChartView::NewLC(*iShapesModel);
AddViewL(pieView); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(pieView);
CShapesLineChartView* lineView = CShapesLineChartView::NewLC(*iShapesModel);
AddViewL(lineView); // transfer ownership to CAknViewAppUi
CleanupStack::Pop(lineView);
// Set the initial (default) view.
SetDefaultViewL(*splashView);
}
/**
* Destructor
*/
CShapesAppUi::~CShapesAppUi()
{
delete iShapesModel;
}
/**
* From MEikMenuObserver. Takes care of dynamic menu initialisation
* (e.g. dimming menu items) for the Shapes application
*
* @param aResourceId the resource ID of the menu pane being initialised
* @param aMenuPane a pointer to that menu pane
*/
void CShapesAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
if (aResourceId == R_SHAPES_APP_MENU)
{
if (!iShapesModel->GetMaxValue())
{
aMenuPane->SetItemDimmed(EShapesBarChartView, ETrue);
aMenuPane->SetItemDimmed(EShapesPieChartView, ETrue);
aMenuPane->SetItemDimmed(EShapesLineChartView, ETrue);
}
}
}
/**
* From CEikAppUi, takes care of command handling for the Shapes
* application.
*
* @param aCommand command to be handled
*/
void CShapesAppUi::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
case EEikCmdExit:
Exit();
break;
case EShapesEnterData:
EditFormL();
break;
case EShapesBarChartView:
ActivateLocalViewL(KBarChartViewId); // Switch view.
break;
case EShapesPieChartView:
ActivateLocalViewL(KPieChartViewId); // Switch view.
break;
case EShapesLineChartView:
ActivateLocalViewL(KLineChartViewId); // Switch view.
break;
default:
break;
}
}
/**
* Displays the form to input the data, which will be used to draw the charts
*/
void CShapesAppUi::EditFormL()
{
CAknForm* form = new (ELeave) CShapesForm(*iShapesModel);
if (form->ExecuteLD(R_SHAPES_DATA_DIALOG))
{
// Do nothing!
}
}
// End of File
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?