|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __HUICANVASCMDBUFFERREADER_H__ |
|
21 #define __HUICANVASCMDBUFFERREADER_H__ |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <s32mem.h> |
|
26 #include <bitstd.h> |
|
27 #include <fbs.h> |
|
28 #include <gdi.h> |
|
29 |
|
30 class THuiCanvasTextParameters |
|
31 { |
|
32 public: |
|
33 THuiCanvasTextParameters(): |
|
34 iStart(0), |
|
35 iEnd(KMaxTInt), |
|
36 iFlags(0) |
|
37 { |
|
38 } |
|
39 TInt iStart; |
|
40 TInt iEnd; |
|
41 TUint16 iFlags; |
|
42 /* Reserved for future use */ |
|
43 TAny* iReserved1; |
|
44 TAny* iReserved2; |
|
45 TAny* iReserved3; |
|
46 TAny* iReserved4; |
|
47 }; |
|
48 |
|
49 class CHuiCanvasCmdBufferReader : public CBase |
|
50 { |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Constructor. |
|
55 */ |
|
56 CHuiCanvasCmdBufferReader(); |
|
57 |
|
58 /** |
|
59 * Constructor. |
|
60 */ |
|
61 CHuiCanvasCmdBufferReader(RMemReadStream aStream); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 ~CHuiCanvasCmdBufferReader(); |
|
67 |
|
68 /** |
|
69 * Initialization, opens a stream for reading commandbuffer. |
|
70 * |
|
71 * @since S60 ?S60_version |
|
72 * @param |
|
73 * @param |
|
74 */ |
|
75 void Init( TPtr8& aDes,TInt aLength); |
|
76 |
|
77 /** |
|
78 * ReadInt32L |
|
79 * Convinience function for reading a TInt32 from stream. |
|
80 * |
|
81 * @since S60 ?S60_version |
|
82 * @param aPoint |
|
83 */ |
|
84 void ReadInt32L( TInt& aValue ); |
|
85 |
|
86 /** |
|
87 * ReadPointL |
|
88 * Convinience function for reading a TPoint from stream |
|
89 * |
|
90 * @since S60 ?S60_version |
|
91 * @param aPoint |
|
92 */ |
|
93 void ReadPointL( TPoint& aPoint ); |
|
94 |
|
95 /** |
|
96 * ReadRectL |
|
97 * Convinience function for reading a TRect from stream |
|
98 * |
|
99 * @since S60 ?S60_version |
|
100 * @param TRect |
|
101 */ |
|
102 void ReadRectL(TRect& aRect ); |
|
103 |
|
104 /** |
|
105 * ReadBitmapL |
|
106 * Convinience function for reading a bitmap from stream. It duplicates the bitmap from a bitmap handle. |
|
107 * |
|
108 * @since S60 ?S60_version |
|
109 * @param Bitmap |
|
110 */ |
|
111 void ReadBitmapLC( CFbsBitmap*& aBitmap ); |
|
112 |
|
113 /** |
|
114 * ReadBitmapHandleL |
|
115 * Convinience function for reading a bitmap from stream. It duplicates the bitmap from a bitmap handle. |
|
116 * |
|
117 * @since S60 ?S60_version |
|
118 * @param Bitmap |
|
119 */ |
|
120 void ReadBitmapHandleL( TInt& aBitmapHandle ); |
|
121 |
|
122 /** |
|
123 * ReadTextL |
|
124 * Returns TPtr to a text in the command buffer stream. Note, that this |
|
125 * function does not make a copy of the text. |
|
126 * |
|
127 * @since S60 ?S60_version |
|
128 * @param aPoint |
|
129 * @return EFalse, if TTextParameters are not legal. Otherwise ETrue. |
|
130 */ |
|
131 TBool ReadTextL( TPtr& aText, THuiCanvasTextParameters& aTextParameters ); |
|
132 |
|
133 /** |
|
134 * ReadPointArrayL |
|
135 * Convinience function for reading a pointer array from stream |
|
136 * |
|
137 * @since S60 ?S60_version |
|
138 * @param Pointer array |
|
139 */ |
|
140 void ReadPointArrayL(CArrayFix<TPoint>*& aPointArray ); |
|
141 |
|
142 /** |
|
143 * ReadPointArrayL |
|
144 * Convinience function for reading a pointer array from stream |
|
145 * |
|
146 * @since S60 ?S60_version |
|
147 * @param Pointer array |
|
148 */ |
|
149 void ReadPointArrayL( TPoint*& aPointArray, TInt& aNumPoints ); |
|
150 |
|
151 /** |
|
152 * ReadRegionL |
|
153 * Convinience function for reading a RRegion from stream |
|
154 * |
|
155 * @since S60 ?S60_version |
|
156 * @param Region |
|
157 */ |
|
158 void ReadRegionL( RRegion& aRegion ); |
|
159 |
|
160 /** |
|
161 * DeletePointArrayL |
|
162 * Convinience function deleting the point array |
|
163 * |
|
164 * @since S60 ?S60_version |
|
165 * @param aPointArray |
|
166 * @param aNumPoints Number of points |
|
167 */ |
|
168 void DeletePointArrayL( TPoint*& aPointArray, TInt& aNumPoints ); |
|
169 |
|
170 /** |
|
171 * ReadColorL |
|
172 * Convinience function for reading a TRgb from stream |
|
173 * |
|
174 * @since S60 ?S60_version |
|
175 * @param TRgb |
|
176 */ |
|
177 void ReadColorL( TRgb& aColor ); |
|
178 |
|
179 /** |
|
180 * ReadIntsL |
|
181 * Convinience function for reading maximum of 5 TInts from the stream |
|
182 * |
|
183 * @since S60 ?S60_version |
|
184 * @param TInt array |
|
185 */ |
|
186 void ReadIntsL( TInt aCount, TInt aValues[5] ); |
|
187 |
|
188 |
|
189 /** |
|
190 * ReadInt8L |
|
191 * Convinience function for reading Int8 from stream |
|
192 * |
|
193 * @since S60 ?S60_version |
|
194 */ |
|
195 inline TUint8 ReadInt8L( ){ return iStream.ReadInt8L();} |
|
196 |
|
197 inline void ReadL( TUint8* aTargetPtr, TInt aLength ) |
|
198 { |
|
199 iStream.ReadL( aTargetPtr, aLength ); |
|
200 } |
|
201 /** |
|
202 * Convinience function for getting a reference to stream. |
|
203 * |
|
204 * @since S60 ?S60_version |
|
205 */ |
|
206 RMemReadStream& Stream(); |
|
207 |
|
208 private: |
|
209 |
|
210 /* |
|
211 * Readstream for the command buffer. |
|
212 */ |
|
213 RMemReadStream iStream; |
|
214 |
|
215 TInt iBufferIndex; |
|
216 |
|
217 TInt iBufferLength; |
|
218 |
|
219 TPtr8* iBasePtr; |
|
220 |
|
221 TPtr16* iCachedText; |
|
222 |
|
223 }; |
|
224 |
|
225 #endif |
|
226 |