epoc32/include/apgdoor.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/apgdoor.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/apgdoor.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,181 @@
     1.4 -apgdoor.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __APGDOOR_H__
    1.21 +#define __APGDOOR_H__
    1.22 +
    1.23 +#if !defined(__E32STD_H__)
    1.24 +#include <e32std.h>
    1.25 +#endif
    1.26 +#if !defined(__E32BASE_H__)
    1.27 +#include <e32base.h>
    1.28 +#endif
    1.29 +#if !defined(__S32STD_H__)
    1.30 +#include <s32std.h>
    1.31 +#endif
    1.32 +#if !defined(__GDI_H__)
    1.33 +#include <gdi.h>
    1.34 +#endif
    1.35 +#if !defined(__APPARC_H__)
    1.36 +#include <apparc.h>
    1.37 +#endif
    1.38 +#if !defined(__APADBASE_H__)
    1.39 +#include <apadbase.h>
    1.40 +#endif
    1.41 +
    1.42 +/**
    1.43 +@internalAll
    1.44 +*/
    1.45 +#ifdef _UNICODE
    1.46 +#define KUidApaDoorDocStream KUidApaDoorDocStream16
    1.47 +#else
    1.48 +#define KUidApaDoorDocStream KUidApaDoorDocStream8
    1.49 +#endif
    1.50 +
    1.51 +/**
    1.52 +@internalComponent
    1.53 +@deprecated
    1.54 +*/
    1.55 +const TUid KUidApaDoorDocStream8={0x10000144};
    1.56 +
    1.57 +/**
    1.58 +@internalComponent
    1.59 +*/
    1.60 +const TUid KUidApaDoorDocStream16={0x10003A35};
    1.61 +
    1.62 +// classes defined:
    1.63 +class CApaDoor;
    1.64 +class TApaPictureFactory;
    1.65 +//
    1.66 +// classes referenced:
    1.67 +class CEmbeddedStore;
    1.68 +//
    1.69 +
    1.70 +class CApaDoor : public CApaDoorBase
    1.71 +/** A wrapper for an embedded document that can be displayed in a user interface 
    1.72 +as an icon or a glass door. 
    1.73 +
    1.74 +@publishedAll 
    1.75 +@released */
    1.76 +	{
    1.77 +public:
    1.78 +	IMPORT_C static CApaDoor* NewLC(RFs& aFs, CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips); // call to create a new door in iconic format - restoration is achieved with TApaPictureFactory
    1.79 +	IMPORT_C static CApaDoor* NewL(RFs& aFs, CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips); // call to create a new door in iconic format - restoration is achieved with TApaPictureFactory
    1.80 +	IMPORT_C static CApaDoor* NewL(RFs& aFs, const CStreamStore& aStore,TStreamId aStreamId,CApaProcess& aProcess); // restoring constructor called by TApaPictureFactory
    1.81 +	//
    1.82 +	IMPORT_C void SetFormatToIconL();
    1.83 +	IMPORT_C void SetFormatToGlassL();
    1.84 +	IMPORT_C void SetFormatToTemporaryIconL(TBool aEnabled=ETrue);
    1.85 +	//
    1.86 +	IMPORT_C CApaDocument* DocumentL(TBool aCheckPassword=EFalse); // returns a pointer to the doc, restoring it if necessary. Checks password if required.
    1.87 +	inline TDesC* Caption()const;
    1.88 +	IMPORT_C TUid AppUidL()const;
    1.89 +	//
    1.90 +	// persistence methods
    1.91 +	IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aHeadStreamId);
    1.92 +	TStreamId StoreL(CStreamStore& aStore) const;
    1.93 +	//
    1.94 +	IMPORT_C ~CApaDoor();
    1.95 +	//
    1.96 +	// from CPicture
    1.97 +	void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
    1.98 +						MGraphicsDeviceMap* aMap)const; // draws according to current iPicFormat
    1.99 +	void DetachFromStoreL(TDetach aDegree=EDetachFull); //lint !e1735 Virtual function has default parameter - Must use the same default as declared by CPicture
   1.100 +	void GetOriginalSizeInTwips(TSize& aSize)const;
   1.101 +	void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight);
   1.102 +	void SetCropInTwips(const TMargins& aMargins);
   1.103 +	TPictureCapability Capability() const;
   1.104 +	void GetCropInTwips(TMargins& aMargins) const;
   1.105 +	TInt ScaleFactorWidth() const;
   1.106 +	TInt ScaleFactorHeight() const;
   1.107 +private:
   1.108 +	CApaDoor(RFs& aFs, CApaProcess& aProcess);
   1.109 +	CApaDoor(RFs& aFs, CApaDocument& aDoc,const TSize& aDefaultIconSizeInTwips);
   1.110 +	void ConstructL();
   1.111 +	//
   1.112 +	void SetIconSizeInTwips(TSize aSize); // for use of factory
   1.113 +	//
   1.114 +	void StoreDocL(CPersistentStore& aStore)const;
   1.115 +	void RestoreDocL(const CPersistentStore& aStore);
   1.116 +	void RestoreDoorStateL(const CStreamStore& aStore,const CStreamDictionary& streamDic);
   1.117 +	static CStreamDictionary* ReadStreamDictionaryLC(const CStreamStore& aStore,TStreamId aStreamId);
   1.118 +	static void CopyStoreL(const CEmbeddedStore& aSourceStore,RWriteStream& aTargetStream);
   1.119 +	void ExternalizeStateStreamL(CStreamStore& aStore,CStreamDictionary& aStreamDict)const;
   1.120 +	void InternalizeStateStreamL(const CStreamStore& aStore,const CStreamDictionary& aStreamDict,TSize aDefaultIconSize);
   1.121 +	//
   1.122 +	// required so CPicture's can be swizzled
   1.123 +	void ExternalizeL(RWriteStream& aStream)const;
   1.124 +	// from CApaDoorBase
   1.125 +	virtual TSize GlassDoorSize()const;
   1.126 +	TUid AppUidFromStreamL() const;
   1.127 +private:
   1.128 +	RFs& iFs;
   1.129 +	HBufC* iAppCaption; // name of the app used to create the embedded object
   1.130 +	CApaProcess* iApaProcess;
   1.131 +	CApaDocument* iApaDoc;
   1.132 +	CPicture* iPicture; // the current view of the door, either iconic or glass
   1.133 +	CEmbeddedStore* iStore; // store containing the doc
   1.134 +	CBufSeg* iStoreHost; // the host for the embedded store, if the door has been detached from its originating store
   1.135 +	__MUTABLE TSize iIconSizeInTwips;
   1.136 +	//
   1.137 +	friend class TApaPictureFactory;
   1.138 +	};
   1.139 +
   1.140 +
   1.141 +class TApaPictureFactory : public MPictureFactory
   1.142 +// Recognizes KUidPictureTypeDoor and creates CApaDoor pictures
   1.143 +/** A factory class for instantiating and restoring an application's door.
   1.144 +
   1.145 +A door factory object is constructed by the UI environment and can be accessed 
   1.146 +by calling CEikonEnv::PictureFactory().
   1.147 +
   1.148 +@publishedAll
   1.149 +@released 
   1.150 +@see CEikonEnv::PictureFactory()
   1.151 +@see CApaDoor */
   1.152 +	{
   1.153 +public:
   1.154 +	IMPORT_C TApaPictureFactory(CApaProcess* aAppProcess);
   1.155 +	inline void SetIconSize(TSize aIconSizeInTwips);
   1.156 +	//
   1.157 +	// from MPictureFactory
   1.158 +	IMPORT_C void NewPictureL(TPictureHeader& aPictureHeader,const CStreamStore& aPictureStore)const; // used to create CApaDoor's during document restore only 
   1.159 +protected:
   1.160 +	IMPORT_C TApaPictureFactory();
   1.161 +	
   1.162 +private:
   1.163 +	CApaProcess* iApaProcess;
   1.164 +	TSize iIconSize;
   1.165 +	TInt iSpare;
   1.166 +	};
   1.167 +
   1.168 +
   1.169 +//
   1.170 +// inlines
   1.171 +//
   1.172 +
   1.173 +inline TDesC* CApaDoor::Caption()const 
   1.174 +	/** Gets the name of the application with which the embedded document is associated.
   1.175 +	
   1.176 +	@return A pointer to a descriptor containing the name of the application. */
   1.177 +	{ return iAppCaption; }
   1.178 +
   1.179 +inline void TApaPictureFactory::SetIconSize(TSize aIconSizeInTwips)
   1.180 +	/** Sets the size of the icon.
   1.181 +	
   1.182 +	@param aIconSizeInTwips The size of the icon, in twips. */
   1.183 +	{ iIconSize = aIconSizeInTwips; }
   1.184 +
   1.185 +#endif