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

📄 shapedrawerdocument.cpp

📁 最新官方例子,图形,描述副,基本控件,通讯协议,等等,
💻 CPP
字号:
/**
 * 
 * @brief Definition of CShapeDrawerDocument
 *
 * Copyright (c) EMCC Software Ltd 2003
 * @version 1.0
 */

// INCLUDE FILES

// Class includes
#include "ShapeDrawerDocument.h"


//User Includes
#include "ShapeDrawerApplication.h"
#include "ShapeDrawerAppUi.h"

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

TInt CShapeDrawerDocument::DataSize()
	{
	TInt size =  iModel->DataSize() - iInitialDocumentSize;
	size = (size >= 0 ? size : 0);
	return size;
	}

/**
@function NewLC
@abstract Constructs a CShapeDrawerDocument for the application aApp, 
and return a pointer to the created object
@result Returns a pointer to the instance which is also on the cleanup stack
**/
CShapeDrawerDocument* CShapeDrawerDocument::NewLC(CEikApplication& aApp)
	{
    CShapeDrawerDocument* self = new (ELeave) CShapeDrawerDocument(aApp);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
	}

/**
@function NewL
@abstract Constructs a CShapeDrawerDocument for the application aApp, 
and return a pointer to the created object
@result Returns a pointer to the instance
**/
CShapeDrawerDocument* CShapeDrawerDocument::NewL(CEikApplication& aApp)
	{
    CShapeDrawerDocument* self = NewLC(aApp);
    CleanupStack::Pop(self); 
    return self;
	}

/**
@function ConstructL
@abstract Performs the second phase construction of a CShapeDrawerDocument object
**/
void CShapeDrawerDocument::ConstructL()
	{
	iModel = CShapeListManager::NewL();
	}    

CShapeDrawerDocument::~CShapeDrawerDocument()
	{
	delete iModel;
	iModel = NULL;
	}

/**
@function CShapeDrawerDocument
@abstract Performs the first phase of two phase construction 
@param aApp the application
**/
CShapeDrawerDocument::CShapeDrawerDocument(CEikApplication& aApp)
:	CAknDocument(aApp), iInitialDocumentSize(0)   
	{    
	//	No implementation required
	}


CFileStore* CShapeDrawerDocument::OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs)
	{
	return CEikDocument::OpenFileL(aDoOpen, aFilename, aFs);
	}



/**
@function CreateAppUiL
@abstract Creates a CShapeDrawerAppUi object and return a pointer to it
@result Returns a pointer to the Application's User Interface object
**/
CEikAppUi* CShapeDrawerDocument::CreateAppUiL()
	{
    // Create the application user interface, and return a pointer to it
    CEikAppUi* appUi = new (ELeave) CShapeDrawerAppUi();
    return appUi;
	}

/**
@function StoreL
@abstract Stores the document to the store
@param aStore the store to save the data to
@param aStreamDict the dictionary to hold the stream id of the data stream
**/
void CShapeDrawerDocument::StoreL(CStreamStore& aStore, CStreamDictionary& aStreamDic) const
    {
	//	Get the model to save itself to the store
    TStreamId modelStreamId = iModel->StoreL(aStore);
	//	Add an entry into the dictionary for the model data
    aStreamDic.AssignL(Application()->AppDllUid(), modelStreamId); 
    }


/**
@function RestoreL
@abstract Restores the document from the store
@param aStore the store to containing the data to
@param aStreamDict the dictionary that holds the stream id of the data stream
**/
void CShapeDrawerDocument::RestoreL(const CStreamStore& aStore, const CStreamDictionary& aStreamDic)
    {

    // Restore the model from the appropriate store stream.

    CShapeListManager* newModel = CShapeListManager::NewL();
    CleanupStack::PushL(newModel);

	//	Find the stream id for the model's data
    TStreamId modelStreamId = aStreamDic.At(Application()->AppDllUid());
	//	restore the model from that stream 
    newModel->RestoreL(aStore, modelStreamId);

	//	Now get rid of the old model and set the new one as current
    delete iModel;
    iModel = newModel;
	iInitialDocumentSize = DataSize();
    CleanupStack::Pop(newModel);

	//	Just restored so can't have changed
    SetChanged(EFalse); 
    }

/**
@function Model
@abstract Gets the model associated with the document
@result Returns a reference to a pointer to the model
**/
CShapeListManager* CShapeDrawerDocument::Model() 
    {
    return iModel;
    }


//End of File

⌨️ 快捷键说明

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