00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef __EmbeddingGraphicsControl_H
00032 #define __EmbeddingGraphicsControl_H
00033 
00034 #include <coecntrl.h>
00035 #include <s32file.h>
00036 
00037 
00038 
00039 
00040 
00041 
00042 #include "CommonGraphicsControlFramework.h"
00043 
00044 class CSmileyPicture : public CPicture
00045         {
00046 public:
00047         enum TMood { EHappy, ENeutral, ESad }; 
00048         enum TSizeSpec { ELarge, EMedium, ESmall }; 
00049 
00050         
00051         CSmileyPicture();
00052         static CSmileyPicture* NewL(TMood aMood, TSizeSpec aSizeSpec); 
00053         static CSmileyPicture* NewL(const CStreamStore& aStore, TStreamId aStreamId); 
00054         TStreamId StoreL(CStreamStore& aStore) const;
00055         void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
00056                                                 MGraphicsDeviceMap* aMap)const; 
00057 
00058         void SetMood(TMood aMood); 
00059         TMood Mood(); 
00060         void SetSize(TSizeSpec aSizeSpec);      
00061         TSizeSpec Size(); 
00062         TInt SpecToFactor() const;
00063 
00064         void GetOriginalSizeInTwips(TSize& aSize) const;
00065 
00066         
00067         void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight);
00068         void SetCropInTwips(const TMargins& aMargins);
00069         TPictureCapability Capability() const;
00070         void GetCropInTwips(TMargins& aMargins) const;
00071         TInt ScaleFactorWidth() const;
00072         TInt ScaleFactorHeight() const;
00073 private:
00074         
00075         void ExternalizeL(RWriteStream& aStream) const;         
00076         void InternalizeL(RReadStream& aStream);                        
00077 private:
00078         
00079         TMood iMood;
00080         TSizeSpec iSizeSpec;
00081         };
00082 
00083 
00084 
00085 class CPictureControl : public CGraphicExampleControl
00086         {
00087 public:
00088         CPictureControl();
00089         ~CPictureControl() { delete(iPicture); };
00090         void UpdateModelL();
00091         void Draw(const TRect& aRect) const;
00092 private:
00093         enum TDocStatus { EFalse, EHeader, EPicture };
00094         TStreamId StoreHeaderL(CStreamStore& aStore) const;
00095         void StoreHeaderComponentsL(CStoreMap& aMap,CStreamStore& aStore) const;
00096         void RestoreHeaderL(CStreamStore& aStore, TStreamId aId);
00097 
00098         TZoomFactor testZf;
00099         MGraphicsDeviceMap* testMap;
00100 
00101         TDocStatus iValidDocument; 
00102         CSmileyPicture* iPicture; 
00103         TPictureHeader iHeader; 
00104         TPoint iOffset; 
00105         CFileStore* iStore; 
00106         TStreamId iHeaderId;  
00107         };
00108 
00109 
00110 #endif