shapeslinechartview.cpp

来自「series60 应用程序开发的源代码 series60 应用程序开发的源代码」· C++ 代码 · 共 152 行

CPP
152
字号
/**
 * 
 * @brief Definition of CShapesLineChartView
 *
 * Copyright (c) EMCC Software Ltd 2003
 * @version 1.0
 */

// INCLUDE FILES
// Class includes
#include  "ShapesLineChartView.h"

// System includes
#include  <aknviewappui.h>    // CAknViewAppUi
#include  <Shapes.rsg>        // R_SHAPES_LINECHARTVIEW

// User includes
#include  "ShapesLineChartContainer.h"    // CShapesLineChartContainer

// ================= MEMBER FUNCTIONS =======================

/** 
 * Destructor.  Frees up memory for iContainer.
 * Also removes the Control from the control stack
 */
CShapesLineChartView::~CShapesLineChartView()
{
    if (iContainer)
    {
        AppUi()->RemoveFromViewStack(*this, iContainer);
    }

    delete iContainer;
}

/**
 * Symbian OS 2 phase constructor.
 * Constructs the CShapesLineChartView using the NewLC method, popping
 * the constructed object from the CleanupStack before returning it.
 * 
 * @param aShapesModel a reference to the model
 * @return The newly constructed CShapesLineChartView
 */
CShapesLineChartView* CShapesLineChartView::NewL(CShapesModel& aShapesModel)
{
    CShapesLineChartView* self = CShapesLineChartView::NewLC(aShapesModel);
    CleanupStack::Pop(self);
    return self;
}

/**
 * Symbian OS 2 phase constructor.
 * Constructs the CShapesLineChartView using the constructor and ConstructL 
 * method, leaving the constructed object on the CleanupStack before returning it.
 * 
 * @param aShapesModel a reference to the model
 * @return The newly constructed CShapesLineChartView
 */
CShapesLineChartView* CShapesLineChartView::NewLC(CShapesModel& aShapesModel)
{
    CShapesLineChartView* self = new (ELeave) CShapesLineChartView(aShapesModel);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
}

/**
 * Symbian OS 2nd phase constructor.  
 * Uses the superclass constructor to construct the view using the 
 * R_SHAPES_LINECHARTVIEW resource.
 */ 
void CShapesLineChartView::ConstructL()
{
    BaseConstructL(R_SHAPES_LINECHARTVIEW);
}

/**
 * C++ constructor
 * 
 * @param aShapesModel a reference to the model
 */
CShapesLineChartView::CShapesLineChartView(CShapesModel& aShapesModel)
 : iShapesModel(aShapesModel)
{
}

/**
 * Called by the framework
 * @return The Uid for this view
 */
TUid CShapesLineChartView::Id() const
{
    return KLineChartViewId;
}

/**
 * From CEikAppUi, takes care of command handling for this view.
 *
 * @param aCommand command to be handled
 */
void CShapesLineChartView::HandleCommandL(TInt aCommand)
{   
    switch (aCommand)
    {
        case EAknSoftkeyBack:
            AppUi()->HandleCommandL(EEikCmdExit);
            break;
        default:
            break;
    }
}

/**
 * Called by the framework when the view is activated.  Constructs the 
 * container if necessary, setting this view as its MOP parent, and 
 * adding it to the control stack.
 *
 * @param aPrevViewId not used
 * @param aCustomMessageId not used
 * @param aCustomMessage not used
 */
void CShapesLineChartView::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/,
   TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
{
    if (!iContainer)
    {
        iContainer = CShapesLineChartContainer::NewL(iShapesModel, ClientRect());
        iContainer->SetMopParent(this);
        AppUi()->AddToStackL(*this, iContainer);
    }
   }

/**
 * Called by the framework when the view is deactivated.  
 * Removes the container from the control stack and deletes it.
 */
void CShapesLineChartView::DoDeactivate()
{
    if (iContainer)
    {
        AppUi()->RemoveFromViewStack(*this, iContainer);
    }

    delete iContainer;
    iContainer = 0;
}

// End of File

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?