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

📄 maininterfaceview.cpp

📁 symbian 3nd 实现短信息收发
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CMainInterfaceView from CAknView
*  Part of  : MainInterface
*  Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/

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

#include <FrMes.rsg>
#include "FrMes.hrh"
#include "MainInterfaceView.h"
#include "MainInterfaceContainer.h"
#include "akntitle.h"
#include "PersonInfoView.h"
#include "MessageView.h"
#include "CardClipview.h"
#include "SendingMesView.h"
#include "SendMesView.h"
#include "BookMesView.h"

#include <aknnotewrappers.h> //用于提示框

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

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

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

CMainInterfaceView::CMainInterfaceView()
{
}

// EPOC default constructor can leave.
void CMainInterfaceView::ConstructL()
{
	BaseConstructL(R_MAININTERFACE_VIEW);
}

// Destructor
CMainInterfaceView::~CMainInterfaceView()
{
	if (iContainer)
    {
		AppUi()->RemoveFromStack(iContainer);
    }
	delete iContainer;
}

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

// ---------------------------------------------------------
// CMainInterfaceView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CMainInterfaceView::HandleCommandL(TInt aCommand)
{
	switch(aCommand)
	{
		case EFrMesCmdMainInterfaceMenu1:
		{
			TInt ntem;
			iContainer->GetSelectedItemIndex(ntem);
			if(ntem == 0)
			{
				AppUi()->ActivateLocalViewL(KPersonInfoViewId);
			}
			else if(ntem == 1)
			{
				AppUi()->ActivateLocalViewL(KCardClipViewId);
			}
			else if(ntem == 2)
			{
				AppUi()->ActivateLocalViewL(KMessageViewId);
			}
			else
			{
				TBuf<32> sTmp;
				CEikonEnv::Static()->ReadResource(sTmp, R_QTN_FRMES_MAIN_OTHER);
				CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
				informationNote->ExecuteLD(sTmp);
			}
		}
		break;
		default:
		AppUi()->HandleCommandL(aCommand);
		break;
	}
}

// ---------------------------------------------------------
// CMainInterfaceView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CMainInterfaceView::HandleClientRectChange()
    {
    if (iContainer)
        {
        iContainer->SetRect(ClientRect());
        }
    }

// ---------------------------------------------------------
// CMainInterfaceView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CMainInterfaceView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
                                    TUid /*aCustomMessageId*/,
                                    const TDesC8& /*aCustomMessage*/)
    {
		iContainer = new (ELeave) CMainInterfaceContainer;
		iContainer->SetMopParent(this);
//      iContainer->ConstructL(ClientRect());
//      AppUi()->AddToStackL(*this, iContainer);

	//===============================modify cba by wzg===============
		TRect rc;
		rc.SetRect(ClientRect().iTl, TSize(176, 144));
		iContainer->ConstructL(rc);
		AppUi()->AddToStackL(*this, iContainer);

	//modify title by wzg
		TBuf<32> sTmpTitle;
		CEikStatusPane* statusPane = StatusPane();
		CEikonEnv::Static()->ReadResource(sTmpTitle,R_FRMES_VIEW_TITLE_MAININTERFACE);
		CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
		titlePane->SetTextL(sTmpTitle);

    }

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

// End of File

⌨️ 快捷键说明

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