|
1 // Copyright (c) 1996-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 // |
|
15 |
|
16 #include "E32Std.h" |
|
17 #include "E32Cons.h" |
|
18 |
|
19 #include "dummy.h" |
|
20 |
|
21 CDummyDevice::CDummyDevice() |
|
22 { |
|
23 } |
|
24 |
|
25 EXPORT_C CDummyDevice* CDummyDevice::NewL() |
|
26 { |
|
27 CDummyDevice* device=new(ELeave) CDummyDevice; |
|
28 device->iConsole=(CConsoleBase*)NewConsole(); |
|
29 return device; |
|
30 } |
|
31 |
|
32 EXPORT_C CDummyDevice::~CDummyDevice() |
|
33 { |
|
34 delete iConsole; |
|
35 } |
|
36 |
|
37 EXPORT_C TInt CDummyDevice::HorizontalTwipsToPixels(TInt aTwips) const |
|
38 { |
|
39 return aTwips; |
|
40 } |
|
41 |
|
42 EXPORT_C TInt CDummyDevice::VerticalTwipsToPixels(TInt aTwips) const |
|
43 { |
|
44 return aTwips; |
|
45 } |
|
46 |
|
47 EXPORT_C TInt CDummyDevice::HorizontalPixelsToTwips(TInt aPixels) const |
|
48 { |
|
49 return aPixels; |
|
50 } |
|
51 |
|
52 EXPORT_C TInt CDummyDevice::VerticalPixelsToTwips(TInt aPixels) const |
|
53 { |
|
54 return aPixels; |
|
55 } |
|
56 |
|
57 EXPORT_C TInt CDummyDevice::GetNearestFontInTwips(CFont*& /*aFont*/,const TFontSpec& /*aFontSpec*/) |
|
58 { |
|
59 return KErrNone; |
|
60 } |
|
61 |
|
62 EXPORT_C TInt CDummyDevice::GetNearestFontToDesignHeightInTwips(CFont*& /*aFont*/,const TFontSpec& /*aFontSpec*/) |
|
63 { |
|
64 return KErrNone; |
|
65 } |
|
66 |
|
67 EXPORT_C void CDummyDevice::ReleaseFont(CFont* /*aFont*/) |
|
68 { |
|
69 } |
|
70 |
|
71 EXPORT_C TDisplayMode CDummyDevice::DisplayMode() const |
|
72 { |
|
73 return EGray2; |
|
74 } |
|
75 |
|
76 EXPORT_C TSize CDummyDevice::SizeInPixels() const |
|
77 { |
|
78 return TSize(1000,1000); |
|
79 } |
|
80 |
|
81 EXPORT_C TSize CDummyDevice::SizeInTwips() const |
|
82 { |
|
83 return TSize(1000,1000); |
|
84 } |
|
85 |
|
86 EXPORT_C TInt CDummyDevice::CreateContext(CGraphicsContext*& aGC) |
|
87 { |
|
88 TInt ret; |
|
89 CDummyGc* gc = new CDummyGc(this); |
|
90 if (!gc) |
|
91 ret=KErrNoMemory; |
|
92 else |
|
93 { |
|
94 aGC=gc; |
|
95 ret=KErrNone; |
|
96 } |
|
97 return ret; |
|
98 } |
|
99 |
|
100 EXPORT_C TInt CDummyDevice::NumTypefaces() const |
|
101 { |
|
102 return 0; |
|
103 } |
|
104 |
|
105 EXPORT_C void CDummyDevice::TypefaceSupport(TTypefaceSupport& /*aTypefaceSupport*/,TInt /*aTypefaceIndex*/) const |
|
106 { |
|
107 } |
|
108 |
|
109 EXPORT_C TInt CDummyDevice::FontHeightInTwips(TInt /*aTypefaceIndex*/,TInt /*aHeightIndex*/) const |
|
110 { |
|
111 return 0; |
|
112 } |
|
113 |
|
114 EXPORT_C void CDummyDevice::PaletteAttributes(TBool& /*aModifiable*/,TInt& /*aNumEntries*/) const |
|
115 { |
|
116 } |
|
117 |
|
118 EXPORT_C void CDummyDevice::SetPalette(CPalette* /*aPalette*/) |
|
119 { |
|
120 } |
|
121 |
|
122 EXPORT_C TInt CDummyDevice::GetPalette(CPalette*& /*aPalette*/) const |
|
123 { |
|
124 return 0; |
|
125 } |
|
126 |
|
127 EXPORT_C CDummyGc::CDummyGc(CDummyDevice* aDevice): |
|
128 iDevice(aDevice) |
|
129 { |
|
130 } |
|
131 |
|
132 EXPORT_C CDummyGc::~CDummyGc() |
|
133 { |
|
134 iDevice->iConsole->Getch(); |
|
135 } |
|
136 |
|
137 EXPORT_C CGraphicsDevice* CDummyGc::Device() const |
|
138 { |
|
139 return iDevice; |
|
140 } |
|
141 |
|
142 EXPORT_C void CDummyGc::SetOrigin(const TPoint& /*aPos*/) |
|
143 { |
|
144 iDevice->iConsole->Printf(_L("SetOrigin\n")); |
|
145 } |
|
146 |
|
147 EXPORT_C void CDummyGc::SetDrawMode(TDrawMode /*aDrawingMode*/) |
|
148 { |
|
149 iDevice->iConsole->Printf(_L("SetDrawMode\n")); |
|
150 } |
|
151 |
|
152 EXPORT_C void CDummyGc::SetClippingRect(const TRect& /*aRect*/) |
|
153 { |
|
154 iDevice->iConsole->Printf(_L("SetClippingRect\n")); |
|
155 } |
|
156 |
|
157 EXPORT_C void CDummyGc::CancelClippingRect() |
|
158 { |
|
159 iDevice->iConsole->Printf(_L("CancelClippingRect\n")); |
|
160 } |
|
161 |
|
162 EXPORT_C void CDummyGc::Reset() |
|
163 { |
|
164 iDevice->iConsole->Printf(_L("Reset\n")); |
|
165 } |
|
166 |
|
167 |
|
168 EXPORT_C void CDummyGc::UseFont(const CFont* /*aFont*/) |
|
169 { |
|
170 iDevice->iConsole->Printf(_L("UseFont\n")); |
|
171 } |
|
172 |
|
173 EXPORT_C void CDummyGc::DiscardFont() |
|
174 { |
|
175 iDevice->iConsole->Printf(_L("DiscardFont\n")); |
|
176 } |
|
177 |
|
178 EXPORT_C void CDummyGc::SetUnderlineStyle(TFontUnderline /*aUnderlineStyle*/) |
|
179 { |
|
180 iDevice->iConsole->Printf(_L("SetUnderlineStyle\n")); |
|
181 } |
|
182 |
|
183 EXPORT_C void CDummyGc::SetStrikethroughStyle(TFontStrikethrough /*aStrikethroughStyle*/) |
|
184 { |
|
185 iDevice->iConsole->Printf(_L("SetStrikethroughStyle\n")); |
|
186 } |
|
187 |
|
188 EXPORT_C void CDummyGc::SetWordJustification(TInt /*aExcessWidth*/,TInt /*aNumGaps*/) |
|
189 { |
|
190 iDevice->iConsole->Printf(_L("SetWordJustification\n")); |
|
191 } |
|
192 |
|
193 EXPORT_C void CDummyGc::SetCharJustification(TInt /*aExcessWidth*/,TInt /*aNumChars*/) |
|
194 { |
|
195 iDevice->iConsole->Printf(_L("SetCharJustification\n")); |
|
196 } |
|
197 |
|
198 |
|
199 EXPORT_C void CDummyGc::SetPenColor(const TRgb& /*aColor*/) |
|
200 { |
|
201 iDevice->iConsole->Printf(_L("SetPenColor\n")); |
|
202 } |
|
203 |
|
204 EXPORT_C void CDummyGc::SetPenStyle(TPenStyle /*aPenStyle*/) |
|
205 { |
|
206 iDevice->iConsole->Printf(_L("SetPenStyle\n")); |
|
207 } |
|
208 |
|
209 EXPORT_C void CDummyGc::SetPenSize(const TSize& /*aSize*/) |
|
210 { |
|
211 iDevice->iConsole->Printf(_L("SetPenSize\n")); |
|
212 } |
|
213 |
|
214 |
|
215 EXPORT_C void CDummyGc::SetBrushColor(const TRgb& /*aColor*/) |
|
216 { |
|
217 iDevice->iConsole->Printf(_L("SetBrushColor\n")); |
|
218 } |
|
219 |
|
220 EXPORT_C void CDummyGc::SetBrushStyle(TBrushStyle /*aBrushStyle*/) |
|
221 { |
|
222 iDevice->iConsole->Printf(_L("SetBrushStyle\n")); |
|
223 } |
|
224 |
|
225 EXPORT_C void CDummyGc::SetBrushOrigin(const TPoint& /*aOrigin*/) |
|
226 { |
|
227 iDevice->iConsole->Printf(_L("SetBrushOrigin\n")); |
|
228 } |
|
229 |
|
230 EXPORT_C void CDummyGc::UseBrushPattern(const CFbsBitmap* /*aBitmap*/) |
|
231 { |
|
232 iDevice->iConsole->Printf(_L("SetBrushPattern\n")); |
|
233 } |
|
234 |
|
235 EXPORT_C void CDummyGc::DiscardBrushPattern() |
|
236 { |
|
237 iDevice->iConsole->Printf(_L("DiscardBrushPattern\n")); |
|
238 } |
|
239 |
|
240 EXPORT_C void CDummyGc::MoveTo(const TPoint& /*aPoint*/) |
|
241 { |
|
242 iDevice->iConsole->Printf(_L("MoveTo\n")); |
|
243 } |
|
244 |
|
245 EXPORT_C void CDummyGc::MoveBy(const TPoint& /*aVector*/) |
|
246 { |
|
247 iDevice->iConsole->Printf(_L("MoveBy\n")); |
|
248 } |
|
249 |
|
250 EXPORT_C void CDummyGc::Plot(const TPoint& /*aPoint*/) |
|
251 { |
|
252 iDevice->iConsole->Printf(_L("Plot\n")); |
|
253 } |
|
254 |
|
255 EXPORT_C void CDummyGc::DrawArc(const TRect& /*aRect*/,const TPoint& /*aStart*/,const TPoint& /*aEnd*/) |
|
256 { |
|
257 iDevice->iConsole->Printf(_L("DrawArc\n")); |
|
258 } |
|
259 |
|
260 EXPORT_C void CDummyGc::DrawLine(const TPoint& /*aPoint1*/,const TPoint& /*aPoint2*/) |
|
261 { |
|
262 iDevice->iConsole->Printf(_L("DrawLine\n")); |
|
263 } |
|
264 |
|
265 EXPORT_C void CDummyGc::DrawLineTo(const TPoint& /*aPoint*/) |
|
266 { |
|
267 iDevice->iConsole->Printf(_L("DrawLineTo\n")); |
|
268 } |
|
269 |
|
270 EXPORT_C void CDummyGc::DrawLineBy(const TPoint& /*aVector*/) |
|
271 { |
|
272 iDevice->iConsole->Printf(_L("DrawLineBy\n")); |
|
273 } |
|
274 |
|
275 EXPORT_C void CDummyGc::DrawPolyLine(const CArrayFix<TPoint>* /*aPointList*/) |
|
276 { |
|
277 iDevice->iConsole->Printf(_L("DrawPolyLine\n")); |
|
278 } |
|
279 |
|
280 EXPORT_C void CDummyGc::DrawPolyLine(const TPoint* /*aPointList*/,TInt /*aNumPoints*/) |
|
281 { |
|
282 iDevice->iConsole->Printf(_L("DrawPolyLine\n")); |
|
283 } |
|
284 |
|
285 EXPORT_C void CDummyGc::DrawPie(const TRect& /*aRect*/,const TPoint& /*aStart*/,const TPoint& /*aEnd*/) |
|
286 { |
|
287 iDevice->iConsole->Printf(_L("DrawPie\n")); |
|
288 } |
|
289 |
|
290 EXPORT_C void CDummyGc::DrawEllipse(const TRect& /*aRect*/) |
|
291 { |
|
292 iDevice->iConsole->Printf(_L("DrawEllipse\n")); |
|
293 } |
|
294 |
|
295 EXPORT_C void CDummyGc::DrawRect(const TRect& /*aRect*/) |
|
296 { |
|
297 iDevice->iConsole->Printf(_L("DrawRect\n")); |
|
298 } |
|
299 |
|
300 EXPORT_C void CDummyGc::DrawRoundRect(const TRect& /*aRect*/,const TSize& /*aCornerSize*/) |
|
301 { |
|
302 iDevice->iConsole->Printf(_L("DrawRoundRect\n")); |
|
303 } |
|
304 |
|
305 EXPORT_C TInt CDummyGc::DrawPolygon(const CArrayFix<TPoint>* /*aPointList*/,TFillRule /*aFillRule*/) |
|
306 { |
|
307 iDevice->iConsole->Printf(_L("DrawPolygon\n")); |
|
308 return KErrNone; |
|
309 } |
|
310 |
|
311 EXPORT_C TInt CDummyGc::DrawPolygon(const TPoint* /*aPointList*/,TInt /*aNumPoints*/,TFillRule /*aFillRule*/) |
|
312 { |
|
313 iDevice->iConsole->Printf(_L("DrawPolygon\n")); |
|
314 return KErrNone; |
|
315 } |
|
316 |
|
317 EXPORT_C void CDummyGc::DrawBitmap(const TPoint& /*aTopLeft*/,const CFbsBitmap* /*aSource*/) |
|
318 { |
|
319 iDevice->iConsole->Printf(_L("DrawBitmap\n")); |
|
320 } |
|
321 |
|
322 EXPORT_C void CDummyGc::DrawBitmap(const TRect& /*aDestRect*/,const CFbsBitmap* /*aSource*/) |
|
323 { |
|
324 iDevice->iConsole->Printf(_L("DrawBitmap\n")); |
|
325 } |
|
326 |
|
327 EXPORT_C void CDummyGc::DrawBitmap(const TRect& /*aDestRect*/,const CFbsBitmap* /*aSource*/,const TRect& /*aSourceRect*/) |
|
328 { |
|
329 iDevice->iConsole->Printf(_L("DrawBitmap\n")); |
|
330 } |
|
331 |
|
332 EXPORT_C void CDummyGc::DrawText(const TDesC& /*aString*/,const TPoint& /*aPosition*/) |
|
333 { |
|
334 iDevice->iConsole->Printf(_L("DrawText\n")); |
|
335 } |
|
336 |
|
337 EXPORT_C void CDummyGc::DrawText(const TDesC& /*aString*/,const TRect& /*aBox*/,TInt /*aBaselineOffset*/,TTextAlign /*aHoriz*/,TInt /*aLeftMrg*/) |
|
338 { |
|
339 iDevice->iConsole->Printf(_L("DrawText\n")); |
|
340 } |
|
341 |
|
342 EXPORT_C void CDummyGc::DrawBitmapMasked(const TRect& /*aDestRect*/,const CFbsBitmap* /*aBitmap*/,const TRect& /*aSourceRect*/,const CFbsBitmap* /*aMaskBitmap*/,TBool /*aInvertMask*/) |
|
343 { |
|
344 } |
|
345 |
|
346 EXPORT_C void CDummyGc::DrawBitmapMasked(const TRect& /*aDestRect*/,const CWsBitmap* /*aBitmap*/,const TRect& /*aSourceRect*/,const CWsBitmap* /*aMaskBitmap*/,TBool /*aInvertMask*/) |
|
347 { |
|
348 } |