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

📄 rrview.cpp

📁 symbian s60 SetttingItemList 示例
💻 CPP
字号:
#include  <aknviewappui.h>
#include  <avkon.hrh>
#include  <barsread.h>

#include "rrView.h"
#include "rrContainer.h"
#include "rr.hrh"
#include "rr.rsg"
#include "rrSettingItemList.h"

void CrrView::ConstructL()
	{
	BaseConstructL(R_VIEW);
	}

CrrView::~CrrView()
	{
	if(iContainer)
		{
		AppUi()->RemoveFromViewStack(*this,iContainer);
		}
	delete iContainer;
	iContainer = NULL;
	
    if(iSettingListItem)
    	{
    	AppUi()->RemoveFromViewStack(*this,iSettingListItem);
    	}
    delete iSettingListItem;
    iSettingListItem = NULL;
	}

TUid CrrView::Id() const
	{
	return TViewId;
	}

void CrrView::HandleCommandL(TInt aCommand)
	{
	switch(aCommand)
		{
		case EEditCurrentItem:
			iSettingListItem->EditCurrentItemL();
			break;
		case EAknSoftkeyExit:
			AppUi()->HandleCommandL(EEikCmdExit);
			break;
		case ECommand1:
			iEikonEnv->InfoMsg(_L("Command1"));
			break;
		case ECommand2:
			iEikonEnv->InfoMsg(_L("Command2"));
			break;
		default:
			break;
		}
	}

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

void CrrView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
		                   TUid /*aCustomMessageId*/,const TDesC8& /*aCustomMessage*/)
	{
	if(!iContainer)
		{
		iContainer = new (ELeave) CrrContainer;
		iContainer->SetMopParent(this);
		iContainer->MakeVisible( ETrue );
		iContainer->SetRect( ClientRect() );
		iContainer->ActivateL();
		}
	if(!iSettingListItem)
		{
		iSettingListItem = CrrSettingItemList::NewL();
		iSettingListItem->SetMopParent(this);
		TResourceReader reader;
		CEikonEnv::Static()->CreateResourceReaderLC(reader, R_SETTINGITEMLIST);
		iSettingListItem->ConstructFromResourceL(reader);
		
		// Clean up the buffer allocated above, NOT the reader itself.
		// Cannot use expected item overload of PopAndDestroy() as buffer is inaccessible. 
		CleanupStack::PopAndDestroy();
		AppUi()->AddToViewStackL( *this, iSettingListItem );
		iSettingListItem->ActivateL();
		}
	}


void CrrView::DoDeactivate()
	{
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }
    delete iContainer;
    iContainer = NULL;
    
    if(iSettingListItem)
    	{
    	AppUi()->RemoveFromViewStack(*this,iSettingListItem);
    	}
    delete iSettingListItem;
    iSettingListItem = NULL;
	}



⌨️ 快捷键说明

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