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

📄 helloview.cpp

📁 Symbian多视图下实现菜单的隐藏
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CHelloView from CAknView
*  Part of  : Hello
*  Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/

// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>

#include <Ldcno17song.rsg>

#include "Ldcno17song.hrh"
#include "HelloView.h"
#include "WorldView.h"
#include "HelloContainer.h" 
#include "Ldcno17songAppUi.h"
#include "Ldcno17songDocument.h"
//#include "Ldcno17song.rss"
#include <myhello.mbg>	//for mbm
#include <akncontext.h>	//for CAknContextPane
#include <akntitle.h>	//for CAknTitlePane
//#include "MyHelloAppUi.h"	//for CMyHelloAppUi



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

// C++ default constructor can NOT contain any code, that
// might leave.
//
CHelloView* CHelloView::NewL()
{
    CHelloView* self = NewLC();
    CleanupStack::Pop(self);
    return self;
}

CHelloView* CHelloView::NewLC()
{
    CHelloView* self = new (ELeave) CHelloView;
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
}

CHelloView::CHelloView()
    {
    }

// EPOC default constructor can leave.
void CHelloView::ConstructL()
    {
//    BaseConstructL(R_HELLO_VIEW);
	BaseConstructL(R_HELLO_VIEW);		// .rss中父菜单的CBA;  R_WORLD_VIEW
    }

// Destructor
CHelloView::~CHelloView()
    {

    }

// ---------------------------------------------------------
// TUid CHelloView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CHelloView::Id() const
    {
    return KViewId1;
    }

// ---------------------------------------------------------
// CHelloView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CHelloView::HandleCommandL(TInt aCommand)
    {   
		switch(aCommand)
		{
 		case ELdcno17songCmdLogon:
 			{
				AppUi()->ActivateLocalViewL(KViewId2);
				break;
			}

		default:
			{
				AppUi()->HandleCommandL(aCommand);
				break;
			}
		}
	}
// ---------------------------------------------------------
// CHelloView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CHelloView::HandleClientRectChange()
    {
    if (iContainer)
        {
        iContainer->SetRect(ClientRect());
        }
    }

// ---------------------------------------------------------
// CHelloView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CHelloView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
                                    TUid /*aCustomMessageId*/,
                                    const TDesC8& /*aCustomMessage*/)
    {
	m_pDoc = static_cast<CLdcno17songDocument*>(AppUi()->Document());// 得到文档指针
    iContainer = new (ELeave) CHelloContainer;
    iContainer->SetMopParent(this);
	iContainer->Model(m_pDoc);			// 增加!!
	TRect rc;
	rc.SetRect(ClientRect().iTl, TSize(176, 144));
    iContainer->ConstructL(rc);
    AppUi()->AddToStackL(*this, iContainer);
    }

// ---------------------------------------------------------
// CHelloView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CHelloView::DoDeactivate()
    {
    if (iContainer)
		{
			AppUi()->RemoveFromStack(iContainer);
			
			delete iContainer;
			iContainer = NULL;
		}
    }

// End of File

⌨️ 快捷键说明

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