|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Base classes definitions used for building window server test code |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __TESTBASE_H__ |
|
19 #define __TESTBASE_H__ |
|
20 |
|
21 enum TTlibActivePriorities |
|
22 { |
|
23 ETlibRedrawActivePriority=-10, |
|
24 ETlibWsEventActivePriority=0, |
|
25 }; |
|
26 |
|
27 const TInt KDefaultScreen = 0; |
|
28 |
|
29 //enum {ENullWsHandle=0xFFFFFFFF}; // Events delivered to this handle are thrown away |
|
30 const TUint32 ENullWsHandle=0xFFFFFFFF; // Events delivered to this handle are thrown away |
|
31 |
|
32 typedef TBuf<KMaxFullName> TWindowTitle; |
|
33 typedef TBuf<0x100> TWinCommand; |
|
34 |
|
35 const TUid KUidWServSecurityTesting={0x10205152}; |
|
36 enum TWServSecTest |
|
37 { |
|
38 EWServSecTestBufferSecurity |
|
39 }; |
|
40 |
|
41 class CTClient; // Forward reference |
|
42 class CTWindowGroup; |
|
43 class CTBaseWin; |
|
44 class CTWin; |
|
45 |
|
46 typedef CTClient *(*TCreateClientFunc)(); |
|
47 |
|
48 IMPORT_C TBool CheckBlankWindow(TRect aArea,TRgb aColor,const CWsScreenDevice* aScreen); |
|
49 |
|
50 class CTWinBase : public CBase |
|
51 { |
|
52 protected: |
|
53 public: |
|
54 IMPORT_C CTWinBase(TInt aType); |
|
55 IMPORT_C virtual TPoint Position() const; |
|
56 IMPORT_C virtual void PointerEnter(const TTime &aTime); |
|
57 IMPORT_C virtual void PointerExit(const TTime &aTime); |
|
58 IMPORT_C virtual void PointerBufferReady(const TTime &aTime); |
|
59 IMPORT_C virtual void PointerL(const TPointerEvent &aPointer,const TTime &aTime); |
|
60 IMPORT_C virtual void SwitchOn(const TTime &aTime); |
|
61 IMPORT_C virtual void ModifiersChanged(const TModifiersChangedEvent &aModifiersChanged ,const TTime &aTime); |
|
62 IMPORT_C virtual void ErrorMessage(const TWsErrorMessage &aErrorMessage, const TTime &aTime); |
|
63 IMPORT_C virtual void SetVisible(TBool aState); |
|
64 IMPORT_C CTWinBase *Parent() const; |
|
65 IMPORT_C CTWinBase *NextSibling() const; |
|
66 IMPORT_C CTWinBase *PrevSibling() const; |
|
67 IMPORT_C CTBaseWin *Child() const; |
|
68 IMPORT_C virtual void AdjustOrdinal(TInt adjust); |
|
69 IMPORT_C virtual void AdjustShadow(TInt aAdjust); |
|
70 IMPORT_C virtual TInt SubType(); |
|
71 // Pure virtual definitions |
|
72 virtual void WinKeyL(const TKeyEvent &aKey,const TTime &aTime)=0; |
|
73 virtual TSize Size() const=0; |
|
74 virtual RWindowTreeNode *WinTreeNode()=0; |
|
75 virtual const RWindowTreeNode *WinTreeNode() const=0; |
|
76 IMPORT_C virtual CTClient *Client() const; |
|
77 virtual CTWindowGroup *Group() const=0; |
|
78 CTWindowGroup *iOwnerWin; |
|
79 public: |
|
80 TInt iType; |
|
81 __DECLARE_TEST; |
|
82 }; |
|
83 |
|
84 class CTBaseWin : public CTWinBase |
|
85 { |
|
86 public: |
|
87 IMPORT_C CTBaseWin(TInt aType); |
|
88 IMPORT_C ~CTBaseWin(); |
|
89 IMPORT_C virtual void ConstructL(CTWinBase &parent); |
|
90 IMPORT_C virtual void ConstructExtLD(CTWinBase &aParent, const TPoint &aPos, const TSize &aSize); |
|
91 virtual TInt ConstructWin(const CTWinBase &aWs)=0; |
|
92 IMPORT_C virtual void InitWin(); |
|
93 IMPORT_C virtual void PointerL(const TPointerEvent &aPointer,const TTime &aTime); |
|
94 IMPORT_C virtual void DragDropL(const TPointerEvent &aPointer,const TTime &aTime); |
|
95 IMPORT_C virtual void RelinquishFocus(); |
|
96 IMPORT_C void Activate(); |
|
97 IMPORT_C virtual void AssignGC(CWindowGc &aGc); |
|
98 IMPORT_C CTBaseWin *Next(); |
|
99 IMPORT_C CTBaseWin *Prev(); |
|
100 IMPORT_C virtual void SetExtL(const TPoint &aPos, const TSize &aSize); |
|
101 IMPORT_C virtual void SetSizeL(const TSize &aSize); |
|
102 IMPORT_C virtual void SetPos(const TPoint &aPos); |
|
103 IMPORT_C void SetInitialPos(const TPoint &aPos); |
|
104 IMPORT_C virtual void SetDefaultExtL(); |
|
105 IMPORT_C virtual void SetFullScreenExtL(); |
|
106 IMPORT_C virtual void AdjustSizeL(TInt xMove,TInt yMove,TInt resize); |
|
107 IMPORT_C virtual TSize Size() const; |
|
108 IMPORT_C virtual void Draw(); |
|
109 IMPORT_C void DrawBorder(); |
|
110 // void FillWindow(TInt inset); |
|
111 IMPORT_C virtual TPoint Position() const; |
|
112 IMPORT_C static void Delete(CTBaseWin *aWin); |
|
113 IMPORT_C void AdjustOrdinal(TInt aAdjust); |
|
114 IMPORT_C virtual void AdjustShadow(TInt aAdjust); |
|
115 IMPORT_C void SetVisible(TBool aState); |
|
116 IMPORT_C RWindowTreeNode *WinTreeNode(); |
|
117 IMPORT_C const RWindowTreeNode *WinTreeNode() const; |
|
118 IMPORT_C virtual void WinKeyL(const TKeyEvent &aKey,const TTime &aTime); |
|
119 IMPORT_C virtual void KeyUpL(const TKeyEvent &aKey,const TTime &aTime); |
|
120 IMPORT_C virtual void KeyDownL(const TKeyEvent &aKey,const TTime &aTime); |
|
121 IMPORT_C virtual void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc); |
|
122 IMPORT_C virtual void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc, TDisplayMode *aMode); |
|
123 IMPORT_C void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc,TBool aVisible); |
|
124 enum |
|
125 { |
|
126 ENoTransparency=0x100 |
|
127 }; |
|
128 IMPORT_C virtual void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc, TDisplayMode *aMode,TBool aVisible,TInt aTransparency=ENoTransparency); |
|
129 IMPORT_C void SetDragRect(const TRect &aRect); |
|
130 IMPORT_C virtual void Resized(const TSize &aSize); |
|
131 IMPORT_C virtual void FocusChanged(TBool aState); |
|
132 IMPORT_C virtual CTWindowGroup *Group() const; |
|
133 virtual RWindowBase *BaseWin()=0; |
|
134 virtual const RWindowBase *BaseWin() const=0; |
|
135 inline CWindowGc *Gc(); |
|
136 protected: |
|
137 TSize iSize; |
|
138 CWindowGc *iGc; // Not owned by the window, just using it |
|
139 TPoint iPos; |
|
140 TInt iShadow; |
|
141 TRect iDragRect; |
|
142 TBool iDragging; |
|
143 TPoint iDragPos; |
|
144 CFbsFont *iFont; |
|
145 __DECLARE_TEST; |
|
146 }; |
|
147 |
|
148 class CTDrawableWin : public CTBaseWin |
|
149 { |
|
150 public: |
|
151 IMPORT_C CTDrawableWin(TInt aType); |
|
152 virtual RDrawableWindow *DrawableWin()=0; |
|
153 virtual const RDrawableWindow *DrawableWin() const=0; |
|
154 }; |
|
155 |
|
156 class CTWin : public CTDrawableWin |
|
157 { |
|
158 public: |
|
159 IMPORT_C CTWin(); |
|
160 IMPORT_C ~CTWin(); |
|
161 inline RWindow *Win() const; |
|
162 IMPORT_C virtual TInt ConstructWin(const CTWinBase &aWs); |
|
163 IMPORT_C void Invalidate(); |
|
164 IMPORT_C void Invalidate(const TRect &rect); |
|
165 IMPORT_C virtual void Redraw(); |
|
166 IMPORT_C virtual void Redraw(const TRect &aRect); |
|
167 IMPORT_C void DrawNow(); |
|
168 IMPORT_C void SetExt(const TPoint &aPos, const TSize &aSize); |
|
169 IMPORT_C void SetSize(const TSize &aSize); |
|
170 IMPORT_C void SetDefaultExt(); |
|
171 IMPORT_C void AdjustSize(TInt xMove,TInt yMove,TInt resize); |
|
172 IMPORT_C virtual RWindowBase *BaseWin(); |
|
173 IMPORT_C virtual const RWindowBase *BaseWin() const; |
|
174 IMPORT_C virtual RDrawableWindow *DrawableWin(); |
|
175 IMPORT_C virtual const RDrawableWindow *DrawableWin() const; |
|
176 protected: |
|
177 RWindow iWin; |
|
178 __DECLARE_TEST; |
|
179 }; |
|
180 |
|
181 class CTBackedUpWin : public CTDrawableWin |
|
182 { |
|
183 public: |
|
184 IMPORT_C CTBackedUpWin(TDisplayMode aDisplayMode); |
|
185 IMPORT_C ~CTBackedUpWin(); |
|
186 IMPORT_C virtual TInt ConstructWin(const CTWinBase &aWs); |
|
187 IMPORT_C virtual RWindowBase *BaseWin(); |
|
188 IMPORT_C virtual const RWindowBase *BaseWin() const; |
|
189 IMPORT_C virtual RDrawableWindow *DrawableWin(); |
|
190 IMPORT_C virtual const RDrawableWindow *DrawableWin() const; |
|
191 IMPORT_C RBackedUpWindow *BackedUpWin(); |
|
192 IMPORT_C const RBackedUpWindow *BackedUpWin() const; |
|
193 protected: |
|
194 RBackedUpWindow iWin; |
|
195 TDisplayMode iDisplayMode; |
|
196 __DECLARE_TEST; |
|
197 }; |
|
198 |
|
199 class CTTitledWindow : public CTWin |
|
200 { |
|
201 public: |
|
202 IMPORT_C CTTitledWindow(); |
|
203 IMPORT_C ~CTTitledWindow(); |
|
204 IMPORT_C void ConstructL(CTWinBase &parent); |
|
205 IMPORT_C void Draw(); |
|
206 IMPORT_C void FocusChanged(TBool aState); |
|
207 IMPORT_C void SetTitle(const TWindowTitle &aTitle); |
|
208 IMPORT_C void SetColor(TRgb aRgb); |
|
209 inline TRgb Color(); |
|
210 private: |
|
211 IMPORT_C void Resized(const TSize &aSize); |
|
212 protected: |
|
213 TWindowTitle iTitle; |
|
214 TInt iTitleHeight; |
|
215 TBool iFocus; |
|
216 TRgb iWinColor; |
|
217 TRgb iPenColor; |
|
218 }; |
|
219 |
|
220 class CTBlankWindow : public CTBaseWin |
|
221 { |
|
222 public: |
|
223 IMPORT_C CTBlankWindow(); |
|
224 IMPORT_C ~CTBlankWindow(); |
|
225 IMPORT_C void ConstructL(CTWinBase &aParent); |
|
226 IMPORT_C void SetColor(const TRgb &aRgb); |
|
227 IMPORT_C virtual TInt ConstructWin(const class CTWinBase&); |
|
228 IMPORT_C virtual const RWindowBase *BaseWin()const; |
|
229 IMPORT_C virtual RWindowBase *BaseWin(); |
|
230 inline const RBlankWindow *BlankWin()const; |
|
231 inline RBlankWindow *BlankWin(); |
|
232 IMPORT_C void SetExt(const TPoint &aPos, const TSize &aSize); |
|
233 IMPORT_C void SetSize(const TSize &aSize); |
|
234 protected: |
|
235 RBlankWindow iWin; |
|
236 }; |
|
237 |
|
238 class CTWindowGroup : public CTWinBase |
|
239 { |
|
240 public: |
|
241 IMPORT_C CTWindowGroup(CTClient *aClient); |
|
242 IMPORT_C ~CTWindowGroup(); |
|
243 IMPORT_C virtual void ConstructL(); |
|
244 IMPORT_C void WinKeyL(const TKeyEvent &aKey,const TTime &aTime); |
|
245 IMPORT_C virtual TSize Size() const; |
|
246 IMPORT_C RWindowTreeNode *WinTreeNode(); |
|
247 IMPORT_C const RWindowTreeNode *WinTreeNode() const; |
|
248 inline RWindowGroup *GroupWin(); |
|
249 IMPORT_C virtual void KeyL(const TKeyEvent &aKey,const TTime &aTime); |
|
250 IMPORT_C virtual void KeyUpL(const TKeyEvent &aKey,const TTime &aTime); |
|
251 IMPORT_C virtual void KeyDownL(const TKeyEvent &aKey,const TTime &aTime); |
|
252 IMPORT_C virtual void PasswordL(const TTime &aTime); |
|
253 IMPORT_C virtual void MessageReady(const TWsEvent &aTime); |
|
254 IMPORT_C virtual void ScreenDeviceChanged(); |
|
255 IMPORT_C virtual void UserEvent(TInt aEventType); |
|
256 IMPORT_C void SetCurrentWindow(CTBaseWin *aWindow); |
|
257 IMPORT_C void SetCurrentWindow(CTBaseWin *aWindow,TBool aLocked); |
|
258 IMPORT_C CTBaseWin *CurWin(void) const; |
|
259 IMPORT_C void FocusLost(); |
|
260 IMPORT_C void FocusGained(); |
|
261 IMPORT_C TBool HasFocus(CTBaseWin *aWin) const; |
|
262 IMPORT_C virtual CTWindowGroup *Group() const; |
|
263 IMPORT_C virtual CTClient *Client() const; |
|
264 IMPORT_C void ClearCurrentWindow(); |
|
265 protected: |
|
266 CTClient *iClient; |
|
267 CTBaseWin *iCurWin; |
|
268 RWindowGroup iGroupWin; |
|
269 TBool iLocked; |
|
270 TBool iFocus; |
|
271 }; |
|
272 |
|
273 inline RWindowGroup *CTWindowGroup::GroupWin() |
|
274 {return(&iGroupWin);} |
|
275 |
|
276 class CTEventBase : public CActive |
|
277 { |
|
278 public: |
|
279 IMPORT_C CTEventBase(RWsSession *aWs, TInt aPriority); |
|
280 IMPORT_C ~CTEventBase(); |
|
281 IMPORT_C void Construct(); |
|
282 void SetCancelFunction(const TCallBack &aCallBack); |
|
283 virtual void Request()=0; |
|
284 inline TInt Count() {return iCount;} |
|
285 protected: |
|
286 virtual void doRunL()=0; |
|
287 IMPORT_C void RunL(); |
|
288 IMPORT_C void CancelHandler(); |
|
289 protected: |
|
290 TBool iCancelRequested; |
|
291 TCallBack iCancelCallBack; |
|
292 RWsSession *iWs; |
|
293 TInt iCount; |
|
294 }; |
|
295 |
|
296 class CTRedraw : public CTEventBase |
|
297 { |
|
298 public: |
|
299 IMPORT_C CTRedraw(RWsSession *aWs); |
|
300 IMPORT_C ~CTRedraw(); |
|
301 IMPORT_C void Request(); |
|
302 protected: |
|
303 IMPORT_C void DoCancel(); |
|
304 IMPORT_C void doRunL(); |
|
305 }; |
|
306 |
|
307 class TlibWsEvent : public TWsEvent |
|
308 { |
|
309 public: |
|
310 IMPORT_C CTWindowGroup *WindowGroup(); |
|
311 IMPORT_C CTBaseWin *BaseWin(); |
|
312 }; |
|
313 |
|
314 class CTEvent : public CTEventBase |
|
315 { |
|
316 public: |
|
317 IMPORT_C CTEvent(RWsSession *aWs); |
|
318 IMPORT_C ~CTEvent(); |
|
319 IMPORT_C void Request(); |
|
320 IMPORT_C virtual void LogEvent(const TWsEvent &aEvent); |
|
321 protected: |
|
322 IMPORT_C void DoCancel(); |
|
323 IMPORT_C void doRunL(); |
|
324 }; |
|
325 |
|
326 class CTClient : public CBase |
|
327 { |
|
328 public: |
|
329 IMPORT_C CTClient(); |
|
330 IMPORT_C ~CTClient(); |
|
331 IMPORT_C virtual void ConstructL(); |
|
332 IMPORT_C virtual void ConstructEventHandlerL(); |
|
333 IMPORT_C void DestroyWindows(); |
|
334 IMPORT_C TWindowTitle *Title(); |
|
335 IMPORT_C void ResetFocus(); |
|
336 IMPORT_C TBool QueueRead(); |
|
337 IMPORT_C void CancelRead(); |
|
338 IMPORT_C void CancelRedrawRead(); |
|
339 IMPORT_C void SetCancelFunction(const TCallBack &aCallBack); |
|
340 IMPORT_C void SetRedrawCancelFunction(const TCallBack &aCallBack); |
|
341 IMPORT_C void RequestRedraw(); |
|
342 IMPORT_C void LogMessage(const TLogMessageText &aMessage); |
|
343 inline void Flush() {iWs.Flush();} |
|
344 inline void SetScreenNumber(TInt aScreenNumber); |
|
345 IMPORT_C TBool IsEventWaiting(); |
|
346 IMPORT_C TBool WaitUntilEventPending(); |
|
347 IMPORT_C TBool WaitUntilRedrawPending(); |
|
348 inline CTEvent* EventHandler(); |
|
349 inline CTRedraw* RedrawHandler(); |
|
350 IMPORT_C TInt WaitForRedrawsToFinish(); |
|
351 IMPORT_C TInt WaitForAllEventProcessingToFinish(); |
|
352 private: |
|
353 TBool WaitUntilEventPending(const TRequestStatus& aStatus); |
|
354 TInt WaitForEventsToFinish(TBool aAll); |
|
355 protected: |
|
356 CTEvent *iEventHandler; |
|
357 CTRedraw *iRedrawEventHandler; |
|
358 public: |
|
359 CWindowGc *iGc; |
|
360 CTWindowGroup *iGroup; |
|
361 RWsSession iWs; |
|
362 CWsScreenDevice *iScreen; |
|
363 protected: |
|
364 TWindowTitle iTitle; |
|
365 TInt iScreenNumber; |
|
366 }; |
|
367 |
|
368 class CTAutoKey; |
|
369 class CTDialog : public CTTitledWindow |
|
370 { |
|
371 public: |
|
372 enum |
|
373 { |
|
374 EDialogWaitForButtonUp=0x0001, |
|
375 EDialogDisplayAtBottom=0x0002, |
|
376 EDialogDisplayAtLeft=0x0008, |
|
377 }; |
|
378 public: |
|
379 IMPORT_C CTDialog(); |
|
380 IMPORT_C ~CTDialog(); |
|
381 IMPORT_C void ConstructLD(CTWinBase &aParent, CWindowGc &aGc); |
|
382 IMPORT_C void Draw(); |
|
383 IMPORT_C void WinKeyL(const TKeyEvent &aKey,const TTime &aTime); |
|
384 IMPORT_C void PointerL(const TPointerEvent &aPointer,const TTime &aTime); |
|
385 IMPORT_C virtual void ButtonPressL(TInt aButton); |
|
386 IMPORT_C void SetLine1(const TDesC &aLine1); |
|
387 IMPORT_C void SetLine2(const TDesC &aLine2); |
|
388 IMPORT_C void SetNumButtons(TInt aNum); |
|
389 IMPORT_C void SetButtonText(TInt aNum,const TDesC &aButton); |
|
390 IMPORT_C void SetWindowSize(); |
|
391 IMPORT_C void RelinquishFocus(); |
|
392 IMPORT_C TInt Display(); |
|
393 IMPORT_C void SetFlags(TUint aFlags); |
|
394 protected: |
|
395 void SetResult(TInt aButton); |
|
396 inline void SetTakeFocus() {iTakeFocus=ETrue;} |
|
397 private: |
|
398 void SetMaxWid(TInt &aMax, TInt aWid); |
|
399 TRect ButtonRect(TInt aIndex) const; |
|
400 private: |
|
401 TBool iIsActive; |
|
402 TBool iActivated; |
|
403 TBool iWinActive; |
|
404 TBool iTakeFocus; |
|
405 TInt iNumButtons; |
|
406 TInt iButWid; |
|
407 CTBaseWin *iOldFocus; |
|
408 TInt *iResultPtr; |
|
409 TBuf<0x40> iLine1; |
|
410 TBuf<0x40> iLine2; |
|
411 TBuf<0x20> iButton[3]; |
|
412 TInt iButtonClickOn; |
|
413 TUint iFlags; |
|
414 CTAutoKey* iAutoKey; |
|
415 }; |
|
416 |
|
417 class CInfoDialog : public CTDialog |
|
418 { |
|
419 private: |
|
420 enum |
|
421 { |
|
422 eSeconds=1000000, |
|
423 eTimes=6, |
|
424 }; |
|
425 public: |
|
426 IMPORT_C CInfoDialog(CTWindowGroup *aGroupWin,CWindowGc *aGc); |
|
427 IMPORT_C void ConstructLD(); |
|
428 IMPORT_C void TimerResults(); |
|
429 //Virtual function from CTDialog |
|
430 IMPORT_C void ButtonPressL(TInt aButton); |
|
431 private: |
|
432 void AppendProfileTime(TDes &aDes, TInt aNum); |
|
433 void AppendProfileCount(TDes &aDes, TInt aNum); |
|
434 void AddComma(TDes &aDes); |
|
435 private: |
|
436 CTWindowGroup *iGroupWin; |
|
437 CWindowGc *iGc; |
|
438 }; |
|
439 |
|
440 class CEventWindow : public CTWin |
|
441 { |
|
442 public: |
|
443 IMPORT_C CEventWindow(TInt aLogSize); |
|
444 IMPORT_C ~CEventWindow(); |
|
445 IMPORT_C void ConstructL(CTWinBase &parent); |
|
446 IMPORT_C void SetUpL(const TPoint &pos, CTWinBase *parent, CWindowGc &aGc); |
|
447 IMPORT_C void Draw(); |
|
448 IMPORT_C void WinKeyL(const TKeyEvent &,const TTime &aTime); |
|
449 IMPORT_C void LogEvent(const TWsEvent &aEvent); |
|
450 private: |
|
451 void DrawLine(TInt aLine, const TDesC &aText); |
|
452 void LogEvent(TInt aLogNum, const TWsEvent &aEvent); |
|
453 private: |
|
454 TInt iLineHeight; |
|
455 TInt iCount; |
|
456 TInt iLogSize; |
|
457 TInt iNumLogged; |
|
458 TWsEvent *iLoggedEvents; |
|
459 }; |
|
460 |
|
461 class CBlankWindow : public CTWin |
|
462 { |
|
463 public: |
|
464 IMPORT_C CBlankWindow(TRgb aCol); |
|
465 IMPORT_C CBlankWindow(); |
|
466 IMPORT_C void ConstructL(CTWinBase &parent); |
|
467 IMPORT_C void SetColor(TRgb aColor); |
|
468 IMPORT_C void RealDraw(TBool aRealDraw); |
|
469 IMPORT_C virtual void Draw(); |
|
470 IMPORT_C void DrawNow(); |
|
471 IMPORT_C void DrawNow(TRect& aRect); |
|
472 IMPORT_C TBool Check(const CTClient& aClient); |
|
473 protected: |
|
474 TRgb iCol; |
|
475 TBool iRealDraw; |
|
476 }; |
|
477 |
|
478 struct TSpriteCreateParams; |
|
479 |
|
480 class CTSpriteBase : public CBase |
|
481 { |
|
482 public: |
|
483 typedef void (*TSpriteDrawFunction)(CBitmapContext *aGc,TInt aIndex, const TSize &aSize, TBool aDoMask, TAny *aParam); |
|
484 protected: |
|
485 virtual RWsSpriteBase &SpriteBase()=0; |
|
486 void CreateBitmapL(CFbsBitmap *&aBitmap, CFbsBitmapDevice *&aBitmapDevice, TSpriteCreateParams *aParams, TBool aDoMask); |
|
487 public: |
|
488 IMPORT_C void UpdateL(TInt aIndex, TSpriteCreateParams *aParams); |
|
489 IMPORT_C void RedrawL(CFbsBitmap *&aBitmap, CFbsBitmap *&aMaskBitmap, TSpriteCreateParams *aParams); |
|
490 }; |
|
491 |
|
492 class CTSprite : public CTSpriteBase |
|
493 { |
|
494 public: |
|
495 IMPORT_C CTSprite(RWsSession &aWs); |
|
496 IMPORT_C ~CTSprite(); |
|
497 IMPORT_C void ConstructL(RWindowTreeNode &aWindow, const TPoint &aPos, TInt aCount, TSpriteCreateParams *aParams, TInt aFlags); |
|
498 IMPORT_C RWsSpriteBase &SpriteBase(); |
|
499 IMPORT_C RWsSprite &Sprite(); |
|
500 private: |
|
501 RWsSprite iSprite; |
|
502 }; |
|
503 |
|
504 class CTPointerCursor : public CTSpriteBase |
|
505 { |
|
506 public: |
|
507 IMPORT_C CTPointerCursor(RWsSession &aWs); |
|
508 IMPORT_C ~CTPointerCursor(); |
|
509 IMPORT_C void ConstructL(TInt aFlags); |
|
510 IMPORT_C void ConstructL(TInt aCount, TSpriteCreateParams *aParams, TInt aFlags, CFbsBitmap *&aBitmap, CFbsBitmap *&aMaskBitmap); |
|
511 IMPORT_C void ConstructL(TInt aCount, TSpriteCreateParams *aParams, TInt aFlags); |
|
512 IMPORT_C RWsSpriteBase &SpriteBase(); |
|
513 IMPORT_C RWsPointerCursor &PointerCursor(); |
|
514 private: |
|
515 RWsPointerCursor iCursor; |
|
516 }; |
|
517 |
|
518 struct TSpriteCreateParams |
|
519 { |
|
520 public: |
|
521 IMPORT_C TSpriteCreateParams(TSize aSize,TPoint aOffset,CTSpriteBase::TSpriteDrawFunction aDrawFunc,TAny *aDrawFuncParam=NULL, TBool aMask=ETrue,CGraphicsContext::TDrawMode aDrawMode=CGraphicsContext::EDrawModePEN); |
|
522 IMPORT_C TSpriteCreateParams(); |
|
523 public: |
|
524 TSize iSize; |
|
525 TPoint iOffset; |
|
526 CTSpriteBase::TSpriteDrawFunction iDrawFunc; |
|
527 TAny *iDrawFuncParam; |
|
528 TBool iMask; |
|
529 CGraphicsContext::TDrawMode iDrawMode; |
|
530 TTimeIntervalMicroSeconds32 iInterval; |
|
531 }; |
|
532 |
|
533 class CTUser |
|
534 { |
|
535 public: |
|
536 IMPORT_C static void Splat(CTClient *aClient, const TRect &aRect, const TRgb &aRgb); |
|
537 }; |
|
538 |
|
539 IMPORT_C void DisplayDialog(const TWindowTitle &aTitle, const TDesC &aLine1, const TDesC &aLine2, const RWindowGroup *aGroup=NULL); |
|
540 IMPORT_C void DisplayDialog(TInt aScreenNumber,const TWindowTitle &aTitle, const TDesC &aLine1, const TDesC &aLine2, const RWindowGroup *aGroup=NULL); |
|
541 IMPORT_C void DisplayDialog(CTClient *aClient, const TWindowTitle &aTitle, const TDesC &aLine1, const TDesC &aLine2); |
|
542 IMPORT_C TInt TestLibStartUp(TCreateClientFunc aFunc); |
|
543 IMPORT_C TInt TestLibStartUp(TCreateClientFunc aFunc,TInt aScreenNumber); |
|
544 |
|
545 |
|
546 inline TRgb CTTitledWindow::Color() |
|
547 {return(iWinColor);} |
|
548 inline CWindowGc *CTBaseWin::Gc() |
|
549 {return(iGc);} |
|
550 inline RWindow *CTWin::Win() const |
|
551 {return((RWindow *)BaseWin());} |
|
552 inline const RBlankWindow *CTBlankWindow::BlankWin()const |
|
553 {return(&iWin);} |
|
554 inline RBlankWindow *CTBlankWindow::BlankWin() |
|
555 {return(&iWin);} |
|
556 inline void CTClient::SetScreenNumber(TInt aScreenNumber) |
|
557 {iScreenNumber=aScreenNumber;} |
|
558 inline CTEvent* CTClient::EventHandler() |
|
559 {return iEventHandler;} |
|
560 inline CTRedraw* CTClient::RedrawHandler() |
|
561 {return iRedrawEventHandler;} |
|
562 #endif |