compoundcontrolview.cpp

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

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

// INCLUDES

//  Class include
#include "CompoundControlView.h"

// System includes
#include <aknviewappui.h>    // CAknViewAppUi
#include <Controls.rsg>    // R_Controls_VIEW2

// User includes
#include "Controls.hrh"    // TControlsViewNumber
#include "CompoundControl.h"    // CCompoundControl

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

/** 
* Destructor.  Frees up memory for the iLabel.
*/
CCompoundControlView::~CCompoundControlView()
{
    delete iContainer;
}

/**
* Symbian OS 2 phase constructor.
* Constructs the CCompoundControlView using the NewLC method, popping
* the constructed object from the CleanupStack before returning it.
* 
* @param aRect The rectangle for this window
* @return The newly constructed CCompoundControlView
*/
CCompoundControlView* CCompoundControlView::NewL()
{
    CCompoundControlView* self = CCompoundControlView::NewLC();
    CleanupStack::Pop(self);
    return self;
}

/**
* Symbian OS 2 phase constructor.
* Constructs the CCompoundControlView using the constructor and ConstructL 
* method, leaving the constructed object on the CleanupStack before returning it.
* 
* @param aRect The rectangle for this window
* @return The newly constructed CCompoundControlView
*/
CCompoundControlView* CCompoundControlView::NewLC()
{
    CCompoundControlView* self = new (ELeave) CCompoundControlView();
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
}

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

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

/**
* 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.
*/
void CCompoundControlView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
                                         TUid /*aCustomMessageId*/,
                                         const TDesC8& /*aCustomMessage*/)
{
    if (!iContainer)
    {
        iContainer = CCompoundControl::NewL(ClientRect(), NULL);
        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 CCompoundControlView::DoDeactivate()
{
    if (iContainer)
    {
        AppUi()->RemoveFromStack(iContainer);
        delete iContainer;
        iContainer = NULL;
    }
}

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

// End of File

⌨️ 快捷键说明

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