|
1 /* |
|
2 * Copyright (c) 2008 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: Task list entry |
|
15 * |
|
16 */ |
|
17 #include <s32mem.h> |
|
18 #include <fbs.h> |
|
19 |
|
20 #include "tsscreenshotmsg.h" |
|
21 |
|
22 // ----------------------------------------------------------------------------- |
|
23 CTsScreenshotMsg* CTsScreenshotMsg::NewLC(RReadStream& aStream) |
|
24 { |
|
25 CTsScreenshotMsg *self = new(ELeave)CTsScreenshotMsg(); |
|
26 CleanupStack::PushL(self); |
|
27 self->ConstructL(aStream); |
|
28 return self; |
|
29 } |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 CTsScreenshotMsg* CTsScreenshotMsg::NewLC( TInt aWindowGroupId, |
|
33 const CFbsBitmap& aBitmap, |
|
34 UpdatePriority aPrior, |
|
35 TInt aRotation ) |
|
36 { |
|
37 CTsScreenshotMsg *self = new(ELeave)CTsScreenshotMsg(); |
|
38 CleanupStack::PushL(self); |
|
39 self->ConstructL(aWindowGroupId, aBitmap, aPrior, aRotation); |
|
40 return self; |
|
41 } |
|
42 // ----------------------------------------------------------------------------- |
|
43 TInt CTsScreenshotMsg::CTsScreenshotMsg::Size() |
|
44 { |
|
45 return sizeof(TInt) * 4; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 CTsScreenshotMsg::~CTsScreenshotMsg() |
|
50 { |
|
51 delete iBitmap; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 TInt CTsScreenshotMsg::WindowGroupId() const |
|
56 { |
|
57 return iWindowGroupId; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 const CFbsBitmap& CTsScreenshotMsg::Screenshot() const |
|
62 { |
|
63 return *iBitmap; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 UpdatePriority CTsScreenshotMsg::Priority() const |
|
68 { |
|
69 return iPriority; |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 TInt CTsScreenshotMsg::Rotation() const |
|
74 { |
|
75 return iRotation; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 HBufC8* CTsScreenshotMsg::ExternalizeLC() const |
|
80 { |
|
81 HBufC8* retVal = HBufC8::NewLC(Size()); |
|
82 TPtr8 des(retVal->Des()); |
|
83 RDesWriteStream stream(des); |
|
84 CleanupClosePushL(stream); |
|
85 stream << (*this); |
|
86 CleanupStack::PopAndDestroy(&stream); |
|
87 return retVal; |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 void CTsScreenshotMsg::ExternalizeL(RWriteStream &stream) const |
|
92 { |
|
93 stream.WriteInt32L(iWindowGroupId); |
|
94 stream.WriteInt32L(iBitmap->Handle()); |
|
95 stream.WriteInt32L(iPriority); |
|
96 stream.WriteInt32L(iRotation); |
|
97 } |
|
98 // ----------------------------------------------------------------------------- |
|
99 void CTsScreenshotMsg::InternalizeL(RReadStream &stream) |
|
100 { |
|
101 iWindowGroupId = stream.ReadInt32L(); |
|
102 User::LeaveIfError(iBitmap->Duplicate(stream.ReadInt32L())); |
|
103 iPriority = static_cast<UpdatePriority>(stream.ReadInt32L()); |
|
104 iRotation = stream.ReadInt32L(); |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 CTsScreenshotMsg::CTsScreenshotMsg() |
|
109 { |
|
110 } |
|
111 // ----------------------------------------------------------------------------- |
|
112 void CTsScreenshotMsg::ConstructL(RReadStream &stream) |
|
113 { |
|
114 iBitmap = new(ELeave)CFbsBitmap(); |
|
115 stream >> (*this); |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 void CTsScreenshotMsg::ConstructL(TInt windowGroupId, const CFbsBitmap& bitmap, UpdatePriority prior, TInt aRotation) |
|
120 { |
|
121 iBitmap = new(ELeave)CFbsBitmap(); |
|
122 User::LeaveIfError(iBitmap->Duplicate(bitmap.Handle())); |
|
123 iWindowGroupId = windowGroupId; |
|
124 iPriority = prior; |
|
125 iRotation = aRotation; |
|
126 } |