Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Reference sample client-side "provider" interface CWsGraphic plugin using GCE Surfaces
15 // Copied from common/generic/graphics/wserv/nga/samplegraphicsurfacedrawer
16 // if the CRP tests suddenly starts to break or fail to build it might be due to this file has changed in CBR
20 #ifndef __GRAPHICSURFACE_H__
21 #define __GRAPHICSURFACE_H__
24 #include <w32stdgraphic.h>
25 #include <graphics/surface.h>
26 #include <graphics/surfaceconfiguration.h>
28 enum TDrawWsGraphicArgumentFlags
30 EDrawWsAllScreens =0x00000001,
31 EDrawWsTSurfaceIdIgnored =0x00000002, //<Indicates that the client should NOT supply
32 EDrawWsNotifyProviderTSurfaceIdChanged =0x00000100,
33 EDrawWsNotifyProviderConfigChanged =0x00000200,
34 EDrawWsNotifyProviderPlayControlsChanged =0x00000400,
35 EDrawWsNotifyProviderSurfaceUnreferenced =0x00000800,
36 EDrawWsNotifyProviderConfigRereferenced =0x00001000, //<Triggers a one-shot config notification when drawn after an unreference
37 EDrawWsNotifyProviderConfigNextReref =0x00002000, //<Automatic one-shot set after unreferenced if
38 EDrawWsNotifyError =0x00010000,
39 EDrawWsNotifyProviderAll =0x000FFF00,
40 EDrawWsUpdateTSurfaceId =0x00100000,
41 EDrawWsUpdateConfiguration =0x00200000,
42 EDrawWsUpdatePlayerControls =0x00400000,
43 EDrawWsUpdateAll =0x0FF00000,
46 //KUidGraphicMsgSurface= 0x10285C57 To 0x10285C5B
47 class TWsSurfaceConfiguration: public TWsGraphicMsgFixedBase
48 /** data attached to a CWindowGc::DrawWsGraphic to allow the artwork to understand surface configuration commands.
49 Also use to notify owner client of config change.
59 TWsSurfaceConfiguration()
60 : TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
62 TWsSurfaceConfiguration(const TSurfaceConfiguration& aConfig)
63 : TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)),
67 TSurfaceConfiguration iConfig;
70 class TWsDebugResultCode: public TWsGraphicMsgFixedBase
71 /** Data attached to a message to the artwork provider notifying it of a command result code
72 This code is always followed by the command that caused it (TSurfaceConfig)
80 TWsDebugResultCode(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
88 class TWsSurfaceUnreferenced: public TWsGraphicMsgFixedBase
89 /** data attached to a message to the artwork provider to allow it to react if a surface is no longer drawn
90 play-stop-pause commands.
100 TWsSurfaceUnreferenced(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
104 class CWsGraphicDrawerSurface;
105 class TWsDebugResultCode;
106 class CWsGraphicSurface: public CWsGraphic
107 /** Client representation of a window-server-side CFbsBitmap owned by this Client
113 friend class CWsGraphicDrawerSurface;
115 IMPORT_C static CWsGraphicSurface* NewL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
116 IMPORT_C static CWsGraphicSurface* NewL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
117 IMPORT_C static CWsGraphicSurface* NewL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
118 IMPORT_C void ConstructL(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
119 IMPORT_C void ConstructL(TUid aUid,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
120 IMPORT_C void ConstructL(const TWsGraphicId& aReplace,const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
121 IMPORT_C ~CWsGraphicSurface();
123 IMPORT_C TInt ShareGlobally();
124 IMPORT_C TInt UnShareGlobally();
125 IMPORT_C TInt Share(TSecureId aClientId);
126 IMPORT_C TInt UnShare(TSecureId aClientId);
127 IMPORT_C TInt SendMessage(const TSurfaceConfiguration&);
128 IMPORT_C TInt SendMessage(const TWsGraphicAnimation&);
130 virtual void HandleMessage(const TSurfaceConfiguration&) {}
131 virtual void HandleMessage(const TWsGraphicAnimation&) {}
132 virtual void HandleMessage(const TWsSurfaceUnreferenced&) {}
133 virtual void HandleMessage(const TWsDebugResultCode&) {}
134 virtual void HandleOtherMessage(const TWsGraphicMsgFixedBase&) {}
135 IMPORT_C virtual TInt CWsGraphicSurface_Reserved1();
136 IMPORT_C virtual TInt CWsGraphicSurface_Reserved2();
137 IMPORT_C virtual TInt CWsGraphicSurface_Reserved3();
139 class TConstructParams;
140 IMPORT_C TConstructParams* MakeParamsLC(const TSurfaceConfiguration& aSurface, TUint aDrawWsGraphicArgumentFlags, const TArray<TUint>* aScreensMap=NULL);
141 IMPORT_C CWsGraphicSurface(); //Derivers should implement NewL to call ConstructL
142 IMPORT_C void RegisterScreens(const TSurfaceConfiguration& aSurface,const TArray<TUint>* aScreensMap=NULL);
143 IMPORT_C void UnRegisterScreens();
145 void HandleMessage(const TDesC8& aData);
149 TSurfaceId iRegisteredId;
150 RArray<TUint> iRegisteredScreens;
153 /** Used as the parameter payload to construct the drawer
155 class CWsGraphicSurface::TConstructParams
159 { return iParamFlags.Size()+iConfig.Size()+2*sizeof(TWsGraphicMsgFixedBase); }
160 void* operator new(TUint size,TInt aNumExtras)
162 return ::operator new(size+((aNumExtras>=0)?aNumExtras*sizeof(TInt):0));
164 void operator delete(void* aObj,TInt /*aNumExtras*/)
166 ::operator delete(aObj);
168 void operator delete(void* aObj)
170 ::operator delete(aObj);
172 TWsSurfaceConfiguration iConfig;
173 class TParamFlags:public TWsGraphicMsgFixedBase
181 TParamFlags(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
183 TParamFlags(TInt aNumExtras): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)+aNumExtras*sizeof(TInt))
185 TUint iDrawWsGraphicArgumentFlags;
186 TUint iScreensMap[1]; //THIS MUST BE THE LAST FIELD!!!
190 TConstructParams(const TSurfaceConfiguration& aConfig,TInt aNumExtras=0)
191 : iConfig(aConfig),iParamFlags(aNumExtras)
193 TCleanupItem CleanupItem() { return TCleanupItem(Cleanup,this); }
194 static void Cleanup(void* p) { delete(TConstructParams*)p; }
197 #endif //__GRAPHICSURFACE_H__