⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sttspanescontextview.cpp

📁 《基于Symbian OS的手机开发与应用实践》这本书的配套源码。
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CSttsPanesContextView from SttsPanesContextView.h
*  Part of  : SttsPanes
*  Created  : 02.04.2005 by ToBeReplacedByAuthor
*  Implementation notes:
*     Initial content was generated by Series 60 Application Wizard.
*  Version  :
*  Copyright: ToBeReplacedByCopyright
* ============================================================================
*/

// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>
#include <eikmenup.h> // for EikMenuPane
#include <SttsPanes.rsg>

#include "SttsPanes.hrh"
#include "SttsPanesContextView.h"
#include "SttsPanesContextContainer.h" 

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

// ---------------------------------------------------------
// CSttsPanesContextView::ConstructL(const TRect& aRect)
// EPOC two-phased constructor
// ---------------------------------------------------------
//
void CSttsPanesContextView::ConstructL()
    {
    BaseConstructL( R_STTSPANES_VIEW2 );
    }

// ---------------------------------------------------------
// CSttsPanesContextView::~CSttsPanesContextView()
// destructor
// ---------------------------------------------------------
//
CSttsPanesContextView::~CSttsPanesContextView()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }

    delete iContainer;
    }

// ---------------------------------------------------------
// TUid CSttsPanesContextView::Id()
// 
// ---------------------------------------------------------
//
TUid CSttsPanesContextView::Id() const
    {
    return TUid::Uid( ESttsPanesContextViewId );
    }

// ---------------------------------------------------------
// CSttsPanesContextView::HandleCommandL(TInt aCommand)
// takes care of view command handling
// ---------------------------------------------------------
//
void CSttsPanesContextView::HandleCommandL(TInt aCommand)
    {   
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
            {
            AppUi()->HandleCommandL(EEikCmdExit);
            break;
            }
        default:
            {
            AppUi()->HandleCommandL( aCommand );
            break;
            }
        }
    }

// ---------------------------------------------------------
// CSttsPanesContextView::HandleClientRectChange()
// ---------------------------------------------------------
//
void CSttsPanesContextView::HandleClientRectChange()
    {
    if ( iContainer )
        {
        iContainer->SetRect( ClientRect() );
        }
    }

// ---------------------------------------------------------
// CSttsPanesContextView::DoActivateL(...)
// 
// ---------------------------------------------------------
//
void CSttsPanesContextView::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
    {
    if (!iContainer)
        {
        iContainer = new (ELeave) CSttsPanesContextContainer;
        iContainer->SetMopParent(this);
        iContainer->ConstructL( ClientRect() );
        iContainer->SetIndex(iIndex);
        AppUi()->AddToStackL( *this, iContainer );
        }
   }

// ---------------------------------------------------------
// CSttsPanesContextView::DoDeactivate()
// 
// ---------------------------------------------------------
//
void CSttsPanesContextView::DoDeactivate()
    {
    if ( iContainer )
        {
        iIndex = iContainer->Index();
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }
    
    delete iContainer;
    iContainer = NULL;
    }

// ----------------------------------------------------------------------------
// CSttsPanesContextView::HandleStatusPaneSizeChange()
// Control of the size change event
// ----------------------------------------------------------------------------
//
void CSttsPanesContextView::HandleStatusPaneSizeChange()
    {
    if ( iContainer )
        {
        iContainer->SetRect( ClientRect() );
        }
    }

// -----------------------------------------------------------------------------
// CSttsPanesContextView::DynInitMenuPaneL()
// 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 CSttsPanesContextView::DynInitMenuPaneL(
    TInt aResourceId,CEikMenuPane* aMenuPane)
    {
    if (aResourceId == R_STTSPANES_APP_MENU)
        {
        aMenuPane->SetItemDimmed( ESttsPanesCmdAppTitleView, EFalse);
        aMenuPane->SetItemDimmed( ESttsPanesCmdAppContextView, ETrue);
        aMenuPane->SetItemDimmed( ESttsPanesCmdAppNavigationView, EFalse);
        }    
    }
// End of File

⌨️ 快捷键说明

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