epoc32/include/mw/apaapp.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     2
// All rights reserved.
williamr@4
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@4
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     7
//
williamr@4
     8
// Initial Contributors:
williamr@4
     9
// Nokia Corporation - initial contribution.
williamr@4
    10
//
williamr@4
    11
// Contributors:
williamr@4
    12
//
williamr@4
    13
// Description:
williamr@4
    14
// The main startup of the AppArc server
williamr@4
    15
// 
williamr@4
    16
// apaapp.h
williamr@4
    17
//
williamr@4
    18
williamr@4
    19
#ifndef __APAAPP_H__
williamr@4
    20
#define __APAAPP_H__
williamr@4
    21
williamr@4
    22
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@4
    23
#if !defined(__APAID_PARTNER_H__)
williamr@4
    24
#include "apaidpartner.h"
williamr@4
    25
#endif
williamr@4
    26
#endif //SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@4
    27
#include <e32std.h>
williamr@4
    28
#include <e32base.h>
williamr@4
    29
#include <apadef.h>
williamr@4
    30
#include <apaid.h>
williamr@4
    31
williamr@4
    32
class CApaApplication;
williamr@4
    33
class CApaDocument;
williamr@4
    34
class CApaProcess;
williamr@4
    35
class CDictionaryStore;
williamr@4
    36
class CImplementationInformation;
williamr@4
    37
class CApaAppServer;
williamr@4
    38
williamr@4
    39
williamr@4
    40
/** Defines the basic behaviour for applications.
williamr@4
    41
williamr@4
    42
The class defines the basic twin roles of an application class as a factory 
williamr@4
    43
that creates concrete document objects, and as a supplier of utility functions 
williamr@4
    44
not specific to any particular instance of a document. For example, returning 
williamr@4
    45
an application's caption, or accessing its .ini file.
williamr@4
    46
williamr@4
    47
The class is derived from by the UI framework and is further derived from 
williamr@4
    48
by the UI application.
williamr@4
    49
williamr@4
    50
@publishedAll 
williamr@4
    51
@released 
williamr@4
    52
@see CEikApplication */
williamr@4
    53
class CApaApplication : public CBase
williamr@4
    54
// base class for applications; allows creation of documents & file stores + display of app icon and name.
williamr@4
    55
	{
williamr@4
    56
public:
williamr@4
    57
	/** Completes construction of this application object.
williamr@4
    58
	
williamr@4
    59
	The function is called after an instance of a derived class has been successfully 
williamr@4
    60
	created using the ordinal 1 function of the application DLL.
williamr@4
    61
	
williamr@4
    62
	After calling this function, an application can create document objects.
williamr@4
    63
	
williamr@4
    64
	An implementation of this function is supplied by the UI framework.
williamr@4
    65
	
williamr@4
    66
	@see CEikApplication */
williamr@4
    67
	virtual void PreDocConstructL() = 0; // call once before creating document
williamr@4
    68
	
williamr@4
    69
	/** Creates a document object.
williamr@4
    70
	
williamr@4
    71
	The function is called by the application process when a new document is required. 
williamr@4
    72
	The application process adds the new document to its list of documents.
williamr@4
    73
	
williamr@4
    74
	An implementation of this function is supplied by the UI framework.
williamr@4
    75
	
williamr@4
    76
	@param aProcess A pointer to the process associated with the application.
williamr@4
    77
	@return A pointer to the newly created document.
williamr@4
    78
	@see CApaProcess::AddNewDocumentL() */
williamr@4
    79
	virtual CApaDocument* CreateDocumentL(CApaProcess* aProcess) = 0;
williamr@4
    80
	
williamr@4
    81
	/** Gets the application specific UID.
williamr@4
    82
	
williamr@4
    83
	The UID is used to differentiate between UI applications.
williamr@4
    84
	
williamr@4
    85
	An implementation of this function must be supplied by the UI application.
williamr@4
    86
	
williamr@4
    87
	@return The application specific UID. */
williamr@4
    88
	virtual TUid AppDllUid() const = 0;
williamr@4
    89
public: // utility functions
williamr@4
    90
	IMPORT_C static TInt GenerateFileName(RFs& aFs, TFileName& aRootName);
williamr@4
    91
	IMPORT_C CDictionaryStore* OpenIniFileL(RFs& aFs) const;
williamr@4
    92
	
williamr@4
    93
	/** Opens the .ini file associated with the application, constructs the dictionary 
williamr@4
    94
	store object, returns a pointer to it and puts the pointer onto the cleanupstack.
williamr@4
    95
	
williamr@4
    96
	The .ini file must be created, if it does not already exist.
williamr@4
    97
	
williamr@4
    98
	An implementation of this function is supplied by the UI framework.
williamr@4
    99
	
williamr@4
   100
	@param aFs Handle to a file server session 
williamr@4
   101
	@return A pointer to the dictionary store object that represents the application's .ini file. 
williamr@4
   102
	@see CEikApplication */
williamr@4
   103
	virtual CDictionaryStore* OpenIniFileLC(RFs& aFs) const = 0;
williamr@4
   104
public: // enquiry functions
williamr@4
   105
	IMPORT_C virtual TFileName AppFullName() const; // returns the full path and name of the app
williamr@4
   106
	/** Returns the capabilities of the application.
williamr@4
   107
	
williamr@4
   108
	Application capability information is represented by an instance of a TApaAppCapability 
williamr@4
   109
	object wrapped in a packaged modifiable buffer descriptor.
williamr@4
   110
	
williamr@4
   111
	The function is called from a number of places within the application framework.
williamr@4
   112
	
williamr@4
   113
	An implementation of this function is supplied by the UI framework.
williamr@4
   114
	
williamr@4
   115
	@param aInfo A packaged modifiable buffer descriptor (a TPckgBuf), encapsulating 
williamr@4
   116
	a TApaAppCapability object. 
williamr@4
   117
	@see CEikApplication
williamr@4
   118
	@see TApaAppCapability
williamr@4
   119
	@see TPckgBuf */
williamr@4
   120
	virtual void Capability(TDes8& aInfo) const = 0;
williamr@4
   121
public:	// accessor function
williamr@4
   122
	IMPORT_C TFileName DllName() const;
williamr@4
   123
	IMPORT_C ~CApaApplication();
williamr@4
   124
	IMPORT_C virtual void NewAppServerL(CApaAppServer*& aAppServer);
williamr@4
   125
protected:
williamr@4
   126
	IMPORT_C CApaApplication();
williamr@4
   127
public: // internal use only
williamr@4
   128
	void SetAppFileNameRef(const RBuf& aFileName);
williamr@4
   129
private:
williamr@4
   130
	IMPORT_C virtual void CApaApplication_Reserved1();
williamr@4
   131
	IMPORT_C virtual void CApaApplication_Reserved2();
williamr@4
   132
private:
williamr@4
   133
	const RBuf* iAppFileNameRef;  // not owned
williamr@4
   134
	TUid iEComDtorKey;
williamr@4
   135
//	friend class CApaProcess;
williamr@4
   136
	friend class TApaApplicationFactory; // so that it can access iDtorKey
williamr@4
   137
private:
williamr@4
   138
	TInt iCApaApplication_Reserved1;
williamr@4
   139
	};
williamr@4
   140
williamr@4
   141
williamr@4
   142
/** Encapsulates the functionality of creating an application, whether it be via a factory function
williamr@4
   143
or an ECOM plugin. Instances of this class can usually be created implicitly when required as
williamr@4
   144
function parameters - just specify the function pointer, ECOM plugin UID or CImplementationInformation
williamr@4
   145
reference.
williamr@4
   146
williamr@4
   147
@publishedAll
williamr@4
   148
@released
williamr@4
   149
@see CApaProcess
williamr@4
   150
@see EikStart */
williamr@4
   151
class TApaApplicationFactory
williamr@4
   152
	{
williamr@4
   153
public:
williamr@4
   154
	typedef CApaApplication* (*TFunction)();
williamr@4
   155
public:
williamr@4
   156
	IMPORT_C TApaApplicationFactory();
williamr@4
   157
	IMPORT_C TApaApplicationFactory(TFunction aFunction);
williamr@4
   158
	IMPORT_C TApaApplicationFactory(const CImplementationInformation& aEmbeddedApplicationInformation);
williamr@4
   159
	IMPORT_C TApaApplicationFactory(TUid aEmbeddedApplicationUid);
williamr@4
   160
	CApaApplication* CreateApplicationL() const;
williamr@4
   161
	HBufC* AppFileNameL() const;
williamr@4
   162
	TUid AppFileUid() const;
williamr@4
   163
private:
williamr@4
   164
	enum TType
williamr@4
   165
		{
williamr@4
   166
		ETypeFunction,							// if iType is this, iData is a TFunction
williamr@4
   167
		ETypeEmbeddedApplicationInformation,	// if iType is this, iData is an ECOM CImplementationInformation
williamr@4
   168
		ETypeEmbeddedApplicationUid				// if iType is this, iData is an ECOM implementation TUid
williamr@4
   169
		};
williamr@4
   170
private:
williamr@4
   171
	static CApaApplication* CreateEmbeddedApplicationL(TUid aUid);
williamr@4
   172
	static HBufC* EmbeddedApplicationDisplayNameLC(TUid aUid);
williamr@4
   173
	static HBufC* FullAppFileNameL(const TDesC& aAppName);
williamr@4
   174
	static void CleanupImplementationArray(TAny* aImplementationArray);
williamr@4
   175
private:
williamr@4
   176
	TType iType;
williamr@4
   177
	TUint iData;
williamr@4
   178
	mutable CApaApplication* iApplication; // used to be iSpare1
williamr@4
   179
	TInt iSpare2;
williamr@4
   180
	};
williamr@4
   181
williamr@4
   182
	
williamr@4
   183
#endif	// __APAAPP_H__