sl@0
|
1 |
// Copyright (c) 2008-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 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@test
|
sl@0
|
19 |
@internalComponent
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
|
sl@0
|
23 |
#include "crpwin.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
/*******************************************************************************
|
sl@0
|
26 |
Client side of the crp used by CCrpWin
|
sl@0
|
27 |
*******************************************************************************/
|
sl@0
|
28 |
|
sl@0
|
29 |
|
sl@0
|
30 |
CCrpClient * CCrpClient::NewL()
|
sl@0
|
31 |
{
|
sl@0
|
32 |
CCrpClient * self = new (ELeave) CCrpClient();
|
sl@0
|
33 |
CleanupStack::PushL(self);
|
sl@0
|
34 |
self->ConstructL();
|
sl@0
|
35 |
CleanupStack::Pop(self);
|
sl@0
|
36 |
return self;
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
void CCrpClient::DrawCrp(CWindowGc& aGc,const TRect& aRect)
|
sl@0
|
40 |
{
|
sl@0
|
41 |
aGc.DrawWsGraphic(Id(),aRect);
|
sl@0
|
42 |
CWsGraphic::Flush();
|
sl@0
|
43 |
}
|
sl@0
|
44 |
|
sl@0
|
45 |
CCrpClient::~CCrpClient()
|
sl@0
|
46 |
{
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
CCrpClient::CCrpClient()
|
sl@0
|
50 |
{
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
void CCrpClient::ConstructL()
|
sl@0
|
54 |
{
|
sl@0
|
55 |
BaseConstructL(TUid::Uid(0xa0005923),KNullDesC8()); //lint !e569 Loss of information (arg. no. 1) (32 bits to 31 bits)
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
void CCrpClient::HandleMessage(const TDesC8& /*aData*/)
|
sl@0
|
59 |
{
|
sl@0
|
60 |
}
|
sl@0
|
61 |
|
sl@0
|
62 |
void CCrpClient::OnReplace()
|
sl@0
|
63 |
{
|
sl@0
|
64 |
__DEBUGGER();
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
|
sl@0
|
68 |
|
sl@0
|
69 |
|
sl@0
|
70 |
/**
|
sl@0
|
71 |
CRP WIN
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
|
sl@0
|
74 |
|
sl@0
|
75 |
//static configuration data, definitions and default assignments
|
sl@0
|
76 |
TBool CCrpWin::iEnabled = ETrue;
|
sl@0
|
77 |
TBool CCrpWin::iTransparent = ETrue;
|
sl@0
|
78 |
|
sl@0
|
79 |
|
sl@0
|
80 |
CCrpWin* CCrpWin::NewLC(RWsSession& aWs, RWindowGroup* aGroup, CCompWin* aParent, CWindowGc& aGc)
|
sl@0
|
81 |
{
|
sl@0
|
82 |
CCrpWin* self = new (ELeave) CCrpWin(aWs, aGroup, aParent, aGc);
|
sl@0
|
83 |
CleanupStack::PushL(self);
|
sl@0
|
84 |
self->ConstructL();
|
sl@0
|
85 |
return self;
|
sl@0
|
86 |
}
|
sl@0
|
87 |
|
sl@0
|
88 |
void CCrpWin::LoadConfiguration(const MTestStepConfigurationContext* aContext)
|
sl@0
|
89 |
{
|
sl@0
|
90 |
aContext->GetBool(KT_WservStressParamEnabled, iEnabled);
|
sl@0
|
91 |
aContext->GetBool(KT_WservStressParamTransparent, iTransparent);
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
CCrpWin::~CCrpWin()
|
sl@0
|
95 |
{
|
sl@0
|
96 |
delete iCrp;
|
sl@0
|
97 |
}
|
sl@0
|
98 |
|
sl@0
|
99 |
void CCrpWin::SetSize(const TSize & aSize)
|
sl@0
|
100 |
{
|
sl@0
|
101 |
CCompWin::SetSize(aSize);
|
sl@0
|
102 |
}
|
sl@0
|
103 |
|
sl@0
|
104 |
void CCrpWin::Redraw(const TRect& aRect)
|
sl@0
|
105 |
{
|
sl@0
|
106 |
iWsGc.Activate(*iWindow);
|
sl@0
|
107 |
iWsGc.Reset();
|
sl@0
|
108 |
|
sl@0
|
109 |
iRedrawWindow->BeginRedraw(aRect);
|
sl@0
|
110 |
if(iCrp)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
iCrp->DrawCrp(iWsGc,iSize);
|
sl@0
|
113 |
}
|
sl@0
|
114 |
iRedrawWindow->EndRedraw();
|
sl@0
|
115 |
|
sl@0
|
116 |
iWsGc.Deactivate();
|
sl@0
|
117 |
}
|
sl@0
|
118 |
|
sl@0
|
119 |
void CCrpWin::DrawBitmap(CFbsBitGc* aGc, TRect& aClip, TPoint& aOrigin)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
aGc->Reset();
|
sl@0
|
122 |
TPoint origin = iPos + aOrigin;
|
sl@0
|
123 |
aGc->SetOrigin(origin);
|
sl@0
|
124 |
|
sl@0
|
125 |
TRect clip(origin, iSize);
|
sl@0
|
126 |
clip.Intersection(aClip);
|
sl@0
|
127 |
clip.Move(-origin);
|
sl@0
|
128 |
aGc->SetClippingRect(clip);
|
sl@0
|
129 |
|
sl@0
|
130 |
TRect windowRect(origin,iSize);
|
sl@0
|
131 |
windowRect.Move(-origin);
|
sl@0
|
132 |
|
sl@0
|
133 |
aGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
|
sl@0
|
134 |
aGc->SetPenColor(TRgb(255,0,0));
|
sl@0
|
135 |
aGc->SetPenStyle(CGraphicsContext::ESolidPen);
|
sl@0
|
136 |
aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
137 |
aGc->SetBrushColor(TRgb(255,0,0));
|
sl@0
|
138 |
aGc->DrawRect(windowRect);
|
sl@0
|
139 |
aGc->SetBrushColor(TRgb(0,0,255));
|
sl@0
|
140 |
aGc->DrawEllipse(windowRect);
|
sl@0
|
141 |
|
sl@0
|
142 |
CCompWin::DrawBitmap(aGc, aClip, aOrigin);
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
CCrpWin::CCrpWin(RWsSession& aWs, RWindowGroup* aGroup, CCompWin* aParent, CWindowGc& aGc) :
|
sl@0
|
146 |
CCompWin(aWs, aGroup, aParent, aGc)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
void CCrpWin::ConstructL()
|
sl@0
|
151 |
{
|
sl@0
|
152 |
CCompWin::PreConstructL(iTransparent);
|
sl@0
|
153 |
iCrp = CCrpClient::NewL();
|
sl@0
|
154 |
CCompWin::PostConstructL();
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
void CCrpWin::DumpDetails(RFile& aFile, TInt aDepth)
|
sl@0
|
158 |
{
|
sl@0
|
159 |
TBuf8<256> buf;
|
sl@0
|
160 |
buf.SetLength(0);
|
sl@0
|
161 |
for (TInt d = 0; d < aDepth; ++d)
|
sl@0
|
162 |
{
|
sl@0
|
163 |
buf.Append(_L8(" "));
|
sl@0
|
164 |
}
|
sl@0
|
165 |
buf.Append(_L8("Transparent = ["));
|
sl@0
|
166 |
buf.AppendNum((TInt64)iTransparent);
|
sl@0
|
167 |
buf.Append(_L8("]\r\n"));
|
sl@0
|
168 |
aFile.Write(buf);
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
|