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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
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 |
|
17 // |
|
18 // |
|
19 |
|
20 #ifndef __GRAPHICSURFACE_H__ |
|
21 #define __GRAPHICSURFACE_H__ |
|
22 |
|
23 #include <w32std.h> |
|
24 #include <w32stdgraphic.h> |
|
25 #include <graphics/surface.h> |
|
26 #include <graphics/surfaceconfiguration.h> |
|
27 |
|
28 enum TDrawWsGraphicArgumentFlags |
|
29 { |
|
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, |
|
44 }; |
|
45 |
|
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. |
|
50 |
|
51 @publishedAll |
|
52 @released |
|
53 */ { |
|
54 public: |
|
55 enum |
|
56 { |
|
57 ETypeId = 0x10285C57 |
|
58 }; |
|
59 TWsSurfaceConfiguration() |
|
60 : TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)) |
|
61 { } |
|
62 TWsSurfaceConfiguration(const TSurfaceConfiguration& aConfig) |
|
63 : TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)), |
|
64 iConfig(aConfig) |
|
65 |
|
66 { } |
|
67 TSurfaceConfiguration iConfig; |
|
68 }; |
|
69 |
|
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) |
|
73 */ |
|
74 { |
|
75 public: |
|
76 enum |
|
77 { |
|
78 ETypeId = 0x10285C5A |
|
79 }; |
|
80 TWsDebugResultCode(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)) |
|
81 { } |
|
82 TInt iResult; |
|
83 TInt iExtra; |
|
84 TInt iLineNum; |
|
85 }; |
|
86 |
|
87 |
|
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. |
|
91 |
|
92 @publishedAll |
|
93 @released |
|
94 */ { |
|
95 public: |
|
96 enum |
|
97 { |
|
98 ETypeId = 0x10285C58 |
|
99 }; |
|
100 TWsSurfaceUnreferenced(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)) |
|
101 { } |
|
102 TSurfaceId iId; |
|
103 }; |
|
104 class CWsGraphicDrawerSurface; |
|
105 class TWsDebugResultCode; |
|
106 class CWsGraphicSurface: public CWsGraphic |
|
107 /** Client representation of a window-server-side CFbsBitmap owned by this Client |
|
108 |
|
109 @publishedAll |
|
110 @released |
|
111 */ |
|
112 { |
|
113 friend class CWsGraphicDrawerSurface; |
|
114 public: |
|
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(); |
|
122 protected: |
|
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&); |
|
129 |
|
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(); |
|
138 protected: |
|
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(); |
|
144 private: |
|
145 void HandleMessage(const TDesC8& aData); |
|
146 void OnReplace(); |
|
147 |
|
148 private: //data |
|
149 TSurfaceId iRegisteredId; |
|
150 RArray<TUint> iRegisteredScreens; |
|
151 }; |
|
152 |
|
153 /** Used as the parameter payload to construct the drawer |
|
154 */ |
|
155 class CWsGraphicSurface::TConstructParams |
|
156 { |
|
157 public: |
|
158 TInt Size() |
|
159 { return iParamFlags.Size()+iConfig.Size()+2*sizeof(TWsGraphicMsgFixedBase); } |
|
160 void* operator new(TUint size,TInt aNumExtras) |
|
161 { |
|
162 return ::operator new(size+((aNumExtras>=0)?aNumExtras*sizeof(TInt):0)); |
|
163 } |
|
164 void operator delete(void* aObj,TInt /*aNumExtras*/) |
|
165 { |
|
166 ::operator delete(aObj); |
|
167 } |
|
168 void operator delete(void* aObj) |
|
169 { |
|
170 ::operator delete(aObj); |
|
171 } |
|
172 TWsSurfaceConfiguration iConfig; |
|
173 class TParamFlags:public TWsGraphicMsgFixedBase |
|
174 { |
|
175 public: |
|
176 enum |
|
177 { |
|
178 ETypeId = 0x10285C59 |
|
179 }; |
|
180 |
|
181 TParamFlags(): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)) |
|
182 {} |
|
183 TParamFlags(TInt aNumExtras): TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this)+aNumExtras*sizeof(TInt)) |
|
184 {} |
|
185 TUint iDrawWsGraphicArgumentFlags; |
|
186 TUint iScreensMap[1]; //THIS MUST BE THE LAST FIELD!!! |
|
187 } iParamFlags; |
|
188 TConstructParams() |
|
189 { } |
|
190 TConstructParams(const TSurfaceConfiguration& aConfig,TInt aNumExtras=0) |
|
191 : iConfig(aConfig),iParamFlags(aNumExtras) |
|
192 { } |
|
193 TCleanupItem CleanupItem() { return TCleanupItem(Cleanup,this); } |
|
194 static void Cleanup(void* p) { delete(TConstructParams*)p; } |
|
195 }; |
|
196 |
|
197 #endif //__GRAPHICSURFACE_H__ |
|
198 |
|