epoc32/include/mw/apaapp.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/apaapp.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,183 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// The main startup of the AppArc server
    1.18 +// 
    1.19 +// apaapp.h
    1.20 +//
    1.21 +
    1.22 +#ifndef __APAAPP_H__
    1.23 +#define __APAAPP_H__
    1.24 +
    1.25 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.26 +#if !defined(__APAID_PARTNER_H__)
    1.27 +#include "apaidpartner.h"
    1.28 +#endif
    1.29 +#endif //SYMBIAN_ENABLE_SPLIT_HEADERS
    1.30 +#include <e32std.h>
    1.31 +#include <e32base.h>
    1.32 +#include <apadef.h>
    1.33 +#include <apaid.h>
    1.34 +
    1.35 +class CApaApplication;
    1.36 +class CApaDocument;
    1.37 +class CApaProcess;
    1.38 +class CDictionaryStore;
    1.39 +class CImplementationInformation;
    1.40 +class CApaAppServer;
    1.41 +
    1.42 +
    1.43 +/** Defines the basic behaviour for applications.
    1.44 +
    1.45 +The class defines the basic twin roles of an application class as a factory 
    1.46 +that creates concrete document objects, and as a supplier of utility functions 
    1.47 +not specific to any particular instance of a document. For example, returning 
    1.48 +an application's caption, or accessing its .ini file.
    1.49 +
    1.50 +The class is derived from by the UI framework and is further derived from 
    1.51 +by the UI application.
    1.52 +
    1.53 +@publishedAll 
    1.54 +@released 
    1.55 +@see CEikApplication */
    1.56 +class CApaApplication : public CBase
    1.57 +// base class for applications; allows creation of documents & file stores + display of app icon and name.
    1.58 +	{
    1.59 +public:
    1.60 +	/** Completes construction of this application object.
    1.61 +	
    1.62 +	The function is called after an instance of a derived class has been successfully 
    1.63 +	created using the ordinal 1 function of the application DLL.
    1.64 +	
    1.65 +	After calling this function, an application can create document objects.
    1.66 +	
    1.67 +	An implementation of this function is supplied by the UI framework.
    1.68 +	
    1.69 +	@see CEikApplication */
    1.70 +	virtual void PreDocConstructL() = 0; // call once before creating document
    1.71 +	
    1.72 +	/** Creates a document object.
    1.73 +	
    1.74 +	The function is called by the application process when a new document is required. 
    1.75 +	The application process adds the new document to its list of documents.
    1.76 +	
    1.77 +	An implementation of this function is supplied by the UI framework.
    1.78 +	
    1.79 +	@param aProcess A pointer to the process associated with the application.
    1.80 +	@return A pointer to the newly created document.
    1.81 +	@see CApaProcess::AddNewDocumentL() */
    1.82 +	virtual CApaDocument* CreateDocumentL(CApaProcess* aProcess) = 0;
    1.83 +	
    1.84 +	/** Gets the application specific UID.
    1.85 +	
    1.86 +	The UID is used to differentiate between UI applications.
    1.87 +	
    1.88 +	An implementation of this function must be supplied by the UI application.
    1.89 +	
    1.90 +	@return The application specific UID. */
    1.91 +	virtual TUid AppDllUid() const = 0;
    1.92 +public: // utility functions
    1.93 +	IMPORT_C static TInt GenerateFileName(RFs& aFs, TFileName& aRootName);
    1.94 +	IMPORT_C CDictionaryStore* OpenIniFileL(RFs& aFs) const;
    1.95 +	
    1.96 +	/** Opens the .ini file associated with the application, constructs the dictionary 
    1.97 +	store object, returns a pointer to it and puts the pointer onto the cleanupstack.
    1.98 +	
    1.99 +	The .ini file must be created, if it does not already exist.
   1.100 +	
   1.101 +	An implementation of this function is supplied by the UI framework.
   1.102 +	
   1.103 +	@param aFs Handle to a file server session 
   1.104 +	@return A pointer to the dictionary store object that represents the application's .ini file. 
   1.105 +	@see CEikApplication */
   1.106 +	virtual CDictionaryStore* OpenIniFileLC(RFs& aFs) const = 0;
   1.107 +public: // enquiry functions
   1.108 +	IMPORT_C virtual TFileName AppFullName() const; // returns the full path and name of the app
   1.109 +	/** Returns the capabilities of the application.
   1.110 +	
   1.111 +	Application capability information is represented by an instance of a TApaAppCapability 
   1.112 +	object wrapped in a packaged modifiable buffer descriptor.
   1.113 +	
   1.114 +	The function is called from a number of places within the application framework.
   1.115 +	
   1.116 +	An implementation of this function is supplied by the UI framework.
   1.117 +	
   1.118 +	@param aInfo A packaged modifiable buffer descriptor (a TPckgBuf), encapsulating 
   1.119 +	a TApaAppCapability object. 
   1.120 +	@see CEikApplication
   1.121 +	@see TApaAppCapability
   1.122 +	@see TPckgBuf */
   1.123 +	virtual void Capability(TDes8& aInfo) const = 0;
   1.124 +public:	// accessor function
   1.125 +	IMPORT_C TFileName DllName() const;
   1.126 +	IMPORT_C ~CApaApplication();
   1.127 +	IMPORT_C virtual void NewAppServerL(CApaAppServer*& aAppServer);
   1.128 +protected:
   1.129 +	IMPORT_C CApaApplication();
   1.130 +public: // internal use only
   1.131 +	void SetAppFileNameRef(const RBuf& aFileName);
   1.132 +private:
   1.133 +	IMPORT_C virtual void CApaApplication_Reserved1();
   1.134 +	IMPORT_C virtual void CApaApplication_Reserved2();
   1.135 +private:
   1.136 +	const RBuf* iAppFileNameRef;  // not owned
   1.137 +	TUid iEComDtorKey;
   1.138 +//	friend class CApaProcess;
   1.139 +	friend class TApaApplicationFactory; // so that it can access iDtorKey
   1.140 +private:
   1.141 +	TInt iCApaApplication_Reserved1;
   1.142 +	};
   1.143 +
   1.144 +
   1.145 +/** Encapsulates the functionality of creating an application, whether it be via a factory function
   1.146 +or an ECOM plugin. Instances of this class can usually be created implicitly when required as
   1.147 +function parameters - just specify the function pointer, ECOM plugin UID or CImplementationInformation
   1.148 +reference.
   1.149 +
   1.150 +@publishedAll
   1.151 +@released
   1.152 +@see CApaProcess
   1.153 +@see EikStart */
   1.154 +class TApaApplicationFactory
   1.155 +	{
   1.156 +public:
   1.157 +	typedef CApaApplication* (*TFunction)();
   1.158 +public:
   1.159 +	IMPORT_C TApaApplicationFactory();
   1.160 +	IMPORT_C TApaApplicationFactory(TFunction aFunction);
   1.161 +	IMPORT_C TApaApplicationFactory(const CImplementationInformation& aEmbeddedApplicationInformation);
   1.162 +	IMPORT_C TApaApplicationFactory(TUid aEmbeddedApplicationUid);
   1.163 +	CApaApplication* CreateApplicationL() const;
   1.164 +	HBufC* AppFileNameL() const;
   1.165 +	TUid AppFileUid() const;
   1.166 +private:
   1.167 +	enum TType
   1.168 +		{
   1.169 +		ETypeFunction,							// if iType is this, iData is a TFunction
   1.170 +		ETypeEmbeddedApplicationInformation,	// if iType is this, iData is an ECOM CImplementationInformation
   1.171 +		ETypeEmbeddedApplicationUid				// if iType is this, iData is an ECOM implementation TUid
   1.172 +		};
   1.173 +private:
   1.174 +	static CApaApplication* CreateEmbeddedApplicationL(TUid aUid);
   1.175 +	static HBufC* EmbeddedApplicationDisplayNameLC(TUid aUid);
   1.176 +	static HBufC* FullAppFileNameL(const TDesC& aAppName);
   1.177 +	static void CleanupImplementationArray(TAny* aImplementationArray);
   1.178 +private:
   1.179 +	TType iType;
   1.180 +	TUint iData;
   1.181 +	mutable CApaApplication* iApplication; // used to be iSpare1
   1.182 +	TInt iSpare2;
   1.183 +	};
   1.184 +
   1.185 +	
   1.186 +#endif	// __APAAPP_H__