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