sl@0
|
1 |
// Copyright (c) 1994-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 |
// Base classes used for building window server test code
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32std.h>
|
sl@0
|
19 |
#include <w32std.h>
|
sl@0
|
20 |
#include <e32svr.h>
|
sl@0
|
21 |
#include <e32property.h>
|
sl@0
|
22 |
#include "TLIB.H"
|
sl@0
|
23 |
#include <graphics/wsgraphicdrawerinterface.h>
|
sl@0
|
24 |
|
sl@0
|
25 |
//
|
sl@0
|
26 |
// Test code classes
|
sl@0
|
27 |
//
|
sl@0
|
28 |
// CTWinBase
|
sl@0
|
29 |
// CTBaseWin
|
sl@0
|
30 |
// CTWin
|
sl@0
|
31 |
// CTBackedUpWin
|
sl@0
|
32 |
// CTGroupWin
|
sl@0
|
33 |
// CTClient
|
sl@0
|
34 |
//
|
sl@0
|
35 |
//
|
sl@0
|
36 |
|
sl@0
|
37 |
_LIT(KTestFontTypefaceName,"DejaVu Sans Condensed");
|
sl@0
|
38 |
|
sl@0
|
39 |
class CStopTheScheduler : public CAsyncOneShot
|
sl@0
|
40 |
{
|
sl@0
|
41 |
public:
|
sl@0
|
42 |
inline CStopTheScheduler(CTClient* aClient,TInt aPriority,TBool aAll) :CAsyncOneShot(aPriority), iClient(aClient), iAll(aAll) {}
|
sl@0
|
43 |
inline CStopTheScheduler(CTClient* aClient,TInt aPriority) :CAsyncOneShot(aPriority), iClient(aClient) {}
|
sl@0
|
44 |
inline CStopTheScheduler(TInt aPriority) :CAsyncOneShot(aPriority) {}
|
sl@0
|
45 |
void RunL();
|
sl@0
|
46 |
public:
|
sl@0
|
47 |
CTClient* iClient;
|
sl@0
|
48 |
TBool iAll;
|
sl@0
|
49 |
#ifdef __WINS__
|
sl@0
|
50 |
TInt iCStopTheSchedulerRunCount;
|
sl@0
|
51 |
#endif
|
sl@0
|
52 |
};
|
sl@0
|
53 |
|
sl@0
|
54 |
|
sl@0
|
55 |
void TbPanic(TInt aPanic)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
User::Panic(_L("TestBase"),aPanic);
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
EXPORT_C CTWinBase::CTWinBase(TInt aType) : iType(aType)
|
sl@0
|
61 |
{
|
sl@0
|
62 |
__DECLARE_NAME(_S("CTWinBase"));
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
EXPORT_C CTWinBase *CTWinBase::Parent() const
|
sl@0
|
66 |
{
|
sl@0
|
67 |
return((CTWinBase *)WinTreeNode()->Parent());
|
sl@0
|
68 |
}
|
sl@0
|
69 |
|
sl@0
|
70 |
EXPORT_C CTWinBase *CTWinBase::NextSibling() const
|
sl@0
|
71 |
{
|
sl@0
|
72 |
return((CTWinBase *)WinTreeNode()->NextSibling());
|
sl@0
|
73 |
}
|
sl@0
|
74 |
|
sl@0
|
75 |
EXPORT_C CTWinBase *CTWinBase::PrevSibling() const
|
sl@0
|
76 |
{
|
sl@0
|
77 |
return((CTWinBase *)WinTreeNode()->PrevSibling());
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|
sl@0
|
80 |
EXPORT_C CTClient *CTWinBase::Client() const
|
sl@0
|
81 |
{
|
sl@0
|
82 |
return(iOwnerWin->Client());
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
EXPORT_C CTBaseWin *CTWinBase::Child() const
|
sl@0
|
86 |
{
|
sl@0
|
87 |
return((CTBaseWin *)WinTreeNode()->Child());
|
sl@0
|
88 |
}
|
sl@0
|
89 |
|
sl@0
|
90 |
EXPORT_C TPoint CTWinBase::Position() const
|
sl@0
|
91 |
{
|
sl@0
|
92 |
return(TPoint(0,0));
|
sl@0
|
93 |
}
|
sl@0
|
94 |
|
sl@0
|
95 |
EXPORT_C void CTWinBase::PointerEnter(const TTime&)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
}
|
sl@0
|
98 |
|
sl@0
|
99 |
EXPORT_C void CTWinBase::PointerExit(const TTime&)
|
sl@0
|
100 |
{
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
EXPORT_C void CTWinBase::PointerBufferReady(const TTime&)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
}
|
sl@0
|
106 |
|
sl@0
|
107 |
EXPORT_C void CTWinBase::PointerL(const TPointerEvent&,const TTime&)
|
sl@0
|
108 |
{
|
sl@0
|
109 |
}
|
sl@0
|
110 |
|
sl@0
|
111 |
EXPORT_C void CTWinBase::SwitchOn(const TTime &)
|
sl@0
|
112 |
{
|
sl@0
|
113 |
}
|
sl@0
|
114 |
|
sl@0
|
115 |
EXPORT_C void CTWinBase::ModifiersChanged(const TModifiersChangedEvent &,const TTime &)
|
sl@0
|
116 |
{
|
sl@0
|
117 |
}
|
sl@0
|
118 |
|
sl@0
|
119 |
EXPORT_C void CTWinBase::AdjustOrdinal(TInt)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
}
|
sl@0
|
122 |
|
sl@0
|
123 |
EXPORT_C void CTWinBase::AdjustShadow(TInt)
|
sl@0
|
124 |
{
|
sl@0
|
125 |
}
|
sl@0
|
126 |
|
sl@0
|
127 |
EXPORT_C void CTWinBase::SetVisible(TBool)
|
sl@0
|
128 |
{
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
EXPORT_C TInt CTWinBase::SubType()
|
sl@0
|
132 |
{
|
sl@0
|
133 |
return(0);
|
sl@0
|
134 |
}
|
sl@0
|
135 |
|
sl@0
|
136 |
EXPORT_C void CTWinBase::ErrorMessage(const TWsErrorMessage&, const TTime &)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
}
|
sl@0
|
139 |
|
sl@0
|
140 |
EXPORT_C void CTWinBase::__DbgTestInvariant() const
|
sl@0
|
141 |
{
|
sl@0
|
142 |
WinTreeNode()->__DbgTestInvariant();
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
// CTBaseWin //
|
sl@0
|
146 |
|
sl@0
|
147 |
EXPORT_C CTBaseWin::CTBaseWin(TInt aType) : CTWinBase(aType)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
__DECLARE_NAME(_S("CTBaseWin"));
|
sl@0
|
150 |
}
|
sl@0
|
151 |
|
sl@0
|
152 |
EXPORT_C CTBaseWin::~CTBaseWin()
|
sl@0
|
153 |
{
|
sl@0
|
154 |
}
|
sl@0
|
155 |
|
sl@0
|
156 |
EXPORT_C void CTBaseWin::RelinquishFocus()
|
sl@0
|
157 |
{
|
sl@0
|
158 |
CTWinBase *parent=Parent();
|
sl@0
|
159 |
CTWindowGroup *group=Group();
|
sl@0
|
160 |
CTWinBase *child=group->Child();
|
sl@0
|
161 |
if (child==this)
|
sl@0
|
162 |
child=child->NextSibling();
|
sl@0
|
163 |
group->SetCurrentWindow((parent->iType==EWinTypeClient) ? (CTBaseWin *)parent : (CTBaseWin *)child);
|
sl@0
|
164 |
}
|
sl@0
|
165 |
|
sl@0
|
166 |
EXPORT_C void CTBaseWin::SetVisible(TBool aState)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
BaseWin()->SetVisible(aState);
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
EXPORT_C const RWindowTreeNode *CTBaseWin::WinTreeNode() const
|
sl@0
|
172 |
{
|
sl@0
|
173 |
return((const RWindowTreeNode *)BaseWin());
|
sl@0
|
174 |
}
|
sl@0
|
175 |
|
sl@0
|
176 |
EXPORT_C RWindowTreeNode *CTBaseWin::WinTreeNode()
|
sl@0
|
177 |
{
|
sl@0
|
178 |
return((RWindowTreeNode *)BaseWin());
|
sl@0
|
179 |
}
|
sl@0
|
180 |
|
sl@0
|
181 |
EXPORT_C void CTBaseWin::InitWin()
|
sl@0
|
182 |
{
|
sl@0
|
183 |
}
|
sl@0
|
184 |
|
sl@0
|
185 |
EXPORT_C void CTBaseWin::ConstructExtLD(CTWinBase &aParent, const TPoint &aPos, const TSize &aSize)
|
sl@0
|
186 |
//
|
sl@0
|
187 |
// Call ConstructL, SetExt and either of these fail destroy this and leave
|
sl@0
|
188 |
//
|
sl@0
|
189 |
{
|
sl@0
|
190 |
TRAPD(err,ConstructL(aParent));
|
sl@0
|
191 |
if (err!=KErrNone)
|
sl@0
|
192 |
goto celd_err;
|
sl@0
|
193 |
TRAP(err,SetExtL(aPos,aSize));
|
sl@0
|
194 |
if (err!=KErrNone)
|
sl@0
|
195 |
{
|
sl@0
|
196 |
celd_err:
|
sl@0
|
197 |
delete this;
|
sl@0
|
198 |
User::Leave(err);
|
sl@0
|
199 |
}
|
sl@0
|
200 |
}
|
sl@0
|
201 |
|
sl@0
|
202 |
EXPORT_C void CTBaseWin::ConstructL(CTWinBase &aParent)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
TInt ret;
|
sl@0
|
205 |
__ASSERT_DEBUG(aParent.iOwnerWin!=NULL,TbPanic(ETestBasePanicNullOwnerWin));
|
sl@0
|
206 |
iOwnerWin=aParent.iOwnerWin;
|
sl@0
|
207 |
if ((ret=ConstructWin(aParent))==KErrNone)
|
sl@0
|
208 |
{
|
sl@0
|
209 |
//TFontSpec fspec(KTestFontTypefaceName,200);
|
sl@0
|
210 |
//User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)iFont, fspec));
|
sl@0
|
211 |
TFontSpec fspec(KTestFontTypefaceName,17);
|
sl@0
|
212 |
User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInPixels((CFont *&)iFont, fspec));
|
sl@0
|
213 |
AdjustShadow(1);
|
sl@0
|
214 |
InitWin();
|
sl@0
|
215 |
iSize=BaseWin()->Size();
|
sl@0
|
216 |
}
|
sl@0
|
217 |
User::LeaveIfError(ret);
|
sl@0
|
218 |
}
|
sl@0
|
219 |
|
sl@0
|
220 |
EXPORT_C void CTBaseWin::Activate()
|
sl@0
|
221 |
{
|
sl@0
|
222 |
BaseWin()->Activate();
|
sl@0
|
223 |
}
|
sl@0
|
224 |
|
sl@0
|
225 |
EXPORT_C void CTBaseWin::SetFullScreenExtL()
|
sl@0
|
226 |
{
|
sl@0
|
227 |
SetExtL(TPoint(0,0), Parent()->Size());
|
sl@0
|
228 |
}
|
sl@0
|
229 |
|
sl@0
|
230 |
EXPORT_C void CTBaseWin::SetDefaultExtL()
|
sl@0
|
231 |
{
|
sl@0
|
232 |
TSize size=Parent()->Size();
|
sl@0
|
233 |
size.iWidth>>=1;
|
sl@0
|
234 |
size.iHeight>>=1;
|
sl@0
|
235 |
SetExtL(TPoint(size.iWidth>>1,size.iHeight>>1), size);
|
sl@0
|
236 |
}
|
sl@0
|
237 |
|
sl@0
|
238 |
EXPORT_C void CTBaseWin::AssignGC(CWindowGc &aGc)
|
sl@0
|
239 |
{
|
sl@0
|
240 |
iGc= &aGc;
|
sl@0
|
241 |
}
|
sl@0
|
242 |
|
sl@0
|
243 |
EXPORT_C void CTBaseWin::SetPos(const TPoint &aPos)
|
sl@0
|
244 |
{
|
sl@0
|
245 |
BaseWin()->SetPosition(aPos);
|
sl@0
|
246 |
iPos=aPos;
|
sl@0
|
247 |
}
|
sl@0
|
248 |
|
sl@0
|
249 |
EXPORT_C void CTBaseWin::SetInitialPos(const TPoint &aPos)
|
sl@0
|
250 |
{
|
sl@0
|
251 |
TSize screen=Client()->iScreen->SizeInPixels();
|
sl@0
|
252 |
TPoint pos(aPos);
|
sl@0
|
253 |
TPoint botLeft=pos+iSize;
|
sl@0
|
254 |
if (botLeft.iX>screen.iWidth)
|
sl@0
|
255 |
pos.iX=Max(0,pos.iX-botLeft.iX+screen.iWidth);
|
sl@0
|
256 |
if (botLeft.iY>screen.iHeight)
|
sl@0
|
257 |
pos.iY=Max(0,pos.iY-botLeft.iY+screen.iHeight);
|
sl@0
|
258 |
SetPos(pos);
|
sl@0
|
259 |
}
|
sl@0
|
260 |
|
sl@0
|
261 |
EXPORT_C void CTBaseWin::SetExtL(const TPoint &aPos, const TSize &aSize)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
User::LeaveIfError(BaseWin()->SetExtentErr(aPos,aSize));
|
sl@0
|
264 |
iPos=aPos;
|
sl@0
|
265 |
iSize=aSize;
|
sl@0
|
266 |
Resized(iSize);
|
sl@0
|
267 |
}
|
sl@0
|
268 |
|
sl@0
|
269 |
EXPORT_C void CTBaseWin::AdjustSizeL(TInt xMove,TInt yMove,TInt modifiers)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
if (modifiers&EModifierCtrl) // 4 times the movement
|
sl@0
|
272 |
{
|
sl@0
|
273 |
xMove<<=2;
|
sl@0
|
274 |
yMove<<=2;
|
sl@0
|
275 |
}
|
sl@0
|
276 |
if (modifiers&EModifierShift)
|
sl@0
|
277 |
{
|
sl@0
|
278 |
TSize size(iSize.iWidth+xMove,iSize.iHeight+yMove);
|
sl@0
|
279 |
|
sl@0
|
280 |
if (size.iWidth<0)
|
sl@0
|
281 |
size.iWidth=0;
|
sl@0
|
282 |
if (size.iHeight<0)
|
sl@0
|
283 |
size.iHeight=0;
|
sl@0
|
284 |
if (modifiers&EModifierCtrl)
|
sl@0
|
285 |
{
|
sl@0
|
286 |
TPoint pos(iPos);
|
sl@0
|
287 |
pos.iX-=(xMove>>1);
|
sl@0
|
288 |
pos.iY-=(yMove>>1);
|
sl@0
|
289 |
SetExtL(pos,size);
|
sl@0
|
290 |
}
|
sl@0
|
291 |
else
|
sl@0
|
292 |
SetSizeL(size);
|
sl@0
|
293 |
}
|
sl@0
|
294 |
else
|
sl@0
|
295 |
SetPos(TPoint(iPos+TPoint(xMove,yMove)));
|
sl@0
|
296 |
}
|
sl@0
|
297 |
|
sl@0
|
298 |
EXPORT_C void CTBaseWin::SetSizeL(const TSize &aSize)
|
sl@0
|
299 |
{
|
sl@0
|
300 |
User::LeaveIfError(BaseWin()->SetSizeErr(aSize));
|
sl@0
|
301 |
iSize=aSize;
|
sl@0
|
302 |
Resized(iSize);
|
sl@0
|
303 |
}
|
sl@0
|
304 |
|
sl@0
|
305 |
EXPORT_C TSize CTBaseWin::Size() const
|
sl@0
|
306 |
{
|
sl@0
|
307 |
return(iSize);
|
sl@0
|
308 |
}
|
sl@0
|
309 |
|
sl@0
|
310 |
EXPORT_C void CTBaseWin::Resized(const TSize &aSize)
|
sl@0
|
311 |
//
|
sl@0
|
312 |
{
|
sl@0
|
313 |
SetDragRect(TRect(aSize));
|
sl@0
|
314 |
}
|
sl@0
|
315 |
|
sl@0
|
316 |
EXPORT_C TPoint CTBaseWin::Position() const
|
sl@0
|
317 |
{
|
sl@0
|
318 |
return(BaseWin()->Position());
|
sl@0
|
319 |
}
|
sl@0
|
320 |
|
sl@0
|
321 |
EXPORT_C void CTBaseWin::Delete(CTBaseWin *aWin)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
RHeap& heap = User::Heap();
|
sl@0
|
324 |
TUint8* base=heap.Base();
|
sl@0
|
325 |
TInt size=heap.Size();
|
sl@0
|
326 |
TUint8* cell=REINTERPRET_CAST(TUint8*,aWin);
|
sl@0
|
327 |
__ASSERT_ALWAYS(base<=cell && cell<base+size, TbPanic(ETestBasePanicInvalidHeapAddress));
|
sl@0
|
328 |
CTWinBase *tmp=aWin;
|
sl@0
|
329 |
CTWinBase *win2;
|
sl@0
|
330 |
CTBaseWin *curwin=NULL;
|
sl@0
|
331 |
if (tmp->Group())
|
sl@0
|
332 |
curwin=tmp->Group()->CurWin();
|
sl@0
|
333 |
do
|
sl@0
|
334 |
{
|
sl@0
|
335 |
win2=tmp;
|
sl@0
|
336 |
while((tmp=win2->Child())!=NULL)
|
sl@0
|
337 |
win2=tmp;
|
sl@0
|
338 |
if ((tmp=win2->NextSibling())==NULL)
|
sl@0
|
339 |
tmp=win2->Parent();
|
sl@0
|
340 |
if (curwin==win2)
|
sl@0
|
341 |
((CTBaseWin *)win2)->RelinquishFocus();
|
sl@0
|
342 |
delete win2;
|
sl@0
|
343 |
} while(win2!=aWin);
|
sl@0
|
344 |
}
|
sl@0
|
345 |
|
sl@0
|
346 |
EXPORT_C void CTBaseWin::KeyUpL(const TKeyEvent &,const TTime&)
|
sl@0
|
347 |
{
|
sl@0
|
348 |
}
|
sl@0
|
349 |
|
sl@0
|
350 |
EXPORT_C void CTBaseWin::KeyDownL(const TKeyEvent &,const TTime&)
|
sl@0
|
351 |
{
|
sl@0
|
352 |
}
|
sl@0
|
353 |
|
sl@0
|
354 |
EXPORT_C void CTBaseWin::WinKeyL(const TKeyEvent &,const TTime&)
|
sl@0
|
355 |
{
|
sl@0
|
356 |
}
|
sl@0
|
357 |
|
sl@0
|
358 |
EXPORT_C void CTBaseWin::PointerL(const TPointerEvent &aPointer,const TTime&)
|
sl@0
|
359 |
{
|
sl@0
|
360 |
if (iDragging)
|
sl@0
|
361 |
{
|
sl@0
|
362 |
if (aPointer.iType==TPointerEvent::EDrag)
|
sl@0
|
363 |
SetPos(aPointer.iParentPosition-iDragPos);
|
sl@0
|
364 |
else
|
sl@0
|
365 |
iDragging=EFalse;
|
sl@0
|
366 |
return;
|
sl@0
|
367 |
}
|
sl@0
|
368 |
if (aPointer.iType==TPointerEvent::EButton1Down)
|
sl@0
|
369 |
{
|
sl@0
|
370 |
if (aPointer.iModifiers&EModifierCtrl)
|
sl@0
|
371 |
{
|
sl@0
|
372 |
if (aPointer.iModifiers&EModifierShift)
|
sl@0
|
373 |
BaseWin()->SetOrdinalPosition(-1);
|
sl@0
|
374 |
else
|
sl@0
|
375 |
BaseWin()->SetOrdinalPosition(0);
|
sl@0
|
376 |
return;
|
sl@0
|
377 |
}
|
sl@0
|
378 |
#if defined(__WINS__)
|
sl@0
|
379 |
else if (aPointer.iModifiers&EModifierShift)
|
sl@0
|
380 |
__DbgTestInvariant();
|
sl@0
|
381 |
#endif
|
sl@0
|
382 |
else
|
sl@0
|
383 |
{
|
sl@0
|
384 |
Group()->SetCurrentWindow(this);
|
sl@0
|
385 |
if (iDragRect.Contains(aPointer.iPosition))
|
sl@0
|
386 |
{
|
sl@0
|
387 |
iDragging=ETrue;
|
sl@0
|
388 |
iDragPos=aPointer.iPosition;
|
sl@0
|
389 |
return;
|
sl@0
|
390 |
}
|
sl@0
|
391 |
}
|
sl@0
|
392 |
}
|
sl@0
|
393 |
}
|
sl@0
|
394 |
|
sl@0
|
395 |
EXPORT_C void CTBaseWin::DragDropL(const TPointerEvent &,const TTime &)
|
sl@0
|
396 |
{
|
sl@0
|
397 |
}
|
sl@0
|
398 |
|
sl@0
|
399 |
EXPORT_C void CTBaseWin::AdjustOrdinal(TInt aAdjust)
|
sl@0
|
400 |
{
|
sl@0
|
401 |
TInt pos=BaseWin()->OrdinalPosition()+aAdjust;
|
sl@0
|
402 |
if (pos>=0)
|
sl@0
|
403 |
BaseWin()->SetOrdinalPosition(pos);
|
sl@0
|
404 |
}
|
sl@0
|
405 |
|
sl@0
|
406 |
EXPORT_C void CTBaseWin::AdjustShadow(TInt aAdjust)
|
sl@0
|
407 |
{
|
sl@0
|
408 |
iShadow+=aAdjust;
|
sl@0
|
409 |
if (iShadow<0)
|
sl@0
|
410 |
iShadow=0;
|
sl@0
|
411 |
BaseWin()->SetShadowHeight(iShadow);
|
sl@0
|
412 |
}
|
sl@0
|
413 |
|
sl@0
|
414 |
EXPORT_C void CTBaseWin::DrawBorder()
|
sl@0
|
415 |
{
|
sl@0
|
416 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
417 |
iGc->DrawRect(TRect(iSize));
|
sl@0
|
418 |
iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
|
sl@0
|
419 |
}
|
sl@0
|
420 |
|
sl@0
|
421 |
EXPORT_C void CTBaseWin::SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc, TDisplayMode *aMode,TBool aVisible,TInt aTransparency)
|
sl@0
|
422 |
{
|
sl@0
|
423 |
ConstructL(*parent);
|
sl@0
|
424 |
if (aMode)
|
sl@0
|
425 |
BaseWin()->SetRequiredDisplayMode(*aMode);
|
sl@0
|
426 |
SetExtL(pos,size);
|
sl@0
|
427 |
if (!aVisible)
|
sl@0
|
428 |
BaseWin()->SetVisible(aVisible);
|
sl@0
|
429 |
if (aTransparency!=ENoTransparency)
|
sl@0
|
430 |
{
|
sl@0
|
431 |
TInt err=((RWindow*)(BaseWin()))->SetTransparencyFactor(TRgb::_Gray256(aTransparency));
|
sl@0
|
432 |
User::LeaveIfError(err); //asked for transparency when not got none!
|
sl@0
|
433 |
}
|
sl@0
|
434 |
Activate();
|
sl@0
|
435 |
AssignGC(aGc);
|
sl@0
|
436 |
}
|
sl@0
|
437 |
|
sl@0
|
438 |
EXPORT_C void CTBaseWin::SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc, TDisplayMode *aMode)
|
sl@0
|
439 |
{
|
sl@0
|
440 |
SetUpL(pos,size,parent,aGc,aMode,ETrue);
|
sl@0
|
441 |
}
|
sl@0
|
442 |
|
sl@0
|
443 |
EXPORT_C void CTBaseWin::SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc,TBool aVisible)
|
sl@0
|
444 |
{
|
sl@0
|
445 |
SetUpL(pos,size,parent,aGc,NULL,aVisible);
|
sl@0
|
446 |
}
|
sl@0
|
447 |
|
sl@0
|
448 |
EXPORT_C void CTBaseWin::SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc)
|
sl@0
|
449 |
{
|
sl@0
|
450 |
SetUpL(pos,size,parent,aGc,NULL,ETrue);
|
sl@0
|
451 |
}
|
sl@0
|
452 |
|
sl@0
|
453 |
EXPORT_C void CTBaseWin::SetDragRect(const TRect &aRect)
|
sl@0
|
454 |
{
|
sl@0
|
455 |
BaseWin()->PointerFilter(EPointerFilterDrag,0); // Clear the drag filter
|
sl@0
|
456 |
BaseWin()->SetPointerGrab(ETrue);
|
sl@0
|
457 |
iDragRect=aRect;
|
sl@0
|
458 |
}
|
sl@0
|
459 |
|
sl@0
|
460 |
EXPORT_C CTWindowGroup *CTBaseWin::Group() const
|
sl@0
|
461 |
{
|
sl@0
|
462 |
return(iOwnerWin);
|
sl@0
|
463 |
}
|
sl@0
|
464 |
|
sl@0
|
465 |
EXPORT_C void CTBaseWin::FocusChanged(TBool )
|
sl@0
|
466 |
{
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
EXPORT_C CTBaseWin *CTBaseWin::Next()
|
sl@0
|
470 |
{
|
sl@0
|
471 |
CTWinBase *win;
|
sl@0
|
472 |
CTWinBase *ret=Child();
|
sl@0
|
473 |
if (ret==NULL)
|
sl@0
|
474 |
{
|
sl@0
|
475 |
win=this;
|
sl@0
|
476 |
while((ret=win->NextSibling())==NULL)
|
sl@0
|
477 |
{
|
sl@0
|
478 |
ret=win;
|
sl@0
|
479 |
win=win->Parent();
|
sl@0
|
480 |
if (win==NULL) // Group window
|
sl@0
|
481 |
{
|
sl@0
|
482 |
ret=ret->Child();
|
sl@0
|
483 |
break;
|
sl@0
|
484 |
}
|
sl@0
|
485 |
}
|
sl@0
|
486 |
}
|
sl@0
|
487 |
return((CTBaseWin *)ret);
|
sl@0
|
488 |
}
|
sl@0
|
489 |
|
sl@0
|
490 |
EXPORT_C CTBaseWin *CTBaseWin::Prev()
|
sl@0
|
491 |
{
|
sl@0
|
492 |
CTWinBase *par=Parent();
|
sl@0
|
493 |
CTWinBase *win;
|
sl@0
|
494 |
CTWinBase *child;
|
sl@0
|
495 |
if ((win=PrevSibling())==NULL)
|
sl@0
|
496 |
{
|
sl@0
|
497 |
if (par->iType==EWinTypeGroup)
|
sl@0
|
498 |
{
|
sl@0
|
499 |
CTWinBase *win2=par->Child();
|
sl@0
|
500 |
do
|
sl@0
|
501 |
{
|
sl@0
|
502 |
win=win2;
|
sl@0
|
503 |
while((win2=win->NextSibling())!=NULL)
|
sl@0
|
504 |
win=win2;
|
sl@0
|
505 |
win2=win->Child();
|
sl@0
|
506 |
} while(win2!=NULL);
|
sl@0
|
507 |
}
|
sl@0
|
508 |
else
|
sl@0
|
509 |
win=par;
|
sl@0
|
510 |
}
|
sl@0
|
511 |
else
|
sl@0
|
512 |
{
|
sl@0
|
513 |
child=win->Child();
|
sl@0
|
514 |
while(child!=NULL)
|
sl@0
|
515 |
{
|
sl@0
|
516 |
win=child;
|
sl@0
|
517 |
child=child->NextSibling();
|
sl@0
|
518 |
}
|
sl@0
|
519 |
}
|
sl@0
|
520 |
return((CTBaseWin *)win);
|
sl@0
|
521 |
}
|
sl@0
|
522 |
|
sl@0
|
523 |
//EXPORT_C void CTBaseWin::SetDefaultExt()
|
sl@0
|
524 |
// {
|
sl@0
|
525 |
// TbPanic(ETestBasePanicUnimplementedBaseFunction);
|
sl@0
|
526 |
// }
|
sl@0
|
527 |
|
sl@0
|
528 |
EXPORT_C void CTBaseWin::Draw()
|
sl@0
|
529 |
{
|
sl@0
|
530 |
TbPanic(ETestBasePanicUnimplementedBaseFunction);
|
sl@0
|
531 |
}
|
sl@0
|
532 |
|
sl@0
|
533 |
EXPORT_C void CTBaseWin::__DbgTestInvariant() const
|
sl@0
|
534 |
{
|
sl@0
|
535 |
CTWinBase::__DbgTestInvariant();
|
sl@0
|
536 |
#if defined(__WINS__)
|
sl@0
|
537 |
if (BaseWin()->Size()!=iSize)
|
sl@0
|
538 |
User::Invariant();
|
sl@0
|
539 |
TPoint offset;
|
sl@0
|
540 |
const CTWinBase *win=this;
|
sl@0
|
541 |
const CTWinBase *win2;
|
sl@0
|
542 |
while((win2=win->Parent())!=NULL)
|
sl@0
|
543 |
{
|
sl@0
|
544 |
offset+=((CTBaseWin *)win)->BaseWin()->Position();
|
sl@0
|
545 |
if (BaseWin()->InquireOffset(*(win2->WinTreeNode()))!=offset)
|
sl@0
|
546 |
User::Invariant();
|
sl@0
|
547 |
win=win2;
|
sl@0
|
548 |
}
|
sl@0
|
549 |
#endif
|
sl@0
|
550 |
}
|
sl@0
|
551 |
|
sl@0
|
552 |
//CTDrawableWin//
|
sl@0
|
553 |
// Drawable window //
|
sl@0
|
554 |
//
|
sl@0
|
555 |
|
sl@0
|
556 |
EXPORT_C CTDrawableWin::CTDrawableWin(TInt aType) : CTBaseWin(aType)
|
sl@0
|
557 |
{
|
sl@0
|
558 |
__DECLARE_NAME(_S("CTDrawableWin"));
|
sl@0
|
559 |
}
|
sl@0
|
560 |
|
sl@0
|
561 |
//CTWin//
|
sl@0
|
562 |
// Standard client window //
|
sl@0
|
563 |
//
|
sl@0
|
564 |
|
sl@0
|
565 |
EXPORT_C CTWin::CTWin() : CTDrawableWin(EWinTypeClient)
|
sl@0
|
566 |
{
|
sl@0
|
567 |
__DECLARE_NAME(_S("CTWin"));
|
sl@0
|
568 |
}
|
sl@0
|
569 |
|
sl@0
|
570 |
EXPORT_C CTWin::~CTWin()
|
sl@0
|
571 |
{
|
sl@0
|
572 |
if (iFont)
|
sl@0
|
573 |
Client()->iScreen->ReleaseFont(iFont);
|
sl@0
|
574 |
iWin.Close();
|
sl@0
|
575 |
}
|
sl@0
|
576 |
|
sl@0
|
577 |
EXPORT_C TInt CTWin::ConstructWin(const CTWinBase &aParent)
|
sl@0
|
578 |
{
|
sl@0
|
579 |
iWin=RWindow(aParent.Client()->iWs);
|
sl@0
|
580 |
return(iWin.Construct(*(aParent.WinTreeNode()),(TUint32)this));
|
sl@0
|
581 |
}
|
sl@0
|
582 |
|
sl@0
|
583 |
EXPORT_C void CTWin::SetDefaultExt()
|
sl@0
|
584 |
{
|
sl@0
|
585 |
TSize size=Parent()->Size();
|
sl@0
|
586 |
size.iWidth>>=1;
|
sl@0
|
587 |
size.iHeight>>=1;
|
sl@0
|
588 |
SetExt(TPoint(size.iWidth>>1,size.iHeight>>1), size);
|
sl@0
|
589 |
Invalidate();
|
sl@0
|
590 |
}
|
sl@0
|
591 |
|
sl@0
|
592 |
EXPORT_C void CTWin::SetExt(const TPoint &aPos, const TSize &aSize)
|
sl@0
|
593 |
{
|
sl@0
|
594 |
iWin.SetExtent(aPos,aSize);
|
sl@0
|
595 |
iPos=aPos;
|
sl@0
|
596 |
iSize=aSize;
|
sl@0
|
597 |
Resized(iSize);
|
sl@0
|
598 |
}
|
sl@0
|
599 |
|
sl@0
|
600 |
EXPORT_C void CTWin::SetSize(const TSize &aSize)
|
sl@0
|
601 |
{
|
sl@0
|
602 |
iWin.SetSize(aSize);
|
sl@0
|
603 |
iSize=aSize;
|
sl@0
|
604 |
Resized(iSize);
|
sl@0
|
605 |
}
|
sl@0
|
606 |
|
sl@0
|
607 |
EXPORT_C void CTWin::AdjustSize(TInt xMove,TInt yMove,TInt modifiers)
|
sl@0
|
608 |
{
|
sl@0
|
609 |
if (modifiers&EModifierCtrl) // 4 times the movement
|
sl@0
|
610 |
{
|
sl@0
|
611 |
xMove<<=2;
|
sl@0
|
612 |
yMove<<=2;
|
sl@0
|
613 |
}
|
sl@0
|
614 |
if (modifiers&EModifierShift)
|
sl@0
|
615 |
{
|
sl@0
|
616 |
TSize size(iSize.iWidth+xMove,iSize.iHeight+yMove);
|
sl@0
|
617 |
|
sl@0
|
618 |
if (size.iWidth<0)
|
sl@0
|
619 |
size.iWidth=0;
|
sl@0
|
620 |
if (size.iHeight<0)
|
sl@0
|
621 |
size.iHeight=0;
|
sl@0
|
622 |
if (modifiers&EModifierCtrl)
|
sl@0
|
623 |
{
|
sl@0
|
624 |
TPoint pos(iPos);
|
sl@0
|
625 |
pos.iX-=(xMove>>1);
|
sl@0
|
626 |
pos.iY-=(yMove>>1);
|
sl@0
|
627 |
SetExt(pos,size);
|
sl@0
|
628 |
}
|
sl@0
|
629 |
else
|
sl@0
|
630 |
SetSize(size);
|
sl@0
|
631 |
Invalidate();
|
sl@0
|
632 |
}
|
sl@0
|
633 |
else
|
sl@0
|
634 |
SetPos(TPoint(iPos+TPoint(xMove,yMove)));
|
sl@0
|
635 |
}
|
sl@0
|
636 |
|
sl@0
|
637 |
EXPORT_C RWindowBase *CTWin::BaseWin()
|
sl@0
|
638 |
{
|
sl@0
|
639 |
return((RWindowBase *)&iWin);
|
sl@0
|
640 |
}
|
sl@0
|
641 |
|
sl@0
|
642 |
EXPORT_C const RWindowBase *CTWin::BaseWin() const
|
sl@0
|
643 |
{
|
sl@0
|
644 |
return((const RWindowBase *)&iWin);
|
sl@0
|
645 |
}
|
sl@0
|
646 |
|
sl@0
|
647 |
EXPORT_C RDrawableWindow *CTWin::DrawableWin()
|
sl@0
|
648 |
{
|
sl@0
|
649 |
return((RDrawableWindow *)&iWin);
|
sl@0
|
650 |
}
|
sl@0
|
651 |
|
sl@0
|
652 |
EXPORT_C const RDrawableWindow *CTWin::DrawableWin() const
|
sl@0
|
653 |
{
|
sl@0
|
654 |
return((const RDrawableWindow *)&iWin);
|
sl@0
|
655 |
}
|
sl@0
|
656 |
|
sl@0
|
657 |
|
sl@0
|
658 |
EXPORT_C void CTWin::Invalidate()
|
sl@0
|
659 |
{
|
sl@0
|
660 |
iWin.Invalidate();
|
sl@0
|
661 |
}
|
sl@0
|
662 |
|
sl@0
|
663 |
EXPORT_C void CTWin::Invalidate(const TRect &rect)
|
sl@0
|
664 |
{
|
sl@0
|
665 |
iWin.Invalidate(rect);
|
sl@0
|
666 |
}
|
sl@0
|
667 |
|
sl@0
|
668 |
EXPORT_C void CTWin::DrawNow()
|
sl@0
|
669 |
{
|
sl@0
|
670 |
iWin.Invalidate();
|
sl@0
|
671 |
iWin.BeginRedraw();
|
sl@0
|
672 |
iGc->Activate(iWin);
|
sl@0
|
673 |
iGc->UseFont((CFont *)iFont);
|
sl@0
|
674 |
Draw();
|
sl@0
|
675 |
iGc->Deactivate();
|
sl@0
|
676 |
iWin.EndRedraw();
|
sl@0
|
677 |
}
|
sl@0
|
678 |
|
sl@0
|
679 |
EXPORT_C void CTWin::Redraw()
|
sl@0
|
680 |
{
|
sl@0
|
681 |
iWin.BeginRedraw();
|
sl@0
|
682 |
iGc->Activate(iWin);
|
sl@0
|
683 |
iGc->UseFont((CFont *)iFont);
|
sl@0
|
684 |
Draw();
|
sl@0
|
685 |
iGc->Deactivate();
|
sl@0
|
686 |
iWin.EndRedraw();
|
sl@0
|
687 |
}
|
sl@0
|
688 |
|
sl@0
|
689 |
EXPORT_C void CTWin::Redraw(const TRect &aRect)
|
sl@0
|
690 |
{
|
sl@0
|
691 |
iWin.BeginRedraw(aRect);
|
sl@0
|
692 |
iGc->Activate(iWin);
|
sl@0
|
693 |
iGc->UseFont((CFont *)iFont);
|
sl@0
|
694 |
Draw();
|
sl@0
|
695 |
iGc->Deactivate();
|
sl@0
|
696 |
iWin.EndRedraw();
|
sl@0
|
697 |
}
|
sl@0
|
698 |
|
sl@0
|
699 |
//CTBackedUpWin//
|
sl@0
|
700 |
// Backed up window //
|
sl@0
|
701 |
//
|
sl@0
|
702 |
|
sl@0
|
703 |
EXPORT_C CTBackedUpWin::CTBackedUpWin(TDisplayMode aDisplayMode) : CTDrawableWin(EWinTypeClient), iDisplayMode(aDisplayMode)
|
sl@0
|
704 |
{
|
sl@0
|
705 |
__DECLARE_NAME(_S("CTBackedUpWin"));
|
sl@0
|
706 |
}
|
sl@0
|
707 |
|
sl@0
|
708 |
EXPORT_C CTBackedUpWin::~CTBackedUpWin()
|
sl@0
|
709 |
{
|
sl@0
|
710 |
if (iFont)
|
sl@0
|
711 |
Client()->iScreen->ReleaseFont(iFont);
|
sl@0
|
712 |
iWin.Close();
|
sl@0
|
713 |
}
|
sl@0
|
714 |
|
sl@0
|
715 |
EXPORT_C TInt CTBackedUpWin::ConstructWin(const CTWinBase &aParent)
|
sl@0
|
716 |
{
|
sl@0
|
717 |
iWin=RBackedUpWindow(aParent.Client()->iWs);
|
sl@0
|
718 |
return(iWin.Construct(*(aParent.WinTreeNode()), iDisplayMode, (TUint32)this));
|
sl@0
|
719 |
}
|
sl@0
|
720 |
|
sl@0
|
721 |
EXPORT_C RWindowBase *CTBackedUpWin::BaseWin()
|
sl@0
|
722 |
{
|
sl@0
|
723 |
return((RWindowBase *)&iWin);
|
sl@0
|
724 |
}
|
sl@0
|
725 |
|
sl@0
|
726 |
EXPORT_C const RWindowBase *CTBackedUpWin::BaseWin() const
|
sl@0
|
727 |
{
|
sl@0
|
728 |
return((const RWindowBase *)&iWin);
|
sl@0
|
729 |
}
|
sl@0
|
730 |
|
sl@0
|
731 |
EXPORT_C RDrawableWindow *CTBackedUpWin::DrawableWin()
|
sl@0
|
732 |
{
|
sl@0
|
733 |
return((RDrawableWindow *)&iWin);
|
sl@0
|
734 |
}
|
sl@0
|
735 |
|
sl@0
|
736 |
EXPORT_C const RDrawableWindow *CTBackedUpWin::DrawableWin() const
|
sl@0
|
737 |
{
|
sl@0
|
738 |
return((const RDrawableWindow *)&iWin);
|
sl@0
|
739 |
}
|
sl@0
|
740 |
|
sl@0
|
741 |
EXPORT_C RBackedUpWindow *CTBackedUpWin::BackedUpWin()
|
sl@0
|
742 |
{
|
sl@0
|
743 |
return &iWin;
|
sl@0
|
744 |
}
|
sl@0
|
745 |
|
sl@0
|
746 |
EXPORT_C const RBackedUpWindow *CTBackedUpWin::BackedUpWin() const
|
sl@0
|
747 |
{
|
sl@0
|
748 |
return &iWin;
|
sl@0
|
749 |
}
|
sl@0
|
750 |
|
sl@0
|
751 |
//CTTitledWindow//
|
sl@0
|
752 |
|
sl@0
|
753 |
EXPORT_C CTTitledWindow::CTTitledWindow() : CTWin(), iWinColor(TRgb(255,255,255)), iPenColor(TRgb(0,0,0))
|
sl@0
|
754 |
{
|
sl@0
|
755 |
__DECLARE_NAME(_S("CTTitledWin"));
|
sl@0
|
756 |
}
|
sl@0
|
757 |
|
sl@0
|
758 |
EXPORT_C CTTitledWindow::~CTTitledWindow()
|
sl@0
|
759 |
{
|
sl@0
|
760 |
}
|
sl@0
|
761 |
|
sl@0
|
762 |
EXPORT_C void CTTitledWindow::ConstructL(CTWinBase &parent)
|
sl@0
|
763 |
{
|
sl@0
|
764 |
CTBaseWin::ConstructL(parent);
|
sl@0
|
765 |
iTitleHeight=iFont->HeightInPixels()+4;
|
sl@0
|
766 |
if (iTitle.Length()==0)
|
sl@0
|
767 |
SetTitle(*Client()->Title());
|
sl@0
|
768 |
}
|
sl@0
|
769 |
|
sl@0
|
770 |
EXPORT_C void CTTitledWindow::SetColor(TRgb aRgb)
|
sl@0
|
771 |
{
|
sl@0
|
772 |
iWinColor=aRgb;
|
sl@0
|
773 |
iWin.SetBackgroundColor(aRgb);
|
sl@0
|
774 |
}
|
sl@0
|
775 |
|
sl@0
|
776 |
EXPORT_C void CTTitledWindow::Resized(const TSize &aSize)
|
sl@0
|
777 |
{
|
sl@0
|
778 |
SetDragRect(TRect(0,0,aSize.iWidth,iTitleHeight));
|
sl@0
|
779 |
}
|
sl@0
|
780 |
|
sl@0
|
781 |
EXPORT_C void CTTitledWindow::SetTitle(const TWindowTitle &aTitle)
|
sl@0
|
782 |
{
|
sl@0
|
783 |
iTitle=aTitle;
|
sl@0
|
784 |
}
|
sl@0
|
785 |
|
sl@0
|
786 |
EXPORT_C void CTTitledWindow::Draw()
|
sl@0
|
787 |
{
|
sl@0
|
788 |
iGc->SetPenColor(iPenColor);
|
sl@0
|
789 |
iGc->SetBrushColor(iWinColor);
|
sl@0
|
790 |
DrawBorder();
|
sl@0
|
791 |
iGc->DrawLine(TPoint(0,iTitleHeight),TPoint(iSize.iWidth,iTitleHeight));
|
sl@0
|
792 |
if (Group()->HasFocus(this))
|
sl@0
|
793 |
{
|
sl@0
|
794 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
795 |
iGc->SetPenColor(~iPenColor);
|
sl@0
|
796 |
iGc->SetBrushColor(~iWinColor);
|
sl@0
|
797 |
}
|
sl@0
|
798 |
iGc->DrawText(iTitle, TRect(1,1,iSize.iWidth-1,iTitleHeight),iFont->AscentInPixels()+1,CGraphicsContext::ECenter);
|
sl@0
|
799 |
iGc->SetPenColor(iPenColor);
|
sl@0
|
800 |
iGc->SetBrushColor(iWinColor);
|
sl@0
|
801 |
}
|
sl@0
|
802 |
|
sl@0
|
803 |
EXPORT_C void CTTitledWindow::FocusChanged(TBool )
|
sl@0
|
804 |
{
|
sl@0
|
805 |
iWin.Invalidate(TRect(0,0,iSize.iWidth,iTitleHeight));
|
sl@0
|
806 |
}
|
sl@0
|
807 |
|
sl@0
|
808 |
// CTBlankWindow //
|
sl@0
|
809 |
|
sl@0
|
810 |
EXPORT_C CTBlankWindow::CTBlankWindow() : CTBaseWin(EWinTypeClient)
|
sl@0
|
811 |
{
|
sl@0
|
812 |
__DECLARE_NAME(_S("CTBlankWin"));
|
sl@0
|
813 |
}
|
sl@0
|
814 |
|
sl@0
|
815 |
EXPORT_C void CTBlankWindow::ConstructL(CTWinBase &aParent)
|
sl@0
|
816 |
{
|
sl@0
|
817 |
CTBaseWin::ConstructL(aParent);
|
sl@0
|
818 |
}
|
sl@0
|
819 |
|
sl@0
|
820 |
EXPORT_C CTBlankWindow::~CTBlankWindow()
|
sl@0
|
821 |
{
|
sl@0
|
822 |
if (iFont)
|
sl@0
|
823 |
Client()->iScreen->ReleaseFont(iFont);
|
sl@0
|
824 |
iWin.Close();
|
sl@0
|
825 |
}
|
sl@0
|
826 |
|
sl@0
|
827 |
EXPORT_C void CTBlankWindow::SetExt(const TPoint &aPos, const TSize &aSize)
|
sl@0
|
828 |
{
|
sl@0
|
829 |
iWin.SetExtent(aPos,aSize);
|
sl@0
|
830 |
iPos=aPos;
|
sl@0
|
831 |
iSize=aSize;
|
sl@0
|
832 |
Resized(iSize);
|
sl@0
|
833 |
}
|
sl@0
|
834 |
|
sl@0
|
835 |
EXPORT_C void CTBlankWindow::SetSize(const TSize &aSize)
|
sl@0
|
836 |
{
|
sl@0
|
837 |
iWin.SetSize(aSize);
|
sl@0
|
838 |
iSize=aSize;
|
sl@0
|
839 |
Resized(iSize);
|
sl@0
|
840 |
}
|
sl@0
|
841 |
|
sl@0
|
842 |
EXPORT_C void CTBlankWindow::SetColor(const TRgb &aRgb)
|
sl@0
|
843 |
{
|
sl@0
|
844 |
iWin.SetColor(aRgb);
|
sl@0
|
845 |
}
|
sl@0
|
846 |
|
sl@0
|
847 |
EXPORT_C TInt CTBlankWindow::ConstructWin(const CTWinBase &aParent)
|
sl@0
|
848 |
{
|
sl@0
|
849 |
iWin=RBlankWindow(aParent.Client()->iWs);
|
sl@0
|
850 |
return(iWin.Construct(*(aParent.WinTreeNode()),(TUint32)this));
|
sl@0
|
851 |
}
|
sl@0
|
852 |
|
sl@0
|
853 |
EXPORT_C const RWindowBase *CTBlankWindow::BaseWin() const
|
sl@0
|
854 |
{
|
sl@0
|
855 |
return((const RWindowBase *)&iWin);
|
sl@0
|
856 |
}
|
sl@0
|
857 |
|
sl@0
|
858 |
EXPORT_C RWindowBase *CTBlankWindow::BaseWin()
|
sl@0
|
859 |
{
|
sl@0
|
860 |
return((RWindowBase *)&iWin);
|
sl@0
|
861 |
}
|
sl@0
|
862 |
|
sl@0
|
863 |
//CTWindowGroup//
|
sl@0
|
864 |
|
sl@0
|
865 |
EXPORT_C CTWindowGroup::CTWindowGroup(CTClient *aClient) : CTWinBase(EWinTypeGroup), iGroupWin(aClient->iWs)
|
sl@0
|
866 |
{
|
sl@0
|
867 |
__DECLARE_NAME(_S("CTWindowGroup"));
|
sl@0
|
868 |
iClient=aClient;
|
sl@0
|
869 |
iOwnerWin=this;
|
sl@0
|
870 |
}
|
sl@0
|
871 |
|
sl@0
|
872 |
EXPORT_C CTWindowGroup::~CTWindowGroup()
|
sl@0
|
873 |
{
|
sl@0
|
874 |
iGroupWin.Close();
|
sl@0
|
875 |
}
|
sl@0
|
876 |
|
sl@0
|
877 |
EXPORT_C const RWindowTreeNode *CTWindowGroup::WinTreeNode() const
|
sl@0
|
878 |
{
|
sl@0
|
879 |
return((const RWindowTreeNode *)&iGroupWin);
|
sl@0
|
880 |
}
|
sl@0
|
881 |
|
sl@0
|
882 |
EXPORT_C RWindowTreeNode *CTWindowGroup::WinTreeNode()
|
sl@0
|
883 |
{
|
sl@0
|
884 |
return((RWindowTreeNode *)&iGroupWin);
|
sl@0
|
885 |
}
|
sl@0
|
886 |
|
sl@0
|
887 |
EXPORT_C void CTWindowGroup::ConstructL()
|
sl@0
|
888 |
{
|
sl@0
|
889 |
User::LeaveIfError(iGroupWin.Construct((TUint32)this));
|
sl@0
|
890 |
}
|
sl@0
|
891 |
|
sl@0
|
892 |
EXPORT_C TSize CTWindowGroup::Size() const
|
sl@0
|
893 |
{
|
sl@0
|
894 |
return(iClient->iScreen->SizeInPixels());
|
sl@0
|
895 |
}
|
sl@0
|
896 |
|
sl@0
|
897 |
EXPORT_C void CTWindowGroup::WinKeyL(const TKeyEvent &,const TTime&)
|
sl@0
|
898 |
{
|
sl@0
|
899 |
}
|
sl@0
|
900 |
|
sl@0
|
901 |
EXPORT_C void CTWindowGroup::KeyL(const TKeyEvent &aKey,const TTime&aTime)
|
sl@0
|
902 |
{
|
sl@0
|
903 |
if (iCurWin)
|
sl@0
|
904 |
iCurWin->WinKeyL(aKey,aTime);
|
sl@0
|
905 |
}
|
sl@0
|
906 |
|
sl@0
|
907 |
EXPORT_C void CTWindowGroup::KeyUpL(const TKeyEvent &,const TTime&)
|
sl@0
|
908 |
{
|
sl@0
|
909 |
}
|
sl@0
|
910 |
|
sl@0
|
911 |
EXPORT_C void CTWindowGroup::KeyDownL(const TKeyEvent &,const TTime&)
|
sl@0
|
912 |
{
|
sl@0
|
913 |
}
|
sl@0
|
914 |
|
sl@0
|
915 |
EXPORT_C void CTWindowGroup::ClearCurrentWindow()
|
sl@0
|
916 |
{
|
sl@0
|
917 |
iCurWin=NULL;
|
sl@0
|
918 |
}
|
sl@0
|
919 |
|
sl@0
|
920 |
EXPORT_C void CTWindowGroup::SetCurrentWindow(CTBaseWin *aWindow)
|
sl@0
|
921 |
{
|
sl@0
|
922 |
SetCurrentWindow(aWindow, EFalse);
|
sl@0
|
923 |
}
|
sl@0
|
924 |
|
sl@0
|
925 |
EXPORT_C void CTWindowGroup::SetCurrentWindow(CTBaseWin *aWindow, TBool aLocked)
|
sl@0
|
926 |
{
|
sl@0
|
927 |
if (iCurWin!=aWindow)
|
sl@0
|
928 |
{
|
sl@0
|
929 |
if (iFocus && iCurWin)
|
sl@0
|
930 |
iCurWin->FocusChanged(EFalse);
|
sl@0
|
931 |
iCurWin=aWindow;
|
sl@0
|
932 |
if (iFocus && iCurWin)
|
sl@0
|
933 |
iCurWin->FocusChanged(ETrue);
|
sl@0
|
934 |
}
|
sl@0
|
935 |
iLocked=aLocked;
|
sl@0
|
936 |
}
|
sl@0
|
937 |
|
sl@0
|
938 |
EXPORT_C CTBaseWin *CTWindowGroup::CurWin(void) const
|
sl@0
|
939 |
{
|
sl@0
|
940 |
return(iCurWin);
|
sl@0
|
941 |
}
|
sl@0
|
942 |
|
sl@0
|
943 |
EXPORT_C void CTWindowGroup::FocusLost()
|
sl@0
|
944 |
{
|
sl@0
|
945 |
iFocus=EFalse;
|
sl@0
|
946 |
if (iCurWin)
|
sl@0
|
947 |
iCurWin->FocusChanged(EFalse);
|
sl@0
|
948 |
}
|
sl@0
|
949 |
|
sl@0
|
950 |
EXPORT_C void CTWindowGroup::FocusGained()
|
sl@0
|
951 |
{
|
sl@0
|
952 |
iFocus=ETrue;
|
sl@0
|
953 |
if (iCurWin)
|
sl@0
|
954 |
iCurWin->FocusChanged(ETrue);
|
sl@0
|
955 |
}
|
sl@0
|
956 |
|
sl@0
|
957 |
EXPORT_C TBool CTWindowGroup::HasFocus(CTBaseWin *aWin) const
|
sl@0
|
958 |
{
|
sl@0
|
959 |
return(iFocus && iCurWin==aWin);
|
sl@0
|
960 |
}
|
sl@0
|
961 |
|
sl@0
|
962 |
EXPORT_C CTClient *CTWindowGroup::Client() const
|
sl@0
|
963 |
{
|
sl@0
|
964 |
return(iClient);
|
sl@0
|
965 |
}
|
sl@0
|
966 |
|
sl@0
|
967 |
EXPORT_C CTWindowGroup *CTWindowGroup::Group() const
|
sl@0
|
968 |
{
|
sl@0
|
969 |
return((CTWindowGroup *)this);
|
sl@0
|
970 |
}
|
sl@0
|
971 |
|
sl@0
|
972 |
EXPORT_C void CTWindowGroup::PasswordL(const TTime &)
|
sl@0
|
973 |
{
|
sl@0
|
974 |
TbPanic(ETestBasePanicPassword);
|
sl@0
|
975 |
}
|
sl@0
|
976 |
|
sl@0
|
977 |
EXPORT_C void CTWindowGroup::MessageReady(const TWsEvent &)
|
sl@0
|
978 |
//
|
sl@0
|
979 |
// Dummy handler for un-exepected messages (could panic, but better not as the app sending the messages fault really not ours)
|
sl@0
|
980 |
//
|
sl@0
|
981 |
{
|
sl@0
|
982 |
}
|
sl@0
|
983 |
|
sl@0
|
984 |
EXPORT_C void CTWindowGroup::ScreenDeviceChanged()
|
sl@0
|
985 |
{
|
sl@0
|
986 |
TPixelsAndRotation sizeAndRotation;
|
sl@0
|
987 |
Client()->iScreen->GetDefaultScreenSizeAndRotation(sizeAndRotation);
|
sl@0
|
988 |
Client()->iScreen->SetScreenSizeAndRotation(sizeAndRotation);
|
sl@0
|
989 |
}
|
sl@0
|
990 |
|
sl@0
|
991 |
EXPORT_C void CTWindowGroup::UserEvent(TInt /*aEventType*/)
|
sl@0
|
992 |
{
|
sl@0
|
993 |
}
|
sl@0
|
994 |
|
sl@0
|
995 |
|
sl@0
|
996 |
// CTClient //
|
sl@0
|
997 |
|
sl@0
|
998 |
EXPORT_C CTClient::CTClient()
|
sl@0
|
999 |
{
|
sl@0
|
1000 |
__DECLARE_NAME(_S("CTClient"));
|
sl@0
|
1001 |
}
|
sl@0
|
1002 |
|
sl@0
|
1003 |
EXPORT_C void CTClient::DestroyWindows()
|
sl@0
|
1004 |
{
|
sl@0
|
1005 |
if (iGroup)
|
sl@0
|
1006 |
{
|
sl@0
|
1007 |
CTBaseWin *win;
|
sl@0
|
1008 |
if (iGroup->GroupWin()->WsHandle()!=0) // Check it was created okay
|
sl@0
|
1009 |
while((win=iGroup->Child())!=NULL && ((TUint)win)!=ENullWsHandle)
|
sl@0
|
1010 |
CTBaseWin::Delete(win);
|
sl@0
|
1011 |
delete iGroup;
|
sl@0
|
1012 |
iGroup=NULL;
|
sl@0
|
1013 |
}
|
sl@0
|
1014 |
}
|
sl@0
|
1015 |
|
sl@0
|
1016 |
EXPORT_C CTClient::~CTClient()
|
sl@0
|
1017 |
{
|
sl@0
|
1018 |
DestroyWindows();
|
sl@0
|
1019 |
delete iGc;
|
sl@0
|
1020 |
delete iEventHandler;
|
sl@0
|
1021 |
delete iRedrawEventHandler;
|
sl@0
|
1022 |
delete iScreen;
|
sl@0
|
1023 |
TInt count=iWs.ResourceCount();
|
sl@0
|
1024 |
__ASSERT_ALWAYS(count==0,TbPanic(ETestBasePanicResourceCount));
|
sl@0
|
1025 |
iWs.Close();
|
sl@0
|
1026 |
}
|
sl@0
|
1027 |
|
sl@0
|
1028 |
EXPORT_C void CTClient::ConstructEventHandlerL()
|
sl@0
|
1029 |
{
|
sl@0
|
1030 |
iEventHandler=new(ELeave) CTEvent(&iWs);
|
sl@0
|
1031 |
iEventHandler->Construct();
|
sl@0
|
1032 |
}
|
sl@0
|
1033 |
|
sl@0
|
1034 |
EXPORT_C void CTClient::ConstructL()
|
sl@0
|
1035 |
{
|
sl@0
|
1036 |
User::LeaveIfError(iWs.Connect());
|
sl@0
|
1037 |
iScreen=new(ELeave) CWsScreenDevice(iWs);
|
sl@0
|
1038 |
User::LeaveIfError(iScreen->Construct(iScreenNumber));
|
sl@0
|
1039 |
iRedrawEventHandler=new(ELeave) CTRedraw(&iWs);
|
sl@0
|
1040 |
iRedrawEventHandler->Construct();
|
sl@0
|
1041 |
ConstructEventHandlerL();
|
sl@0
|
1042 |
iGc=new(ELeave) CWindowGc(iScreen);
|
sl@0
|
1043 |
User::LeaveIfError(iGc->Construct());
|
sl@0
|
1044 |
iTitle.Copy(RThread().FullName());
|
sl@0
|
1045 |
}
|
sl@0
|
1046 |
|
sl@0
|
1047 |
EXPORT_C void CTClient::ResetFocus()
|
sl@0
|
1048 |
{
|
sl@0
|
1049 |
iGroup->ClearCurrentWindow();
|
sl@0
|
1050 |
iGroup->SetCurrentWindow(iGroup->Child());
|
sl@0
|
1051 |
}
|
sl@0
|
1052 |
|
sl@0
|
1053 |
EXPORT_C TWindowTitle *CTClient::Title()
|
sl@0
|
1054 |
{
|
sl@0
|
1055 |
return(&iTitle);
|
sl@0
|
1056 |
}
|
sl@0
|
1057 |
|
sl@0
|
1058 |
EXPORT_C TBool CTClient::QueueRead()
|
sl@0
|
1059 |
{
|
sl@0
|
1060 |
TBool ret=iEventHandler->IsActive();
|
sl@0
|
1061 |
if (ret==EFalse)
|
sl@0
|
1062 |
iEventHandler->Request();
|
sl@0
|
1063 |
return(ret);
|
sl@0
|
1064 |
}
|
sl@0
|
1065 |
|
sl@0
|
1066 |
EXPORT_C void CTClient::CancelRead()
|
sl@0
|
1067 |
{
|
sl@0
|
1068 |
iEventHandler->Cancel();
|
sl@0
|
1069 |
}
|
sl@0
|
1070 |
|
sl@0
|
1071 |
EXPORT_C void CTClient::SetCancelFunction(const TCallBack &aCallBack)
|
sl@0
|
1072 |
{
|
sl@0
|
1073 |
iEventHandler->SetCancelFunction(aCallBack);
|
sl@0
|
1074 |
}
|
sl@0
|
1075 |
|
sl@0
|
1076 |
EXPORT_C void CTClient::CancelRedrawRead()
|
sl@0
|
1077 |
{
|
sl@0
|
1078 |
iRedrawEventHandler->Cancel();
|
sl@0
|
1079 |
}
|
sl@0
|
1080 |
|
sl@0
|
1081 |
EXPORT_C void CTClient::SetRedrawCancelFunction(const TCallBack &aCallBack)
|
sl@0
|
1082 |
{
|
sl@0
|
1083 |
iRedrawEventHandler->SetCancelFunction(aCallBack);
|
sl@0
|
1084 |
}
|
sl@0
|
1085 |
|
sl@0
|
1086 |
EXPORT_C void CTClient::RequestRedraw()
|
sl@0
|
1087 |
{
|
sl@0
|
1088 |
iRedrawEventHandler->Request();
|
sl@0
|
1089 |
}
|
sl@0
|
1090 |
|
sl@0
|
1091 |
EXPORT_C void CTClient::LogMessage(const TLogMessageText &aMessage)
|
sl@0
|
1092 |
{
|
sl@0
|
1093 |
iWs.LogMessage(aMessage);
|
sl@0
|
1094 |
iWs.Flush();
|
sl@0
|
1095 |
}
|
sl@0
|
1096 |
|
sl@0
|
1097 |
EXPORT_C TBool CTClient::IsEventWaiting()
|
sl@0
|
1098 |
{
|
sl@0
|
1099 |
iWs.NumWindowGroups(); //Make sure all asyncronus calls have finished
|
sl@0
|
1100 |
return (iEventHandler->iStatus!=KRequestPending);
|
sl@0
|
1101 |
}
|
sl@0
|
1102 |
|
sl@0
|
1103 |
TBool CTClient::WaitUntilEventPending(const TRequestStatus& aStatus)
|
sl@0
|
1104 |
{
|
sl@0
|
1105 |
if (aStatus!=KRequestPending)
|
sl@0
|
1106 |
return ETrue;
|
sl@0
|
1107 |
User::After(2000000); //Need something smarter than this
|
sl@0
|
1108 |
return (aStatus!=KRequestPending);
|
sl@0
|
1109 |
}
|
sl@0
|
1110 |
|
sl@0
|
1111 |
EXPORT_C TBool CTClient::WaitUntilRedrawPending()
|
sl@0
|
1112 |
{
|
sl@0
|
1113 |
return WaitUntilEventPending(iRedrawEventHandler->iStatus);
|
sl@0
|
1114 |
}
|
sl@0
|
1115 |
|
sl@0
|
1116 |
EXPORT_C TBool CTClient::WaitUntilEventPending()
|
sl@0
|
1117 |
{
|
sl@0
|
1118 |
return WaitUntilEventPending(iEventHandler->iStatus);
|
sl@0
|
1119 |
}
|
sl@0
|
1120 |
|
sl@0
|
1121 |
EXPORT_C TInt CTClient::WaitForRedrawsToFinish()
|
sl@0
|
1122 |
{
|
sl@0
|
1123 |
return WaitForEventsToFinish(EFalse);
|
sl@0
|
1124 |
}
|
sl@0
|
1125 |
|
sl@0
|
1126 |
EXPORT_C TInt CTClient::WaitForAllEventProcessingToFinish()
|
sl@0
|
1127 |
{
|
sl@0
|
1128 |
return WaitForEventsToFinish(ETrue);
|
sl@0
|
1129 |
}
|
sl@0
|
1130 |
|
sl@0
|
1131 |
TInt CTClient::WaitForEventsToFinish(TBool aAll)
|
sl@0
|
1132 |
{
|
sl@0
|
1133 |
CStopTheScheduler* stop=new CStopTheScheduler(this,ETlibRedrawActivePriority-1,aAll);
|
sl@0
|
1134 |
if (!stop)
|
sl@0
|
1135 |
return KErrNoMemory;
|
sl@0
|
1136 |
stop->Call();
|
sl@0
|
1137 |
CActiveScheduler::Start();
|
sl@0
|
1138 |
delete stop;
|
sl@0
|
1139 |
return KErrNone;
|
sl@0
|
1140 |
}
|
sl@0
|
1141 |
|
sl@0
|
1142 |
|
sl@0
|
1143 |
// CStopTheScheduler //
|
sl@0
|
1144 |
|
sl@0
|
1145 |
void CStopTheScheduler::RunL()
|
sl@0
|
1146 |
{
|
sl@0
|
1147 |
#ifdef __WINS__
|
sl@0
|
1148 |
RDebug::Print(_L("CStopTheScheduler::RunL - enter - %d"), iCStopTheSchedulerRunCount);
|
sl@0
|
1149 |
#endif
|
sl@0
|
1150 |
if (iClient)
|
sl@0
|
1151 |
{
|
sl@0
|
1152 |
iClient->iWs.NumWindowGroups(); //Make sure all asyncronus calls have finished
|
sl@0
|
1153 |
}
|
sl@0
|
1154 |
|
sl@0
|
1155 |
if (!iClient || (iClient->RedrawHandler()->iStatus==KRequestPending && (!iAll || iClient->EventHandler()->iStatus==KRequestPending)))
|
sl@0
|
1156 |
{
|
sl@0
|
1157 |
#ifdef __WINS__
|
sl@0
|
1158 |
RDebug::Print(_L("CStopTheScheduler::RunL - Stop - %d"), iCStopTheSchedulerRunCount);
|
sl@0
|
1159 |
#endif
|
sl@0
|
1160 |
CActiveScheduler::Stop();
|
sl@0
|
1161 |
}
|
sl@0
|
1162 |
else
|
sl@0
|
1163 |
{
|
sl@0
|
1164 |
#ifdef __WINS__
|
sl@0
|
1165 |
RDebug::Print(_L("CStopTheScheduler::RunL - Call - %d"), iCStopTheSchedulerRunCount);
|
sl@0
|
1166 |
#endif
|
sl@0
|
1167 |
Call();
|
sl@0
|
1168 |
}
|
sl@0
|
1169 |
#ifdef __WINS__
|
sl@0
|
1170 |
RDebug::Print(_L("CStopTheScheduler::RunL - exit - %d"), iCStopTheSchedulerRunCount);
|
sl@0
|
1171 |
iCStopTheSchedulerRunCount++;
|
sl@0
|
1172 |
#endif
|
sl@0
|
1173 |
}
|
sl@0
|
1174 |
|
sl@0
|
1175 |
void WaitForRedrawsToFinish()
|
sl@0
|
1176 |
{
|
sl@0
|
1177 |
CStopTheScheduler* ps=new CStopTheScheduler(ETlibRedrawActivePriority-1);
|
sl@0
|
1178 |
if(ps)
|
sl@0
|
1179 |
{
|
sl@0
|
1180 |
ps->Call();
|
sl@0
|
1181 |
CActiveScheduler::Start();
|
sl@0
|
1182 |
delete ps;
|
sl@0
|
1183 |
}
|
sl@0
|
1184 |
}
|
sl@0
|
1185 |
|
sl@0
|
1186 |
|
sl@0
|
1187 |
// CTEventBase //
|
sl@0
|
1188 |
|
sl@0
|
1189 |
EXPORT_C CTEventBase::CTEventBase(RWsSession *aWs, TInt aPriority) : CActive(aPriority), iWs(aWs)
|
sl@0
|
1190 |
{
|
sl@0
|
1191 |
}
|
sl@0
|
1192 |
|
sl@0
|
1193 |
EXPORT_C CTEventBase::~CTEventBase()
|
sl@0
|
1194 |
{
|
sl@0
|
1195 |
}
|
sl@0
|
1196 |
|
sl@0
|
1197 |
EXPORT_C void CTEventBase::Construct()
|
sl@0
|
1198 |
{
|
sl@0
|
1199 |
CActiveScheduler::Add(this);
|
sl@0
|
1200 |
Request();
|
sl@0
|
1201 |
}
|
sl@0
|
1202 |
|
sl@0
|
1203 |
EXPORT_C void CTEventBase::RunL()
|
sl@0
|
1204 |
{
|
sl@0
|
1205 |
if (iStatus==KErrNone)
|
sl@0
|
1206 |
{
|
sl@0
|
1207 |
++iCount;
|
sl@0
|
1208 |
TRAPD(err,doRunL());
|
sl@0
|
1209 |
if (err<=0) // Positive value means this has been destroyed
|
sl@0
|
1210 |
{
|
sl@0
|
1211 |
if (iCancelRequested)
|
sl@0
|
1212 |
CancelHandler();
|
sl@0
|
1213 |
Request();
|
sl@0
|
1214 |
// if (err!=KErrNone)
|
sl@0
|
1215 |
// User::LeaveIfError(err); Should have a guaranteed to work error dialog here I guess
|
sl@0
|
1216 |
}
|
sl@0
|
1217 |
}
|
sl@0
|
1218 |
else if (iStatus==KErrCancel && iCancelRequested)
|
sl@0
|
1219 |
{
|
sl@0
|
1220 |
CancelHandler();
|
sl@0
|
1221 |
Request();
|
sl@0
|
1222 |
}
|
sl@0
|
1223 |
else
|
sl@0
|
1224 |
TbPanic(ETestBasePanicEventStat);
|
sl@0
|
1225 |
}
|
sl@0
|
1226 |
|
sl@0
|
1227 |
void CTEventBase::SetCancelFunction(const TCallBack &aCallBack)
|
sl@0
|
1228 |
{
|
sl@0
|
1229 |
if (!IsActive() && iCancelRequested)
|
sl@0
|
1230 |
TbPanic(ETestBasePanicCancelFunction);
|
sl@0
|
1231 |
iCancelCallBack=aCallBack;
|
sl@0
|
1232 |
iCancelRequested=ETrue;
|
sl@0
|
1233 |
DoCancel();
|
sl@0
|
1234 |
}
|
sl@0
|
1235 |
|
sl@0
|
1236 |
EXPORT_C void CTEventBase::CancelHandler()
|
sl@0
|
1237 |
{
|
sl@0
|
1238 |
iCancelCallBack.CallBack();
|
sl@0
|
1239 |
iCancelRequested=EFalse;
|
sl@0
|
1240 |
}
|
sl@0
|
1241 |
|
sl@0
|
1242 |
// TLibWsEvent //
|
sl@0
|
1243 |
|
sl@0
|
1244 |
EXPORT_C CTWindowGroup *TlibWsEvent::WindowGroup()
|
sl@0
|
1245 |
{
|
sl@0
|
1246 |
CTWindowGroup *group=(CTWindowGroup *)Handle();
|
sl@0
|
1247 |
__ASSERT_DEBUG(group->iType==EWinTypeGroup,TbPanic(ETestBasePanicWinType));
|
sl@0
|
1248 |
return(group);
|
sl@0
|
1249 |
}
|
sl@0
|
1250 |
|
sl@0
|
1251 |
EXPORT_C CTBaseWin *TlibWsEvent::BaseWin()
|
sl@0
|
1252 |
{
|
sl@0
|
1253 |
CTBaseWin *win=(CTBaseWin *)Handle();
|
sl@0
|
1254 |
__ASSERT_DEBUG(win->iType==EWinTypeClient || win->iType==EWinTypeGroup,TbPanic(ETestBasePanicWinType));
|
sl@0
|
1255 |
return(win);
|
sl@0
|
1256 |
}
|
sl@0
|
1257 |
|
sl@0
|
1258 |
// CTEvent //
|
sl@0
|
1259 |
|
sl@0
|
1260 |
EXPORT_C CTEvent::CTEvent(RWsSession *aWs) : CTEventBase(aWs, ETlibWsEventActivePriority)
|
sl@0
|
1261 |
{
|
sl@0
|
1262 |
__DECLARE_NAME(_S("CTEvent"));
|
sl@0
|
1263 |
}
|
sl@0
|
1264 |
|
sl@0
|
1265 |
EXPORT_C CTEvent::~CTEvent()
|
sl@0
|
1266 |
{
|
sl@0
|
1267 |
Cancel();
|
sl@0
|
1268 |
}
|
sl@0
|
1269 |
|
sl@0
|
1270 |
EXPORT_C void CTEvent::DoCancel()
|
sl@0
|
1271 |
{
|
sl@0
|
1272 |
iWs->EventReadyCancel();
|
sl@0
|
1273 |
}
|
sl@0
|
1274 |
|
sl@0
|
1275 |
EXPORT_C void CTEvent::Request()
|
sl@0
|
1276 |
{
|
sl@0
|
1277 |
iWs->EventReady(&iStatus);
|
sl@0
|
1278 |
SetActive();
|
sl@0
|
1279 |
}
|
sl@0
|
1280 |
|
sl@0
|
1281 |
EXPORT_C void CTEvent::LogEvent(const TWsEvent &)
|
sl@0
|
1282 |
{
|
sl@0
|
1283 |
}
|
sl@0
|
1284 |
|
sl@0
|
1285 |
EXPORT_C void CTEvent::doRunL()
|
sl@0
|
1286 |
{
|
sl@0
|
1287 |
TlibWsEvent event;
|
sl@0
|
1288 |
|
sl@0
|
1289 |
iWs->GetEvent(event);
|
sl@0
|
1290 |
LogEvent(event);
|
sl@0
|
1291 |
if (event.Handle()!=0 && event.Handle()!=ENullWsHandle)
|
sl@0
|
1292 |
{
|
sl@0
|
1293 |
switch(event.Type())
|
sl@0
|
1294 |
{
|
sl@0
|
1295 |
case EEventKey:
|
sl@0
|
1296 |
event.WindowGroup()->KeyL(*event.Key(),event.Time());
|
sl@0
|
1297 |
break;
|
sl@0
|
1298 |
case EEventKeyDown:
|
sl@0
|
1299 |
__ASSERT_ALWAYS(event.Key()->iCode==0 && event.Key()->iRepeats==0, TbPanic(ETestBasePanicKeyParams));
|
sl@0
|
1300 |
event.WindowGroup()->KeyDownL(*event.Key(),event.Time());
|
sl@0
|
1301 |
break;
|
sl@0
|
1302 |
case EEventKeyUp:
|
sl@0
|
1303 |
__ASSERT_ALWAYS(event.Key()->iCode==0 && event.Key()->iRepeats==0, TbPanic(ETestBasePanicKeyParams));
|
sl@0
|
1304 |
event.WindowGroup()->KeyUpL(*event.Key(),event.Time());
|
sl@0
|
1305 |
break;
|
sl@0
|
1306 |
case EEventModifiersChanged:
|
sl@0
|
1307 |
event.BaseWin()->ModifiersChanged(*event.ModifiersChanged(),event.Time());
|
sl@0
|
1308 |
break;
|
sl@0
|
1309 |
case EEventPointer:
|
sl@0
|
1310 |
event.BaseWin()->PointerL(*event.Pointer(),event.Time());
|
sl@0
|
1311 |
break;
|
sl@0
|
1312 |
case EEventDragDrop:
|
sl@0
|
1313 |
event.BaseWin()->DragDropL(*event.Pointer(),event.Time());
|
sl@0
|
1314 |
break;
|
sl@0
|
1315 |
case EEventPointerEnter:
|
sl@0
|
1316 |
event.BaseWin()->PointerEnter(event.Time());
|
sl@0
|
1317 |
break;
|
sl@0
|
1318 |
case EEventPointerExit:
|
sl@0
|
1319 |
event.BaseWin()->PointerExit(event.Time());
|
sl@0
|
1320 |
break;
|
sl@0
|
1321 |
case EEventPointerBufferReady:
|
sl@0
|
1322 |
event.BaseWin()->PointerBufferReady(event.Time());
|
sl@0
|
1323 |
break;
|
sl@0
|
1324 |
case EEventSwitchOn:
|
sl@0
|
1325 |
event.BaseWin()->SwitchOn(event.Time());
|
sl@0
|
1326 |
break;
|
sl@0
|
1327 |
case EEventFocusLost:
|
sl@0
|
1328 |
event.WindowGroup()->FocusLost();
|
sl@0
|
1329 |
break;
|
sl@0
|
1330 |
case EEventFocusGained:
|
sl@0
|
1331 |
event.WindowGroup()->FocusGained();
|
sl@0
|
1332 |
break;
|
sl@0
|
1333 |
case EEventPassword:
|
sl@0
|
1334 |
event.WindowGroup()->PasswordL(event.Time());
|
sl@0
|
1335 |
break;
|
sl@0
|
1336 |
case EEventMessageReady:
|
sl@0
|
1337 |
event.WindowGroup()->MessageReady(event);
|
sl@0
|
1338 |
break;
|
sl@0
|
1339 |
case EEventErrorMessage:
|
sl@0
|
1340 |
event.WindowGroup()->ErrorMessage(*event.ErrorMessage(), event.Time());
|
sl@0
|
1341 |
break;
|
sl@0
|
1342 |
case EEventSwitchOff:
|
sl@0
|
1343 |
case EEventKeySwitchOff:
|
sl@0
|
1344 |
{
|
sl@0
|
1345 |
TTimeIntervalMicroSeconds32 ii=1000000;
|
sl@0
|
1346 |
User::After(ii); //WINS does not always work without this!
|
sl@0
|
1347 |
UserHal::SwitchOff();
|
sl@0
|
1348 |
}
|
sl@0
|
1349 |
break;
|
sl@0
|
1350 |
case EEventScreenDeviceChanged:
|
sl@0
|
1351 |
event.WindowGroup()->ScreenDeviceChanged();
|
sl@0
|
1352 |
break;
|
sl@0
|
1353 |
case EEventNull:
|
sl@0
|
1354 |
break;
|
sl@0
|
1355 |
default:
|
sl@0
|
1356 |
if (event.Type()>=EEventUser)
|
sl@0
|
1357 |
{
|
sl@0
|
1358 |
event.WindowGroup()->UserEvent(event.Type());
|
sl@0
|
1359 |
break;
|
sl@0
|
1360 |
}
|
sl@0
|
1361 |
else
|
sl@0
|
1362 |
{
|
sl@0
|
1363 |
//if not in BufferSecurity test - panic
|
sl@0
|
1364 |
TInt value = EFalse;
|
sl@0
|
1365 |
TInt err = RProperty::Get(KUidWServSecurityTesting,EWServSecTestBufferSecurity,value);
|
sl@0
|
1366 |
if ((err != KErrNone) || (value != (TInt)ETrue))
|
sl@0
|
1367 |
TbPanic(ETestBasePanicInvalidEvent);
|
sl@0
|
1368 |
}
|
sl@0
|
1369 |
break;
|
sl@0
|
1370 |
}
|
sl@0
|
1371 |
}
|
sl@0
|
1372 |
}
|
sl@0
|
1373 |
|
sl@0
|
1374 |
EXPORT_C CTRedraw::CTRedraw(RWsSession *aWs) : CTEventBase(aWs, ETlibRedrawActivePriority)
|
sl@0
|
1375 |
{
|
sl@0
|
1376 |
__DECLARE_NAME(_S("CTRedraw"));
|
sl@0
|
1377 |
}
|
sl@0
|
1378 |
|
sl@0
|
1379 |
EXPORT_C CTRedraw::~CTRedraw()
|
sl@0
|
1380 |
{
|
sl@0
|
1381 |
Cancel();
|
sl@0
|
1382 |
}
|
sl@0
|
1383 |
|
sl@0
|
1384 |
EXPORT_C void CTRedraw::Request()
|
sl@0
|
1385 |
{
|
sl@0
|
1386 |
iWs->RedrawReady(&iStatus);
|
sl@0
|
1387 |
SetActive();
|
sl@0
|
1388 |
}
|
sl@0
|
1389 |
|
sl@0
|
1390 |
EXPORT_C void CTRedraw::DoCancel()
|
sl@0
|
1391 |
{
|
sl@0
|
1392 |
iWs->RedrawReadyCancel();
|
sl@0
|
1393 |
}
|
sl@0
|
1394 |
|
sl@0
|
1395 |
EXPORT_C void CTRedraw::doRunL()
|
sl@0
|
1396 |
{
|
sl@0
|
1397 |
TWsRedrawEvent redraw;
|
sl@0
|
1398 |
iWs->GetRedraw(redraw);
|
sl@0
|
1399 |
if (redraw.Handle()!=0 && redraw.Handle()!=ENullWsHandle)
|
sl@0
|
1400 |
{
|
sl@0
|
1401 |
__ASSERT_ALWAYS(!redraw.Rect().IsEmpty(),TbPanic(ETestBasePanicNullRedraw));
|
sl@0
|
1402 |
((CTWin *)redraw.Handle())->Redraw(redraw.Rect());
|
sl@0
|
1403 |
}
|
sl@0
|
1404 |
}
|
sl@0
|
1405 |
|
sl@0
|
1406 |
EXPORT_C void CTUser::Splat(CTClient *aClient, const TRect &aRect, const TRgb &aRgb)
|
sl@0
|
1407 |
{
|
sl@0
|
1408 |
RBlankWindow win(aClient->iWs);
|
sl@0
|
1409 |
win.Construct(*(aClient->iGroup->WinTreeNode()),1);
|
sl@0
|
1410 |
win.SetColor(aRgb);
|
sl@0
|
1411 |
win.SetExtent(aRect.iTl,aRect.Size());
|
sl@0
|
1412 |
win.Activate();
|
sl@0
|
1413 |
aClient->iWs.Flush();
|
sl@0
|
1414 |
win.Close();
|
sl@0
|
1415 |
}
|
sl@0
|
1416 |
|
sl@0
|
1417 |
void doTestLibStartUpL(TInt aScreenNumber, CTClient *&aClient, CActiveScheduler *&aActiveScheduler,CTrapCleanup *&aCleanUpStack,TCreateClientFunc aFunc)
|
sl@0
|
1418 |
{
|
sl@0
|
1419 |
User::LeaveIfNull(aCleanUpStack=CTrapCleanup::New());
|
sl@0
|
1420 |
aActiveScheduler=new(ELeave) CActiveScheduler;
|
sl@0
|
1421 |
CActiveScheduler::Install(aActiveScheduler);
|
sl@0
|
1422 |
aClient=aFunc();
|
sl@0
|
1423 |
aClient->SetScreenNumber(aScreenNumber);
|
sl@0
|
1424 |
aClient->ConstructL();
|
sl@0
|
1425 |
CActiveScheduler::Start();
|
sl@0
|
1426 |
}
|
sl@0
|
1427 |
|
sl@0
|
1428 |
EXPORT_C TInt TestLibStartUp(TCreateClientFunc aFunc,TInt aScreenNumber)
|
sl@0
|
1429 |
{
|
sl@0
|
1430 |
__UHEAP_MARK;
|
sl@0
|
1431 |
CTrapCleanup* cleanUpStack=NULL;
|
sl@0
|
1432 |
CActiveScheduler *activeScheduler=NULL;
|
sl@0
|
1433 |
CTClient *client=NULL;
|
sl@0
|
1434 |
TRAPD(err,doTestLibStartUpL(aScreenNumber, client,activeScheduler,cleanUpStack,aFunc));
|
sl@0
|
1435 |
delete client;
|
sl@0
|
1436 |
delete activeScheduler;
|
sl@0
|
1437 |
delete cleanUpStack;
|
sl@0
|
1438 |
__UHEAP_MARKEND;
|
sl@0
|
1439 |
return(err);
|
sl@0
|
1440 |
}
|
sl@0
|
1441 |
|
sl@0
|
1442 |
EXPORT_C TInt TestLibStartUp(TCreateClientFunc aFunc)
|
sl@0
|
1443 |
{
|
sl@0
|
1444 |
return TestLibStartUp(aFunc, KDefaultScreen);
|
sl@0
|
1445 |
}
|
sl@0
|
1446 |
|