|
1 /* |
|
2 * Copyright (c) 2010 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: Redrawmonitor active object |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <w32std.h> |
|
19 |
|
20 #include "controler.h" |
|
21 #include "redrawmonitor.h" |
|
22 |
|
23 CRedrawMonitor::CRedrawMonitor(CControler& aControler, RWsSession& aWsSession, |
|
24 RWindowGroup& aWindowGroup) : CActive(CActive::EPriorityLow),iYlEnv(aControler) |
|
25 ,iWsSession(aWsSession), iWindowGroup(aWindowGroup) |
|
26 { |
|
27 CActiveScheduler::Add(this); |
|
28 } |
|
29 CRedrawMonitor* CRedrawMonitor::NewL(CControler& aControler, RWsSession& aWsSession, |
|
30 RWindowGroup& aWindowGroup) |
|
31 { |
|
32 CRedrawMonitor* self = new (ELeave) CRedrawMonitor(aControler, aWsSession, aWindowGroup); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(); // self; |
|
36 return self; |
|
37 } |
|
38 void CRedrawMonitor::ConstructL() |
|
39 { |
|
40 iWsSession.RedrawReady(&iStatus); |
|
41 SetActive(); |
|
42 } |
|
43 CRedrawMonitor::~CRedrawMonitor() |
|
44 { |
|
45 Cancel(); |
|
46 } |
|
47 void CRedrawMonitor::RunL() |
|
48 { |
|
49 if (iStatus == KErrNone) |
|
50 { |
|
51 TWsRedrawEvent event; |
|
52 iWsSession.GetRedraw(event); |
|
53 iYlEnv.Paint(event.Handle(), event.Rect()); |
|
54 iWsSession.RedrawReady(&iStatus); |
|
55 SetActive(); |
|
56 } |
|
57 } |
|
58 void CRedrawMonitor::DoCancel() |
|
59 { |
|
60 iWsSession.RedrawReadyCancel(); |
|
61 } |
|
62 |