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

📄 buildingblocks1.cpp

📁 《UIQ 3 The Complete Guide》书的源代码
💻 CPP
字号:
//
// BuildingBlocks1.cpp - Building blocks example
//
// Copyright (C) UIQ Technology AB, 2007
//
// This material is provided "as is" without any warranty to its performance or functionality. 
// In no event shall UIQ Technology be liable for any damages whatsoever arising out of the
// use or inabilty to use this material. 
//

#include "BuildingBlocks1.h"
#include "BuildingBlocks1.hrh"
#include <BuildingBlocks1.rsg>

#include <QikViewBase.h>
#include <QikCommand.h>
#include <eikstart.h>

//////////////////////////////////////////////////////////////////////////////
// The application Uid here MUST match UID3 defined in the MMP file 
// This is a development UID and must NOT be used in production type software
const TUid KAppSpecificUid={0xEDEAD005};

// internal secondary view id, must be unique amongst this applications views
const TUid KUidListView={0x00000001};

// views within applications are fully identified by the app Uid and secondary view id
#define KViewIdListView TVwsViewId(KAppSpecificUid,KUidListView)

//////////////////////////////////////////////////////////////////////////////////
class CAppSpecificListView : public CQikViewBase
	{
protected: 
	// from CQikViewBase
	TVwsViewId ViewId() const;
	void HandleCommandL(CQikCommand& aCommand);
	void ViewConstructL();
	void ViewDeactivated();
	void ViewActivatedL(const TVwsViewId& aPrevViewId,const TUid aCustomMessageId,const TDesC8& aCustomMessage);
	
public:
	// new methods
	CAppSpecificListView(CAppSpecificUi& aAppUi);
	};

CAppSpecificListView::CAppSpecificListView(CAppSpecificUi& aAppUi) :
	CQikViewBase(aAppUi,KNullViewId)
	{
	}

TVwsViewId CAppSpecificListView::ViewId() const
//
// All views are uniquely identified within the entire system. A TVwsViewId consists of 
// the application uid (uid3) and app specific view uid
//
	{
	return(KViewIdListView);
	}

void CAppSpecificListView::HandleCommandL(CQikCommand& aCommand)
//
// Handle the commands coming in from the controls that can deliver cmds..
//
	{
	switch (aCommand.Id())
		{
	case EAppCmdAbout:
		break;

	default: // e.g. the back button...
		CQikViewBase::HandleCommandL(aCommand);
		break;
		}
	}

void CAppSpecificListView::ViewConstructL()
	{
	ViewConstructFromResourceL(R_APP_VIEW_CONFIGURATIONS);

	TBuf<64>bb;
	iEikonEnv->ReadResourceL(bb,R_STR_VIEW_TITLE);
	ViewContext()->AddTextL(1,bb); 
	}

void CAppSpecificListView::ViewDeactivated()
	{
	}

void CAppSpecificListView::ViewActivatedL(
	const TVwsViewId& aPrevViewId,
	const TUid aCustomMessageId,
	const TDesC8& aCustomMessage)
	{
	}
	
//////////////////////////////////////////////////////////////////////////////
CAppSpecificUi::~CAppSpecificUi()
	{
	}

void CAppSpecificUi::ConstructL()
//
// Normal primary entry point to a Symbian App
//
	{
	CQikAppUi::ConstructL();

	CAppSpecificListView* q=new(ELeave)CAppSpecificListView(*this);
	CleanupStack::PushL(q);
	q->ConstructL();
	AddViewL(*q);	// takes ownership
	CleanupStack::Pop(q);
	}

/////////////////////////////////////////////////////////////////////////////////////////////
// Standard Symbian application framework code when creating an application
class CAppSpecificDocument : public CQikDocument
	{
protected:
	CQikAppUi* CreateAppUiL();
public:
    CAppSpecificDocument(CQikApplication& aApp);
	static CAppSpecificDocument* NewL(CQikApplication& aApp);
protected:
	};

CAppSpecificDocument::CAppSpecificDocument(CQikApplication& aApp) :
	CQikDocument(aApp)
	{
	__DECLARE_NAME(_S("CAppSpecificDocument"));
	}

CAppSpecificDocument* CAppSpecificDocument::NewL(CQikApplication& aApp)
	{
	return(new(ELeave)CAppSpecificDocument(aApp));
	}

CQikAppUi* CAppSpecificDocument::CreateAppUiL()
	{
	return(new(ELeave)CAppSpecificUi);
	}

//////////////////////////////////////////////////////////////////////////////////
// Standard Symbian application framework code when creating an application
class CAppSpecificApplication : public CQikApplication
	{
protected:
	TUid AppDllUid() const;
	CApaDocument* CreateDocumentL();
	}; 

TUid CAppSpecificApplication::AppDllUid() const
    {
    return(KAppSpecificUid);
    }

CApaDocument* CAppSpecificApplication::CreateDocumentL()
    {
    return(CAppSpecificDocument::NewL(*this));
    }

//////////////////////////////////////////////////////////////////////////////////
// Standard Symbian application start up code
LOCAL_C CApaApplication* NewApplication()
    {
    return(new CAppSpecificApplication);
    }

GLDEF_C TInt E32Main()
	{
	return(EikStart::RunApplication(NewApplication));
	}

⌨️ 快捷键说明

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