sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Part of the MVS Application for TechView
|
sl@0
|
15 |
//
|
sl@0
|
16 |
|
sl@0
|
17 |
#include <w32std.h>
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "MVSApp.h"
|
sl@0
|
20 |
#include "MVSAppUI.h"
|
sl@0
|
21 |
#include "mvsvideocontrol.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
CMVSAppView* CMVSAppView::NewL(const TRect& aRect, CMVSVideoPlayAgent& aVideoPlayAgent)
|
sl@0
|
24 |
{
|
sl@0
|
25 |
CMVSAppView * self = new(ELeave) CMVSAppView;
|
sl@0
|
26 |
CleanupStack::PushL(self);
|
sl@0
|
27 |
self->ConstructL(aRect, aVideoPlayAgent);
|
sl@0
|
28 |
CleanupStack::Pop();
|
sl@0
|
29 |
return self;
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
|
sl@0
|
33 |
CMVSAppView::CMVSAppView()
|
sl@0
|
34 |
{
|
sl@0
|
35 |
}
|
sl@0
|
36 |
|
sl@0
|
37 |
|
sl@0
|
38 |
CMVSAppView::~CMVSAppView()
|
sl@0
|
39 |
{
|
sl@0
|
40 |
//Remove our controls
|
sl@0
|
41 |
delete iMainWindowControl;
|
sl@0
|
42 |
delete iStatusWindowFNameControl;
|
sl@0
|
43 |
delete iStatusWindowStateControl;
|
sl@0
|
44 |
delete iStatusWindowTimeControl;
|
sl@0
|
45 |
delete iInfoWindowControl;
|
sl@0
|
46 |
delete iProgress;
|
sl@0
|
47 |
|
sl@0
|
48 |
CloseWindow();
|
sl@0
|
49 |
}
|
sl@0
|
50 |
|
sl@0
|
51 |
|
sl@0
|
52 |
void CMVSAppView::ConstructL(const TRect& aRect, CMVSVideoPlayAgent& aVideoPlayAgent)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
//we need a window in which to place controls, so take ownership of one
|
sl@0
|
55 |
CreateWindowL();
|
sl@0
|
56 |
|
sl@0
|
57 |
//Set the extent of the control.
|
sl@0
|
58 |
SetRect(aRect);
|
sl@0
|
59 |
TRect fullRectWindow = Rect();
|
sl@0
|
60 |
//vertical point co-ordinate
|
sl@0
|
61 |
TInt statusPaneHeight = 4*(fullRectWindow.iTl.iY + fullRectWindow.iBr.iY)/5;
|
sl@0
|
62 |
TInt halfLength = (fullRectWindow.iTl.iX + fullRectWindow.iBr.iX)/2;
|
sl@0
|
63 |
TInt threeQuarterLength= 3*(fullRectWindow.iTl.iX + fullRectWindow.iBr.iX)/4;
|
sl@0
|
64 |
|
sl@0
|
65 |
//set the dimensions of our main window
|
sl@0
|
66 |
TRect mainWindow(Rect());
|
sl@0
|
67 |
mainWindow.iTl.iX = halfLength-115;
|
sl@0
|
68 |
mainWindow.iBr.iY = statusPaneHeight;
|
sl@0
|
69 |
|
sl@0
|
70 |
iMainWindowControl = CMVSVideoControl::NewL(aVideoPlayAgent, 0, Window());
|
sl@0
|
71 |
iMainWindowControl->SetExtent(mainWindow.iTl, mainWindow.Size());
|
sl@0
|
72 |
|
sl@0
|
73 |
//set the dimensions of our status window
|
sl@0
|
74 |
TRect statusWindowFName = fullRectWindow;
|
sl@0
|
75 |
statusWindowFName.iTl.iY = statusPaneHeight;
|
sl@0
|
76 |
statusWindowFName.iBr.iX = halfLength;
|
sl@0
|
77 |
|
sl@0
|
78 |
//now construct our status window filename control
|
sl@0
|
79 |
iStatusWindowFNameControl = CMVSFileControl::NewL(*this, statusWindowFName,
|
sl@0
|
80 |
KNullDesC);
|
sl@0
|
81 |
//set the dimensions of our state window
|
sl@0
|
82 |
TRect statusWindowState = fullRectWindow;
|
sl@0
|
83 |
statusWindowState.iTl.iX = halfLength;
|
sl@0
|
84 |
statusWindowState.iTl.iY = statusPaneHeight;
|
sl@0
|
85 |
statusWindowState.iBr.iX = threeQuarterLength;
|
sl@0
|
86 |
|
sl@0
|
87 |
//now construct our status window state control
|
sl@0
|
88 |
iStatusWindowStateControl = CMVSStateControl::NewL(*this, statusWindowState,
|
sl@0
|
89 |
KNullDesC);
|
sl@0
|
90 |
|
sl@0
|
91 |
//set the dimensions of our timer window
|
sl@0
|
92 |
TRect statusWindowTime = fullRectWindow;
|
sl@0
|
93 |
statusWindowTime.iTl.iX = threeQuarterLength;
|
sl@0
|
94 |
statusWindowTime.iTl.iY = statusPaneHeight;
|
sl@0
|
95 |
|
sl@0
|
96 |
//now construct our status window timer control
|
sl@0
|
97 |
iStatusWindowTimeControl = CMVSTimeControl::NewL(*this, statusWindowTime,
|
sl@0
|
98 |
KNullDesC);
|
sl@0
|
99 |
TRect infoWindow = fullRectWindow;
|
sl@0
|
100 |
infoWindow.iTl.iX=0;
|
sl@0
|
101 |
infoWindow.iBr.iX= halfLength-115;
|
sl@0
|
102 |
infoWindow.iBr.iY =statusPaneHeight-15;
|
sl@0
|
103 |
iInfoWindowControl = CMVSInfoControl::NewL(*this,infoWindow,KNullDesC);
|
sl@0
|
104 |
iInfoWindowControl->SetParent(this);
|
sl@0
|
105 |
//now activate the control.
|
sl@0
|
106 |
|
sl@0
|
107 |
// construct and draw the progress bar
|
sl@0
|
108 |
iProgress = new (ELeave) CEikProgressInfo();
|
sl@0
|
109 |
|
sl@0
|
110 |
TResourceReader reader;
|
sl@0
|
111 |
iEikonEnv->CreateResourceReaderLC(reader, R_CLIP_PROGRESSINFO);
|
sl@0
|
112 |
iProgress->ConstructFromResourceL(reader);
|
sl@0
|
113 |
iProgress->SetContainerWindowL(*this);
|
sl@0
|
114 |
iProgress->SetExtent(TPoint(fullRectWindow.iTl.iX+ (fullRectWindow.iBr.iX/20),statusPaneHeight-10),TSize((fullRectWindow.iBr.iX - fullRectWindow.iTl.iX - (fullRectWindow.iBr.iX/10) ),10));
|
sl@0
|
115 |
iProgress->SetAndDraw(0);
|
sl@0
|
116 |
CleanupStack::PopAndDestroy();
|
sl@0
|
117 |
|
sl@0
|
118 |
ActivateL();
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
void CMVSAppView::SetClipLength(TInt& aClipLen)
|
sl@0
|
122 |
{
|
sl@0
|
123 |
iClipLength = aClipLen;
|
sl@0
|
124 |
}
|
sl@0
|
125 |
|
sl@0
|
126 |
//
|
sl@0
|
127 |
//CountComponentControls()
|
sl@0
|
128 |
//
|
sl@0
|
129 |
// Implemented by a view with more than one control so that a call to
|
sl@0
|
130 |
// DrawNow successfully draws all four component controls.
|
sl@0
|
131 |
//
|
sl@0
|
132 |
TInt CMVSAppView::CountComponentControls() const
|
sl@0
|
133 |
{
|
sl@0
|
134 |
return 6; //we have six controls
|
sl@0
|
135 |
}
|
sl@0
|
136 |
|
sl@0
|
137 |
//
|
sl@0
|
138 |
// To handle the Pointer events on the Progress Bar
|
sl@0
|
139 |
//
|
sl@0
|
140 |
void CMVSAppView::HandlePointerEventL(const TPointerEvent &aPointerEvent)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
TInt clipPos;
|
sl@0
|
143 |
TRect rect = iProgress->Rect();
|
sl@0
|
144 |
if( (aPointerEvent.iPosition.iX>=rect.iTl.iX && aPointerEvent.iPosition.iX<=rect.iBr.iX) &&
|
sl@0
|
145 |
(aPointerEvent.iPosition.iY>=rect.iTl.iY && aPointerEvent.iPosition.iY<=rect.iBr.iY) )
|
sl@0
|
146 |
{
|
sl@0
|
147 |
TInt pos = aPointerEvent.iPosition.iX - rect.iTl.iX;
|
sl@0
|
148 |
switch(aPointerEvent.iType)
|
sl@0
|
149 |
{
|
sl@0
|
150 |
case TPointerEvent::EButton1Down:
|
sl@0
|
151 |
break;
|
sl@0
|
152 |
case TPointerEvent::EDrag:
|
sl@0
|
153 |
{
|
sl@0
|
154 |
iProgress->SetAndDraw(pos);
|
sl@0
|
155 |
break;
|
sl@0
|
156 |
}
|
sl@0
|
157 |
case TPointerEvent::EButton1Up:
|
sl@0
|
158 |
{
|
sl@0
|
159 |
TInt progToDraw = pos* (static_cast<double>(200)/(rect.iBr.iX -rect.iTl.iX));
|
sl@0
|
160 |
iProgress->SetAndDraw(progToDraw+1);
|
sl@0
|
161 |
clipPos = (progToDraw+1) *(static_cast<double>(iClipLength)/200);
|
sl@0
|
162 |
TTimeIntervalMicroSeconds clipTime(clipPos);
|
sl@0
|
163 |
static_cast<CMVSAppUi*>(CEikonEnv::Static()->EikAppUi())->SetPosition(clipTime);
|
sl@0
|
164 |
break;
|
sl@0
|
165 |
}
|
sl@0
|
166 |
|
sl@0
|
167 |
default:
|
sl@0
|
168 |
break;
|
sl@0
|
169 |
}
|
sl@0
|
170 |
}
|
sl@0
|
171 |
CCoeControl::HandlePointerEventL(aPointerEvent);
|
sl@0
|
172 |
|
sl@0
|
173 |
}
|
sl@0
|
174 |
|
sl@0
|
175 |
|
sl@0
|
176 |
//
|
sl@0
|
177 |
// Updates the Audion play progress
|
sl@0
|
178 |
//
|
sl@0
|
179 |
void CMVSAppView::UpdatePlayProgress(TTimeIntervalMicroSeconds& aPos)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
TInt curPos = I64INT(aPos.Int64());
|
sl@0
|
182 |
TInt percent = curPos*(static_cast<double>(100)/iClipLength);
|
sl@0
|
183 |
TInt progressPos = percent*2;
|
sl@0
|
184 |
iProgress->SetAndDraw(progressPos+1);
|
sl@0
|
185 |
}
|
sl@0
|
186 |
|
sl@0
|
187 |
//
|
sl@0
|
188 |
// Reset the Progress to ) and redraw
|
sl@0
|
189 |
//
|
sl@0
|
190 |
void CMVSAppView::ResetProgressBar()
|
sl@0
|
191 |
{
|
sl@0
|
192 |
iProgress->SetAndDraw(0);
|
sl@0
|
193 |
}
|
sl@0
|
194 |
//
|
sl@0
|
195 |
//ComponentControl(...)
|
sl@0
|
196 |
//
|
sl@0
|
197 |
// Returns the control by index. The counting sequence goes left to right, top
|
sl@0
|
198 |
// to bottom.
|
sl@0
|
199 |
//
|
sl@0
|
200 |
CCoeControl* CMVSAppView::ComponentControl(TInt aIndex) const
|
sl@0
|
201 |
{
|
sl@0
|
202 |
switch (aIndex)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
case 0: return iMainWindowControl;
|
sl@0
|
205 |
case 1: return iStatusWindowFNameControl;
|
sl@0
|
206 |
case 2: return iStatusWindowStateControl;
|
sl@0
|
207 |
case 3: return iStatusWindowTimeControl;
|
sl@0
|
208 |
case 4: return iInfoWindowControl;
|
sl@0
|
209 |
case 5: return iProgress;
|
sl@0
|
210 |
default: return 0;
|
sl@0
|
211 |
}
|
sl@0
|
212 |
}
|
sl@0
|
213 |
|
sl@0
|
214 |
|
sl@0
|
215 |
|
sl@0
|
216 |
//
|
sl@0
|
217 |
//
|
sl@0
|
218 |
// class CMVSFileControl
|
sl@0
|
219 |
//
|
sl@0
|
220 |
//
|
sl@0
|
221 |
|
sl@0
|
222 |
|
sl@0
|
223 |
|
sl@0
|
224 |
//
|
sl@0
|
225 |
//NewL(...) *** This method can LEAVE ***
|
sl@0
|
226 |
//
|
sl@0
|
227 |
// Factory contructor, initialises a control based on the rectangle provided.
|
sl@0
|
228 |
//
|
sl@0
|
229 |
CMVSFileControl* CMVSFileControl::NewL(const CCoeControl& aContainer,
|
sl@0
|
230 |
const TRect& aRect,
|
sl@0
|
231 |
const TDesC& aText)
|
sl@0
|
232 |
{
|
sl@0
|
233 |
CMVSFileControl* self=new(ELeave) CMVSFileControl;
|
sl@0
|
234 |
CleanupStack::PushL(self);
|
sl@0
|
235 |
self->ConstructL(aContainer, aRect, aText);
|
sl@0
|
236 |
CleanupStack::Pop();
|
sl@0
|
237 |
return self;
|
sl@0
|
238 |
}
|
sl@0
|
239 |
|
sl@0
|
240 |
|
sl@0
|
241 |
//
|
sl@0
|
242 |
//ContructL(...) *** This method can LEAVE ***
|
sl@0
|
243 |
//
|
sl@0
|
244 |
//
|
sl@0
|
245 |
void CMVSFileControl::ConstructL(const CCoeControl& aContainer,
|
sl@0
|
246 |
const TRect& aRect, const TDesC& aText)
|
sl@0
|
247 |
{
|
sl@0
|
248 |
SetContainerWindowL(aContainer);
|
sl@0
|
249 |
SetRect(aRect);
|
sl@0
|
250 |
iWindow = aRect;
|
sl@0
|
251 |
SetTextL(aText);
|
sl@0
|
252 |
//Activate the control
|
sl@0
|
253 |
ActivateL();
|
sl@0
|
254 |
}
|
sl@0
|
255 |
|
sl@0
|
256 |
|
sl@0
|
257 |
//
|
sl@0
|
258 |
//CMVSControl()
|
sl@0
|
259 |
//
|
sl@0
|
260 |
// Constructor, does nothing. Private to prevent it being called.
|
sl@0
|
261 |
//
|
sl@0
|
262 |
CMVSFileControl::CMVSFileControl()
|
sl@0
|
263 |
{
|
sl@0
|
264 |
}
|
sl@0
|
265 |
|
sl@0
|
266 |
|
sl@0
|
267 |
//
|
sl@0
|
268 |
//~CMVSControl()
|
sl@0
|
269 |
//
|
sl@0
|
270 |
// Destructor.
|
sl@0
|
271 |
//
|
sl@0
|
272 |
CMVSFileControl::~CMVSFileControl()
|
sl@0
|
273 |
{
|
sl@0
|
274 |
delete iText;
|
sl@0
|
275 |
}
|
sl@0
|
276 |
|
sl@0
|
277 |
|
sl@0
|
278 |
//Draw the FileName Display Window
|
sl@0
|
279 |
void CMVSFileControl::Draw(const TRect& /*aRect*/) const
|
sl@0
|
280 |
{
|
sl@0
|
281 |
//Establish a Graphics Context
|
sl@0
|
282 |
CWindowGc& gc=SystemGc();
|
sl@0
|
283 |
|
sl@0
|
284 |
//Establish a drawing rectangle
|
sl@0
|
285 |
TRect rect=Rect();
|
sl@0
|
286 |
|
sl@0
|
287 |
//Move in 2 pixels each side to give a white border
|
sl@0
|
288 |
rect.Shrink(2,2);
|
sl@0
|
289 |
|
sl@0
|
290 |
//Set-up a pen
|
sl@0
|
291 |
gc.SetPenStyle(CGraphicsContext::ENullPen);
|
sl@0
|
292 |
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
293 |
gc.SetBrushColor(KRgbDarkGray);
|
sl@0
|
294 |
|
sl@0
|
295 |
//Draw a blank rectangle
|
sl@0
|
296 |
gc.DrawRect(rect);
|
sl@0
|
297 |
|
sl@0
|
298 |
//Fill in the border-regions
|
sl@0
|
299 |
DrawUtils::DrawBetweenRects(gc, Rect(), rect);
|
sl@0
|
300 |
|
sl@0
|
301 |
//Change the pen colour to black
|
sl@0
|
302 |
gc.SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
303 |
gc.SetPenColor(KRgbWhite);
|
sl@0
|
304 |
|
sl@0
|
305 |
//Set the fill colour to 'no fill'
|
sl@0
|
306 |
gc.SetBrushStyle(CGraphicsContext::ENullBrush);
|
sl@0
|
307 |
|
sl@0
|
308 |
//Draw a rectangle (transparent with a black border)
|
sl@0
|
309 |
gc.DrawRect(rect);
|
sl@0
|
310 |
rect.Shrink(1,1);
|
sl@0
|
311 |
|
sl@0
|
312 |
const CFont* appFont = iEikonEnv->AnnotationFont();
|
sl@0
|
313 |
DrawOtherWindows(gc,rect,appFont);
|
sl@0
|
314 |
return;
|
sl@0
|
315 |
}
|
sl@0
|
316 |
|
sl@0
|
317 |
|
sl@0
|
318 |
|
sl@0
|
319 |
//
|
sl@0
|
320 |
//DrawOtherWindows(...)
|
sl@0
|
321 |
//
|
sl@0
|
322 |
// Draw the text in a central position in the window.
|
sl@0
|
323 |
//
|
sl@0
|
324 |
void CMVSFileControl::DrawOtherWindows(CGraphicsContext& aGc,
|
sl@0
|
325 |
const TRect& aDeviceRect,
|
sl@0
|
326 |
const CFont* aFont) const
|
sl@0
|
327 |
{
|
sl@0
|
328 |
//Set up the pen and brush colours
|
sl@0
|
329 |
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
330 |
aGc.SetBrushColor(KRgbGray);
|
sl@0
|
331 |
|
sl@0
|
332 |
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
333 |
aGc.SetPenColor(KRgbWhite);
|
sl@0
|
334 |
|
sl@0
|
335 |
//Set-up a font
|
sl@0
|
336 |
aGc.UseFont(aFont);
|
sl@0
|
337 |
|
sl@0
|
338 |
//Set the baseline to be half the height of the rectangle + half
|
sl@0
|
339 |
//the height of the font
|
sl@0
|
340 |
TInt baseline=aDeviceRect.Height()/2 + aFont->AscentInPixels()/2;
|
sl@0
|
341 |
|
sl@0
|
342 |
//Draw the text
|
sl@0
|
343 |
//__ASSERT_ALWAYS(iText != NULL, User::Panic(KNullPtr, KNAPanicNullPointer));
|
sl@0
|
344 |
aGc.DrawText(*iText, aDeviceRect, baseline, CGraphicsContext::ECenter);
|
sl@0
|
345 |
|
sl@0
|
346 |
//Done with the font
|
sl@0
|
347 |
aGc.DiscardFont();
|
sl@0
|
348 |
}
|
sl@0
|
349 |
|
sl@0
|
350 |
void CMVSFileControl::SetTextL(const TDesC& aText)
|
sl@0
|
351 |
{
|
sl@0
|
352 |
HBufC* text=aText.AllocL();
|
sl@0
|
353 |
delete iText;
|
sl@0
|
354 |
iText=text;
|
sl@0
|
355 |
}
|
sl@0
|
356 |
|
sl@0
|
357 |
//
|
sl@0
|
358 |
//Window()
|
sl@0
|
359 |
//
|
sl@0
|
360 |
// Returns the window defined by this object.
|
sl@0
|
361 |
TRect& CMVSFileControl::Window()
|
sl@0
|
362 |
{
|
sl@0
|
363 |
return iWindow;
|
sl@0
|
364 |
}
|
sl@0
|
365 |
|
sl@0
|
366 |
|
sl@0
|
367 |
|
sl@0
|
368 |
//
|
sl@0
|
369 |
//
|
sl@0
|
370 |
// class CMVSStateControl
|
sl@0
|
371 |
//
|
sl@0
|
372 |
//
|
sl@0
|
373 |
|
sl@0
|
374 |
|
sl@0
|
375 |
|
sl@0
|
376 |
//
|
sl@0
|
377 |
//NewL(...) *** This method can LEAVE ***
|
sl@0
|
378 |
//
|
sl@0
|
379 |
// Factory contructor, initialises a control based on the rectangle provided.
|
sl@0
|
380 |
//
|
sl@0
|
381 |
CMVSStateControl* CMVSStateControl::NewL(const CCoeControl& aContainer,
|
sl@0
|
382 |
const TRect& aRect,
|
sl@0
|
383 |
const TDesC& aText)
|
sl@0
|
384 |
{
|
sl@0
|
385 |
CMVSStateControl* self=new(ELeave) CMVSStateControl;
|
sl@0
|
386 |
CleanupStack::PushL(self);
|
sl@0
|
387 |
self->ConstructL(aContainer, aRect, aText);
|
sl@0
|
388 |
CleanupStack::Pop();
|
sl@0
|
389 |
return self;
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
|
sl@0
|
393 |
|
sl@0
|
394 |
//
|
sl@0
|
395 |
//ContructL(...) *** This method can LEAVE ***
|
sl@0
|
396 |
//
|
sl@0
|
397 |
//
|
sl@0
|
398 |
void CMVSStateControl::ConstructL(const CCoeControl& aContainer,
|
sl@0
|
399 |
const TRect& aRect, const TDesC& aText)
|
sl@0
|
400 |
{
|
sl@0
|
401 |
SetContainerWindowL(aContainer);
|
sl@0
|
402 |
SetRect(aRect);
|
sl@0
|
403 |
iWindow = aRect;
|
sl@0
|
404 |
SetTextL(aText);
|
sl@0
|
405 |
|
sl@0
|
406 |
//Activate the control
|
sl@0
|
407 |
ActivateL();
|
sl@0
|
408 |
}
|
sl@0
|
409 |
|
sl@0
|
410 |
|
sl@0
|
411 |
|
sl@0
|
412 |
//
|
sl@0
|
413 |
//CMVSControl()
|
sl@0
|
414 |
//
|
sl@0
|
415 |
// Constructor, does nothing. Private to prevent it being called.
|
sl@0
|
416 |
//
|
sl@0
|
417 |
CMVSStateControl::CMVSStateControl()
|
sl@0
|
418 |
{
|
sl@0
|
419 |
}
|
sl@0
|
420 |
|
sl@0
|
421 |
|
sl@0
|
422 |
//
|
sl@0
|
423 |
//~CMVSControl()
|
sl@0
|
424 |
//
|
sl@0
|
425 |
// Destructor.
|
sl@0
|
426 |
//
|
sl@0
|
427 |
CMVSStateControl::~CMVSStateControl()
|
sl@0
|
428 |
{
|
sl@0
|
429 |
delete iText;
|
sl@0
|
430 |
}
|
sl@0
|
431 |
|
sl@0
|
432 |
|
sl@0
|
433 |
|
sl@0
|
434 |
|
sl@0
|
435 |
//For Displaying the state
|
sl@0
|
436 |
void CMVSStateControl::Draw(const TRect& /*aRect*/) const
|
sl@0
|
437 |
{
|
sl@0
|
438 |
//Establish a Graphics Context
|
sl@0
|
439 |
CWindowGc& gc=SystemGc();
|
sl@0
|
440 |
|
sl@0
|
441 |
//Establish a drawing rectangle
|
sl@0
|
442 |
TRect rect=Rect();
|
sl@0
|
443 |
|
sl@0
|
444 |
//Move in 2 pixels each side to give a white border
|
sl@0
|
445 |
rect.Shrink(2,2);
|
sl@0
|
446 |
|
sl@0
|
447 |
//Set-up a pen
|
sl@0
|
448 |
gc.SetPenStyle(CGraphicsContext::ENullPen);
|
sl@0
|
449 |
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
450 |
gc.SetBrushColor(KRgbDarkGray);
|
sl@0
|
451 |
|
sl@0
|
452 |
//Draw a blank rectangle
|
sl@0
|
453 |
gc.DrawRect(rect);
|
sl@0
|
454 |
|
sl@0
|
455 |
//Fill in the border-regions
|
sl@0
|
456 |
DrawUtils::DrawBetweenRects(gc, Rect(), rect);
|
sl@0
|
457 |
|
sl@0
|
458 |
//Change the pen colour to black
|
sl@0
|
459 |
gc.SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
460 |
gc.SetPenColor(KRgbWhite);
|
sl@0
|
461 |
|
sl@0
|
462 |
//Set the fill colour to 'no fill'
|
sl@0
|
463 |
gc.SetBrushStyle(CGraphicsContext::ENullBrush);
|
sl@0
|
464 |
|
sl@0
|
465 |
//Draw a rectangle (transparent with a black border)
|
sl@0
|
466 |
gc.DrawRect(rect);
|
sl@0
|
467 |
rect.Shrink(1,1);
|
sl@0
|
468 |
|
sl@0
|
469 |
const CFont* appFont = iEikonEnv->AnnotationFont();
|
sl@0
|
470 |
DrawOtherWindows(gc,rect,appFont);
|
sl@0
|
471 |
return;
|
sl@0
|
472 |
}
|
sl@0
|
473 |
|
sl@0
|
474 |
|
sl@0
|
475 |
|
sl@0
|
476 |
|
sl@0
|
477 |
//
|
sl@0
|
478 |
//DrawOtherWindows(...)
|
sl@0
|
479 |
//
|
sl@0
|
480 |
// Draw the text in a central position in the window.
|
sl@0
|
481 |
//
|
sl@0
|
482 |
void CMVSStateControl::DrawOtherWindows(CGraphicsContext& aGc,
|
sl@0
|
483 |
const TRect& aDeviceRect,
|
sl@0
|
484 |
const CFont* aFont) const
|
sl@0
|
485 |
{
|
sl@0
|
486 |
//Set up the pen and brush colours
|
sl@0
|
487 |
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
488 |
aGc.SetBrushColor(KRgbGray);
|
sl@0
|
489 |
|
sl@0
|
490 |
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
491 |
aGc.SetPenColor(KRgbWhite);
|
sl@0
|
492 |
|
sl@0
|
493 |
//Set-up a font
|
sl@0
|
494 |
aGc.UseFont(aFont);
|
sl@0
|
495 |
|
sl@0
|
496 |
//Set the baseline to be half the height of the rectangle + half
|
sl@0
|
497 |
//the height of the font
|
sl@0
|
498 |
TInt baseline=aDeviceRect.Height()/2 + aFont->AscentInPixels()/2;
|
sl@0
|
499 |
|
sl@0
|
500 |
//Draw the text
|
sl@0
|
501 |
//__ASSERT_ALWAYS(iText != NULL, User::Panic(KNullPtr, KNAPanicNullPointer));
|
sl@0
|
502 |
aGc.DrawText(*iText, aDeviceRect, baseline, CGraphicsContext::ECenter);
|
sl@0
|
503 |
|
sl@0
|
504 |
//Done with the font
|
sl@0
|
505 |
aGc.DiscardFont();
|
sl@0
|
506 |
}
|
sl@0
|
507 |
|
sl@0
|
508 |
void CMVSStateControl::SetTextL(const TDesC& aText)
|
sl@0
|
509 |
{
|
sl@0
|
510 |
HBufC* text=aText.AllocL();
|
sl@0
|
511 |
delete iText;
|
sl@0
|
512 |
iText=NULL;
|
sl@0
|
513 |
iText=text;
|
sl@0
|
514 |
}
|
sl@0
|
515 |
|
sl@0
|
516 |
//
|
sl@0
|
517 |
//Window()
|
sl@0
|
518 |
//
|
sl@0
|
519 |
// Returns the window defined by this object.
|
sl@0
|
520 |
TRect& CMVSStateControl::Window()
|
sl@0
|
521 |
{
|
sl@0
|
522 |
return iWindow;
|
sl@0
|
523 |
}
|
sl@0
|
524 |
|
sl@0
|
525 |
|
sl@0
|
526 |
|
sl@0
|
527 |
//
|
sl@0
|
528 |
//
|
sl@0
|
529 |
// class CMVSTimeControl
|
sl@0
|
530 |
//
|
sl@0
|
531 |
//
|
sl@0
|
532 |
|
sl@0
|
533 |
|
sl@0
|
534 |
|
sl@0
|
535 |
//
|
sl@0
|
536 |
//NewL(...) *** This method can LEAVE ***
|
sl@0
|
537 |
//
|
sl@0
|
538 |
// Factory contructor, initialises a control based on the rectangle provided.
|
sl@0
|
539 |
//
|
sl@0
|
540 |
CMVSTimeControl* CMVSTimeControl::NewL(const CCoeControl& aContainer,
|
sl@0
|
541 |
const TRect& aRect,
|
sl@0
|
542 |
const TDesC& aText)
|
sl@0
|
543 |
{
|
sl@0
|
544 |
CMVSTimeControl* self=new(ELeave) CMVSTimeControl;
|
sl@0
|
545 |
CleanupStack::PushL(self);
|
sl@0
|
546 |
self->ConstructL(aContainer, aRect, aText);
|
sl@0
|
547 |
CleanupStack::Pop();
|
sl@0
|
548 |
return self;
|
sl@0
|
549 |
}
|
sl@0
|
550 |
|
sl@0
|
551 |
|
sl@0
|
552 |
|
sl@0
|
553 |
//
|
sl@0
|
554 |
//ContructL(...) *** This method can LEAVE ***
|
sl@0
|
555 |
//
|
sl@0
|
556 |
//
|
sl@0
|
557 |
void CMVSTimeControl::ConstructL(const CCoeControl& aContainer,
|
sl@0
|
558 |
const TRect& aRect, const TDesC& aText)
|
sl@0
|
559 |
{
|
sl@0
|
560 |
SetContainerWindowL(aContainer);
|
sl@0
|
561 |
SetRect(aRect);
|
sl@0
|
562 |
iWindow = aRect;
|
sl@0
|
563 |
SetTextL(aText);
|
sl@0
|
564 |
iText2 = NULL;
|
sl@0
|
565 |
//Activate the control
|
sl@0
|
566 |
ActivateL();
|
sl@0
|
567 |
}
|
sl@0
|
568 |
|
sl@0
|
569 |
|
sl@0
|
570 |
|
sl@0
|
571 |
//
|
sl@0
|
572 |
//CMVSControl()
|
sl@0
|
573 |
//
|
sl@0
|
574 |
// Constructor, does nothing. Private to prevent it being called.
|
sl@0
|
575 |
//
|
sl@0
|
576 |
CMVSTimeControl::CMVSTimeControl()
|
sl@0
|
577 |
{
|
sl@0
|
578 |
}
|
sl@0
|
579 |
|
sl@0
|
580 |
|
sl@0
|
581 |
//
|
sl@0
|
582 |
//~CMVSControl()
|
sl@0
|
583 |
//
|
sl@0
|
584 |
// Destructor.
|
sl@0
|
585 |
//
|
sl@0
|
586 |
CMVSTimeControl::~CMVSTimeControl()
|
sl@0
|
587 |
{
|
sl@0
|
588 |
delete iText;
|
sl@0
|
589 |
if(iText2)
|
sl@0
|
590 |
{
|
sl@0
|
591 |
delete iText2;
|
sl@0
|
592 |
}
|
sl@0
|
593 |
}
|
sl@0
|
594 |
|
sl@0
|
595 |
|
sl@0
|
596 |
|
sl@0
|
597 |
|
sl@0
|
598 |
//For TimeDisplay
|
sl@0
|
599 |
void CMVSTimeControl::Draw(const TRect& /*aRect*/) const
|
sl@0
|
600 |
{
|
sl@0
|
601 |
//Establish a Graphics Context
|
sl@0
|
602 |
CWindowGc& gc=SystemGc();
|
sl@0
|
603 |
|
sl@0
|
604 |
//Establish a drawing rectangle
|
sl@0
|
605 |
TRect rect=Rect();
|
sl@0
|
606 |
|
sl@0
|
607 |
//Move in 2 pixels each side to give a white border
|
sl@0
|
608 |
rect.Shrink(2,2);
|
sl@0
|
609 |
|
sl@0
|
610 |
//Set-up a pen
|
sl@0
|
611 |
gc.SetPenStyle(CGraphicsContext::ENullPen);
|
sl@0
|
612 |
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
613 |
gc.SetBrushColor(KRgbDarkGray);
|
sl@0
|
614 |
|
sl@0
|
615 |
//Draw a blank rectangle
|
sl@0
|
616 |
gc.DrawRect(rect);
|
sl@0
|
617 |
|
sl@0
|
618 |
//Fill in the border-regions
|
sl@0
|
619 |
DrawUtils::DrawBetweenRects(gc, Rect(), rect);
|
sl@0
|
620 |
|
sl@0
|
621 |
//Change the pen colour to black
|
sl@0
|
622 |
gc.SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
623 |
gc.SetPenColor(KRgbWhite);
|
sl@0
|
624 |
|
sl@0
|
625 |
//Set the fill colour to 'no fill'
|
sl@0
|
626 |
gc.SetBrushStyle(CGraphicsContext::ENullBrush);
|
sl@0
|
627 |
|
sl@0
|
628 |
//Draw a rectangle (transparent with a black border)
|
sl@0
|
629 |
gc.DrawRect(rect);
|
sl@0
|
630 |
rect.Shrink(1,1);
|
sl@0
|
631 |
|
sl@0
|
632 |
const CFont* appFont = iEikonEnv->AnnotationFont();
|
sl@0
|
633 |
DrawOtherWindows(gc,rect,appFont);
|
sl@0
|
634 |
return;
|
sl@0
|
635 |
}
|
sl@0
|
636 |
|
sl@0
|
637 |
|
sl@0
|
638 |
|
sl@0
|
639 |
|
sl@0
|
640 |
//
|
sl@0
|
641 |
//DrawOtherWindows(...)
|
sl@0
|
642 |
//
|
sl@0
|
643 |
// Draw the text in a central position in the window.
|
sl@0
|
644 |
//
|
sl@0
|
645 |
void CMVSTimeControl::DrawOtherWindows(CGraphicsContext& aGc,
|
sl@0
|
646 |
const TRect& aDeviceRect,
|
sl@0
|
647 |
const CFont* aFont) const
|
sl@0
|
648 |
{
|
sl@0
|
649 |
//Set up the pen and brush colours
|
sl@0
|
650 |
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
651 |
aGc.SetBrushColor(KRgbGray);
|
sl@0
|
652 |
|
sl@0
|
653 |
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
654 |
aGc.SetPenColor(KRgbWhite);
|
sl@0
|
655 |
|
sl@0
|
656 |
//Set-up a font
|
sl@0
|
657 |
aGc.UseFont(aFont);
|
sl@0
|
658 |
|
sl@0
|
659 |
|
sl@0
|
660 |
if(iText2)
|
sl@0
|
661 |
{
|
sl@0
|
662 |
TInt rWidth = aDeviceRect.iBr.iX - aDeviceRect.iTl.iX;
|
sl@0
|
663 |
TInt rHeight = aDeviceRect.iBr.iY - aDeviceRect.iTl.iY;
|
sl@0
|
664 |
|
sl@0
|
665 |
TRect rect1(aDeviceRect.iTl,TSize(rWidth, rHeight/2));
|
sl@0
|
666 |
TRect rect2(TPoint(aDeviceRect.iTl.iX, aDeviceRect.iTl.iY + rHeight/2),TSize(rWidth, rHeight/2));
|
sl@0
|
667 |
|
sl@0
|
668 |
TInt baseline = rect1.Height();
|
sl@0
|
669 |
//Draw the text 1
|
sl@0
|
670 |
aGc.DrawText(*iText, rect1, baseline - 2, CGraphicsContext::ECenter);
|
sl@0
|
671 |
//Draw the text 2
|
sl@0
|
672 |
aGc.DrawText(*iText2, rect2, baseline - 3 , CGraphicsContext::ECenter);
|
sl@0
|
673 |
}
|
sl@0
|
674 |
else
|
sl@0
|
675 |
{
|
sl@0
|
676 |
//Set the baseline to be half the height of the rectangle + half
|
sl@0
|
677 |
//the height of the font
|
sl@0
|
678 |
TInt baseline=aDeviceRect.Height()/2 + aFont->AscentInPixels()/2;
|
sl@0
|
679 |
|
sl@0
|
680 |
//Draw the text
|
sl@0
|
681 |
aGc.DrawText(*iText, aDeviceRect, baseline, CGraphicsContext::ECenter);
|
sl@0
|
682 |
}
|
sl@0
|
683 |
|
sl@0
|
684 |
//Done with the font
|
sl@0
|
685 |
aGc.DiscardFont();
|
sl@0
|
686 |
}
|
sl@0
|
687 |
|
sl@0
|
688 |
void CMVSTimeControl::SetTextL(const TDesC& aText)
|
sl@0
|
689 |
{
|
sl@0
|
690 |
HBufC* text=aText.AllocL();
|
sl@0
|
691 |
delete iText;
|
sl@0
|
692 |
iText=NULL;
|
sl@0
|
693 |
iText=text;
|
sl@0
|
694 |
}
|
sl@0
|
695 |
|
sl@0
|
696 |
void CMVSTimeControl::SetText2L(const TDesC& aText)
|
sl@0
|
697 |
{
|
sl@0
|
698 |
HBufC* text=aText.AllocL();
|
sl@0
|
699 |
delete iText2;
|
sl@0
|
700 |
iText2=NULL;
|
sl@0
|
701 |
iText2=text;
|
sl@0
|
702 |
}
|
sl@0
|
703 |
|
sl@0
|
704 |
void CMVSTimeControl::ResetText2L()
|
sl@0
|
705 |
{
|
sl@0
|
706 |
delete iText2;
|
sl@0
|
707 |
iText2=NULL;
|
sl@0
|
708 |
}
|
sl@0
|
709 |
//
|
sl@0
|
710 |
//Window()
|
sl@0
|
711 |
//
|
sl@0
|
712 |
// Returns the window defined by this object.
|
sl@0
|
713 |
TRect& CMVSTimeControl::Window()
|
sl@0
|
714 |
{
|
sl@0
|
715 |
return iWindow;
|
sl@0
|
716 |
}
|
sl@0
|
717 |
|
sl@0
|
718 |
|
sl@0
|
719 |
//
|
sl@0
|
720 |
//
|
sl@0
|
721 |
// class CMVSInfoControl
|
sl@0
|
722 |
//
|
sl@0
|
723 |
//
|
sl@0
|
724 |
|
sl@0
|
725 |
|
sl@0
|
726 |
|
sl@0
|
727 |
//
|
sl@0
|
728 |
//NewL(...) *** This method can LEAVE ***
|
sl@0
|
729 |
//
|
sl@0
|
730 |
// Factory contructor, initialises a control based on the rectangle provided.
|
sl@0
|
731 |
//
|
sl@0
|
732 |
CMVSInfoControl* CMVSInfoControl::NewL(const CCoeControl& aContainer,
|
sl@0
|
733 |
const TRect& aRect,
|
sl@0
|
734 |
const TDesC& aText)
|
sl@0
|
735 |
{
|
sl@0
|
736 |
CMVSInfoControl* self=new(ELeave) CMVSInfoControl;
|
sl@0
|
737 |
CleanupStack::PushL(self);
|
sl@0
|
738 |
self->ConstructL(aContainer, aRect, aText);
|
sl@0
|
739 |
CleanupStack::Pop();
|
sl@0
|
740 |
return self;
|
sl@0
|
741 |
}
|
sl@0
|
742 |
|
sl@0
|
743 |
|
sl@0
|
744 |
|
sl@0
|
745 |
//
|
sl@0
|
746 |
//ContructL(...) *** This method can LEAVE ***
|
sl@0
|
747 |
//
|
sl@0
|
748 |
//
|
sl@0
|
749 |
void CMVSInfoControl::ConstructL(const CCoeControl& aContainer,
|
sl@0
|
750 |
const TRect& aRect, const TDesC& aText)
|
sl@0
|
751 |
{
|
sl@0
|
752 |
SetContainerWindowL(aContainer);
|
sl@0
|
753 |
SetRect(aRect);
|
sl@0
|
754 |
iWindow = aRect;
|
sl@0
|
755 |
SetTextL(aText);
|
sl@0
|
756 |
//Activate the control
|
sl@0
|
757 |
ActivateL();
|
sl@0
|
758 |
}
|
sl@0
|
759 |
|
sl@0
|
760 |
|
sl@0
|
761 |
|
sl@0
|
762 |
//
|
sl@0
|
763 |
//CMVSControl()
|
sl@0
|
764 |
//
|
sl@0
|
765 |
// Constructor, does nothing. Private to prevent it being called.
|
sl@0
|
766 |
//
|
sl@0
|
767 |
CMVSInfoControl::CMVSInfoControl()
|
sl@0
|
768 |
{
|
sl@0
|
769 |
}
|
sl@0
|
770 |
|
sl@0
|
771 |
|
sl@0
|
772 |
//
|
sl@0
|
773 |
//~CMVSControl()
|
sl@0
|
774 |
//
|
sl@0
|
775 |
// Destructor.
|
sl@0
|
776 |
//
|
sl@0
|
777 |
CMVSInfoControl::~CMVSInfoControl()
|
sl@0
|
778 |
{
|
sl@0
|
779 |
delete iText;
|
sl@0
|
780 |
}
|
sl@0
|
781 |
|
sl@0
|
782 |
|
sl@0
|
783 |
|
sl@0
|
784 |
//
|
sl@0
|
785 |
//Draw(...)
|
sl@0
|
786 |
//
|
sl@0
|
787 |
void CMVSInfoControl::Draw(const TRect& /*aRect*/) const
|
sl@0
|
788 |
{
|
sl@0
|
789 |
//Establish a Graphics Context
|
sl@0
|
790 |
CWindowGc& gc=SystemGc();
|
sl@0
|
791 |
|
sl@0
|
792 |
//Establish a drawing rectangle
|
sl@0
|
793 |
TRect rect=Rect();
|
sl@0
|
794 |
|
sl@0
|
795 |
//Move in 2 pixels each side to give a white border
|
sl@0
|
796 |
rect.Shrink(2,2);
|
sl@0
|
797 |
|
sl@0
|
798 |
//Set-up a pen
|
sl@0
|
799 |
gc.SetPenStyle(CGraphicsContext::ENullPen);
|
sl@0
|
800 |
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
801 |
gc.SetBrushColor(KRgbDarkGray);
|
sl@0
|
802 |
|
sl@0
|
803 |
//Draw a blank rectangle
|
sl@0
|
804 |
//gc.DrawRect(rect);
|
sl@0
|
805 |
|
sl@0
|
806 |
//To cover Progress Bar area
|
sl@0
|
807 |
TRect ProgRect = rect;
|
sl@0
|
808 |
TInt statusPaneHeight = 4*(Parent()->Rect().iTl.iY + Parent()->Rect().iBr.iY)/5;
|
sl@0
|
809 |
ProgRect.iBr.iY = statusPaneHeight;
|
sl@0
|
810 |
ProgRect.Grow(2,0);
|
sl@0
|
811 |
gc.DrawRect(ProgRect);
|
sl@0
|
812 |
|
sl@0
|
813 |
//Fill in the border-regions
|
sl@0
|
814 |
DrawUtils::DrawBetweenRects(gc, Rect(), rect);
|
sl@0
|
815 |
|
sl@0
|
816 |
//Change the pen colour to black
|
sl@0
|
817 |
gc.SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
818 |
gc.SetPenColor(KRgbWhite);
|
sl@0
|
819 |
|
sl@0
|
820 |
//Set the fill colour to 'no fill'
|
sl@0
|
821 |
gc.SetBrushStyle(CGraphicsContext::ENullBrush);
|
sl@0
|
822 |
|
sl@0
|
823 |
//Draw a rectangle (transparent with a black border)
|
sl@0
|
824 |
gc.DrawRect(rect);
|
sl@0
|
825 |
rect.Shrink(1,1);
|
sl@0
|
826 |
|
sl@0
|
827 |
const CFont* appFont = iEikonEnv->AnnotationFont();
|
sl@0
|
828 |
DrawMainWindow(gc,rect,appFont);
|
sl@0
|
829 |
return;
|
sl@0
|
830 |
}
|
sl@0
|
831 |
|
sl@0
|
832 |
|
sl@0
|
833 |
|
sl@0
|
834 |
void CMVSInfoControl::DrawMainWindow(CGraphicsContext& aGc,
|
sl@0
|
835 |
const TRect& /*aDeviceRect*/,
|
sl@0
|
836 |
const CFont* aFont) const
|
sl@0
|
837 |
{
|
sl@0
|
838 |
//Set up a brush and pen
|
sl@0
|
839 |
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
840 |
aGc.SetBrushColor(KRgbDarkGray);
|
sl@0
|
841 |
|
sl@0
|
842 |
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
843 |
aGc.SetPenColor(KRgbWhite);
|
sl@0
|
844 |
|
sl@0
|
845 |
//Get a font
|
sl@0
|
846 |
aGc.UseFont(aFont);
|
sl@0
|
847 |
|
sl@0
|
848 |
//The 'step' by which we move down to get to a fresh line in
|
sl@0
|
849 |
//the window
|
sl@0
|
850 |
TInt distToNextBaseline = (aFont->AscentInPixels()/2)*3;
|
sl@0
|
851 |
|
sl@0
|
852 |
//The main window text
|
sl@0
|
853 |
TPtrC mainWindowText;
|
sl@0
|
854 |
mainWindowText.Set(iText->Des());
|
sl@0
|
855 |
|
sl@0
|
856 |
//The escape sequence
|
sl@0
|
857 |
_LIT(KDollarDollar, "$$");
|
sl@0
|
858 |
|
sl@0
|
859 |
TRect rect;
|
sl@0
|
860 |
TInt x = 10; //The left hand side of the rectangle
|
sl@0
|
861 |
TInt y = 10; //The top of the rectangle.
|
sl@0
|
862 |
|
sl@0
|
863 |
//Whilst we can find a '$$' in the string
|
sl@0
|
864 |
while(mainWindowText.Find(KDollarDollar) != KErrNotFound)
|
sl@0
|
865 |
{
|
sl@0
|
866 |
//do text up to $$
|
sl@0
|
867 |
TInt pos = mainWindowText.Find(KDollarDollar);
|
sl@0
|
868 |
TPtrC text(mainWindowText.Mid(0,pos));
|
sl@0
|
869 |
|
sl@0
|
870 |
//define the rectangle for this text
|
sl@0
|
871 |
TInt height = aFont->HeightInPixels();
|
sl@0
|
872 |
TInt width = aFont->TextWidthInPixels( text );
|
sl@0
|
873 |
rect.SetRect( x, y, x + width, y + height );
|
sl@0
|
874 |
|
sl@0
|
875 |
//Draw the text
|
sl@0
|
876 |
aGc.DrawText(text, rect, height - aFont->DescentInPixels(),
|
sl@0
|
877 |
CGraphicsContext::ELeft);
|
sl@0
|
878 |
|
sl@0
|
879 |
//delete text upto and including '$$'
|
sl@0
|
880 |
text.Set(mainWindowText.Right(mainWindowText.Length() - (pos+2)));
|
sl@0
|
881 |
mainWindowText.Set(text);
|
sl@0
|
882 |
|
sl@0
|
883 |
//adjust the baseline offset
|
sl@0
|
884 |
y+=distToNextBaseline;
|
sl@0
|
885 |
}
|
sl@0
|
886 |
|
sl@0
|
887 |
//Done with our font
|
sl@0
|
888 |
aGc.DiscardFont();
|
sl@0
|
889 |
}
|
sl@0
|
890 |
|
sl@0
|
891 |
|
sl@0
|
892 |
void CMVSInfoControl::SetTextL(const TDesC& aText)
|
sl@0
|
893 |
{
|
sl@0
|
894 |
HBufC* text=aText.AllocL();
|
sl@0
|
895 |
delete iText;
|
sl@0
|
896 |
iText=NULL;
|
sl@0
|
897 |
iText=text;
|
sl@0
|
898 |
}
|
sl@0
|
899 |
|
sl@0
|
900 |
//
|
sl@0
|
901 |
//Window()
|
sl@0
|
902 |
//
|
sl@0
|
903 |
// Returns the window defined by this object.
|
sl@0
|
904 |
TRect& CMVSInfoControl::Window()
|
sl@0
|
905 |
{
|
sl@0
|
906 |
return iWindow;
|
sl@0
|
907 |
}
|