sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: // Base classes definitions used for building window server test code
sl@0: // 
sl@0: //
sl@0: 
sl@0: #ifndef __TESTBASE_H__
sl@0: #define __TESTBASE_H__
sl@0: 
sl@0: enum TTlibActivePriorities
sl@0: 	{
sl@0: 	ETlibRedrawActivePriority=-10,
sl@0: 	ETlibWsEventActivePriority=0,
sl@0: 	};
sl@0: 
sl@0: const TInt KDefaultScreen = 0;
sl@0: 
sl@0: //enum {ENullWsHandle=0xFFFFFFFF};	// Events delivered to this handle are thrown away
sl@0: const TUint32 ENullWsHandle=0xFFFFFFFF;	// Events delivered to this handle are thrown away
sl@0: 
sl@0: typedef TBuf<KMaxFullName> TWindowTitle;
sl@0: typedef TBuf<0x100> TWinCommand;
sl@0: 
sl@0: const TUid KUidWServSecurityTesting={0x10205152};
sl@0: enum TWServSecTest
sl@0: 	{
sl@0: 	EWServSecTestBufferSecurity
sl@0: 	};
sl@0: 
sl@0: class CTClient;	// Forward reference
sl@0: class CTWindowGroup;
sl@0: class CTBaseWin;
sl@0: class CTWin;
sl@0: 
sl@0: typedef CTClient *(*TCreateClientFunc)();
sl@0: 
sl@0: IMPORT_C TBool CheckBlankWindow(TRect aArea,TRgb aColor,const CWsScreenDevice* aScreen);
sl@0: 
sl@0: class CTWinBase : public CBase
sl@0: 	{
sl@0: protected:
sl@0: public:
sl@0: 	IMPORT_C CTWinBase(TInt aType);
sl@0: 	IMPORT_C virtual TPoint Position() const;
sl@0: 	IMPORT_C virtual void PointerEnter(const TTime &aTime);
sl@0: 	IMPORT_C virtual void PointerExit(const TTime &aTime);
sl@0: 	IMPORT_C virtual void PointerBufferReady(const TTime &aTime);
sl@0: 	IMPORT_C virtual void PointerL(const TPointerEvent &aPointer,const TTime &aTime);
sl@0: 	IMPORT_C virtual void SwitchOn(const TTime &aTime);
sl@0: 	IMPORT_C virtual void ModifiersChanged(const TModifiersChangedEvent &aModifiersChanged ,const TTime &aTime);
sl@0: 	IMPORT_C virtual void ErrorMessage(const TWsErrorMessage &aErrorMessage, const TTime &aTime);
sl@0: 	IMPORT_C virtual void SetVisible(TBool aState);
sl@0: 	IMPORT_C CTWinBase *Parent() const;
sl@0: 	IMPORT_C CTWinBase *NextSibling() const;
sl@0: 	IMPORT_C CTWinBase *PrevSibling() const;
sl@0: 	IMPORT_C CTBaseWin *Child() const;
sl@0: 	IMPORT_C virtual void AdjustOrdinal(TInt adjust);
sl@0: 	IMPORT_C virtual void AdjustShadow(TInt aAdjust);
sl@0: 	IMPORT_C virtual TInt SubType();
sl@0: // Pure virtual definitions
sl@0: 	virtual void WinKeyL(const TKeyEvent &aKey,const TTime &aTime)=0;
sl@0: 	virtual TSize Size() const=0;
sl@0: 	virtual RWindowTreeNode *WinTreeNode()=0;
sl@0: 	virtual const RWindowTreeNode *WinTreeNode() const=0;
sl@0: 	IMPORT_C virtual CTClient *Client() const;
sl@0: 	virtual CTWindowGroup *Group() const=0;
sl@0: 	CTWindowGroup *iOwnerWin;
sl@0: public:
sl@0: 	TInt iType;
sl@0: 	__DECLARE_TEST;
sl@0: 	};
sl@0: 
sl@0: class CTBaseWin : public CTWinBase
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTBaseWin(TInt aType);
sl@0: 	IMPORT_C ~CTBaseWin();
sl@0: 	IMPORT_C virtual void ConstructL(CTWinBase &parent);
sl@0: 	IMPORT_C virtual void ConstructExtLD(CTWinBase &aParent, const TPoint &aPos, const TSize &aSize);
sl@0: 	virtual TInt ConstructWin(const CTWinBase &aWs)=0;
sl@0: 	IMPORT_C virtual void InitWin();
sl@0: 	IMPORT_C virtual void PointerL(const TPointerEvent &aPointer,const TTime &aTime);
sl@0: 	IMPORT_C virtual void DragDropL(const TPointerEvent &aPointer,const TTime &aTime);
sl@0: 	IMPORT_C virtual void RelinquishFocus();
sl@0: 	IMPORT_C void Activate();
sl@0: 	IMPORT_C virtual void AssignGC(CWindowGc &aGc);
sl@0: 	IMPORT_C CTBaseWin *Next();
sl@0: 	IMPORT_C CTBaseWin *Prev();
sl@0: 	IMPORT_C virtual void SetExtL(const TPoint &aPos, const TSize &aSize);
sl@0: 	IMPORT_C virtual void SetSizeL(const TSize &aSize);
sl@0: 	IMPORT_C virtual void SetPos(const TPoint &aPos);
sl@0: 	IMPORT_C void SetInitialPos(const TPoint &aPos);
sl@0: 	IMPORT_C virtual void SetDefaultExtL();
sl@0: 	IMPORT_C virtual void SetFullScreenExtL();
sl@0: 	IMPORT_C virtual void AdjustSizeL(TInt xMove,TInt yMove,TInt resize);
sl@0: 	IMPORT_C virtual TSize Size() const;
sl@0: 	IMPORT_C virtual void Draw();
sl@0: 	IMPORT_C void DrawBorder();
sl@0: //	void FillWindow(TInt inset);
sl@0: 	IMPORT_C virtual TPoint Position() const;
sl@0: 	IMPORT_C static void Delete(CTBaseWin *aWin);
sl@0: 	IMPORT_C void AdjustOrdinal(TInt aAdjust);
sl@0: 	IMPORT_C virtual void AdjustShadow(TInt aAdjust);
sl@0: 	IMPORT_C void SetVisible(TBool aState);
sl@0: 	IMPORT_C RWindowTreeNode *WinTreeNode();
sl@0: 	IMPORT_C const RWindowTreeNode *WinTreeNode() const;
sl@0: 	IMPORT_C virtual void WinKeyL(const TKeyEvent &aKey,const TTime &aTime);
sl@0: 	IMPORT_C virtual void KeyUpL(const TKeyEvent &aKey,const TTime &aTime);
sl@0: 	IMPORT_C virtual void KeyDownL(const TKeyEvent &aKey,const TTime &aTime);
sl@0: 	IMPORT_C virtual void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
sl@0: 	IMPORT_C virtual void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc, TDisplayMode *aMode);
sl@0: 	IMPORT_C void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc,TBool aVisible);
sl@0: 	enum 
sl@0: 		{
sl@0: 		ENoTransparency=0x100
sl@0: 		};
sl@0: 	IMPORT_C virtual void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc, TDisplayMode *aMode,TBool aVisible,TInt aTransparency=ENoTransparency);
sl@0: 	IMPORT_C void SetDragRect(const TRect &aRect);
sl@0: 	IMPORT_C virtual void Resized(const TSize &aSize);
sl@0: 	IMPORT_C virtual void FocusChanged(TBool aState);
sl@0: 	IMPORT_C virtual CTWindowGroup *Group() const;
sl@0: 	virtual RWindowBase *BaseWin()=0;
sl@0: 	virtual const RWindowBase *BaseWin() const=0;
sl@0: 	inline CWindowGc *Gc();
sl@0: protected:
sl@0: 	TSize iSize;
sl@0: 	CWindowGc *iGc;		   	// Not owned by the window, just using it
sl@0: 	TPoint iPos;
sl@0: 	TInt iShadow;
sl@0: 	TRect iDragRect;
sl@0: 	TBool iDragging;
sl@0: 	TPoint iDragPos;
sl@0: 	CFbsFont *iFont;
sl@0: 	__DECLARE_TEST;
sl@0: 	};
sl@0: 
sl@0: class CTDrawableWin : public CTBaseWin
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTDrawableWin(TInt aType);
sl@0: 	virtual RDrawableWindow *DrawableWin()=0;
sl@0: 	virtual const RDrawableWindow *DrawableWin() const=0;
sl@0: 	};
sl@0: 
sl@0: class CTWin : public CTDrawableWin
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTWin();
sl@0: 	IMPORT_C ~CTWin();
sl@0: 	inline RWindow *Win() const;
sl@0: 	IMPORT_C virtual TInt ConstructWin(const CTWinBase &aWs);
sl@0: 	IMPORT_C void Invalidate();
sl@0: 	IMPORT_C void Invalidate(const TRect &rect);
sl@0: 	IMPORT_C virtual void Redraw();
sl@0: 	IMPORT_C virtual void Redraw(const TRect &aRect);
sl@0: 	IMPORT_C void DrawNow();
sl@0: 	IMPORT_C void SetExt(const TPoint &aPos, const TSize &aSize);
sl@0: 	IMPORT_C void SetSize(const TSize &aSize);
sl@0: 	IMPORT_C void SetDefaultExt();
sl@0: 	IMPORT_C void AdjustSize(TInt xMove,TInt yMove,TInt resize);
sl@0: 	IMPORT_C virtual RWindowBase *BaseWin();
sl@0: 	IMPORT_C virtual const RWindowBase *BaseWin() const;
sl@0: 	IMPORT_C virtual RDrawableWindow *DrawableWin();
sl@0: 	IMPORT_C virtual const RDrawableWindow *DrawableWin() const;
sl@0: protected:
sl@0: 	RWindow iWin;
sl@0: 	__DECLARE_TEST;
sl@0: 	};
sl@0: 
sl@0: class CTBackedUpWin : public CTDrawableWin
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTBackedUpWin(TDisplayMode aDisplayMode);
sl@0: 	IMPORT_C ~CTBackedUpWin();
sl@0: 	IMPORT_C virtual TInt ConstructWin(const CTWinBase &aWs);
sl@0: 	IMPORT_C virtual RWindowBase *BaseWin();
sl@0: 	IMPORT_C virtual const RWindowBase *BaseWin() const;
sl@0: 	IMPORT_C virtual RDrawableWindow *DrawableWin();
sl@0: 	IMPORT_C virtual const RDrawableWindow *DrawableWin() const;
sl@0: 	IMPORT_C RBackedUpWindow *BackedUpWin();
sl@0: 	IMPORT_C const RBackedUpWindow *BackedUpWin() const;
sl@0: protected:
sl@0: 	RBackedUpWindow iWin;
sl@0: 	TDisplayMode iDisplayMode;
sl@0: 	__DECLARE_TEST;
sl@0: 	};
sl@0: 
sl@0: class CTTitledWindow : public CTWin
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTTitledWindow();
sl@0: 	IMPORT_C ~CTTitledWindow();
sl@0: 	IMPORT_C void ConstructL(CTWinBase &parent);
sl@0: 	IMPORT_C void Draw();
sl@0: 	IMPORT_C void FocusChanged(TBool aState);
sl@0: 	IMPORT_C void SetTitle(const TWindowTitle &aTitle);
sl@0: 	IMPORT_C void SetColor(TRgb aRgb);
sl@0: 	inline TRgb Color();
sl@0: private:
sl@0: 	IMPORT_C void Resized(const TSize &aSize);
sl@0: protected:
sl@0: 	TWindowTitle iTitle;
sl@0: 	TInt iTitleHeight;
sl@0: 	TBool iFocus;
sl@0: 	TRgb iWinColor;
sl@0: 	TRgb iPenColor;
sl@0: 	};
sl@0: 
sl@0: class CTBlankWindow : public CTBaseWin
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTBlankWindow();
sl@0: 	IMPORT_C ~CTBlankWindow();
sl@0: 	IMPORT_C void ConstructL(CTWinBase &aParent);
sl@0: 	IMPORT_C void SetColor(const TRgb &aRgb);
sl@0: 	IMPORT_C virtual TInt ConstructWin(const class CTWinBase&);
sl@0: 	IMPORT_C virtual const RWindowBase *BaseWin()const;
sl@0: 	IMPORT_C virtual RWindowBase *BaseWin();
sl@0: 	inline const RBlankWindow *BlankWin()const;
sl@0: 	inline RBlankWindow *BlankWin();
sl@0: 	IMPORT_C void SetExt(const TPoint &aPos, const TSize &aSize);
sl@0: 	IMPORT_C void SetSize(const TSize &aSize);
sl@0: protected:
sl@0: 	RBlankWindow iWin;
sl@0: 	};
sl@0: 
sl@0: class CTWindowGroup : public CTWinBase
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTWindowGroup(CTClient *aClient);
sl@0: 	IMPORT_C ~CTWindowGroup();
sl@0: 	IMPORT_C virtual void ConstructL();
sl@0: 	IMPORT_C void WinKeyL(const TKeyEvent &aKey,const TTime &aTime);
sl@0: 	IMPORT_C virtual TSize Size() const;
sl@0: 	IMPORT_C RWindowTreeNode *WinTreeNode();
sl@0: 	IMPORT_C const RWindowTreeNode *WinTreeNode() const;
sl@0: 	inline RWindowGroup *GroupWin();
sl@0: 	IMPORT_C virtual void KeyL(const TKeyEvent &aKey,const TTime &aTime);
sl@0: 	IMPORT_C virtual void KeyUpL(const TKeyEvent &aKey,const TTime &aTime);
sl@0: 	IMPORT_C virtual void KeyDownL(const TKeyEvent &aKey,const TTime &aTime);
sl@0: 	IMPORT_C virtual void PasswordL(const TTime &aTime);
sl@0: 	IMPORT_C virtual void MessageReady(const TWsEvent &aTime);
sl@0: 	IMPORT_C virtual void ScreenDeviceChanged();
sl@0: 	IMPORT_C virtual void UserEvent(TInt aEventType);
sl@0: 	IMPORT_C void SetCurrentWindow(CTBaseWin *aWindow);
sl@0: 	IMPORT_C void SetCurrentWindow(CTBaseWin *aWindow,TBool aLocked);
sl@0: 	IMPORT_C CTBaseWin *CurWin(void) const;
sl@0: 	IMPORT_C void FocusLost();
sl@0: 	IMPORT_C void FocusGained();
sl@0: 	IMPORT_C TBool HasFocus(CTBaseWin *aWin) const;
sl@0: 	IMPORT_C virtual CTWindowGroup *Group() const;
sl@0: 	IMPORT_C virtual CTClient *Client() const;
sl@0: 	IMPORT_C void ClearCurrentWindow();
sl@0: protected:
sl@0: 	CTClient *iClient;
sl@0: 	CTBaseWin *iCurWin;
sl@0: 	RWindowGroup iGroupWin;
sl@0: 	TBool iLocked;
sl@0: 	TBool iFocus;
sl@0: 	};
sl@0: 
sl@0: inline RWindowGroup *CTWindowGroup::GroupWin()
sl@0: 	{return(&iGroupWin);}
sl@0: 
sl@0: class CTEventBase : public CActive
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTEventBase(RWsSession *aWs, TInt aPriority);
sl@0: 	IMPORT_C ~CTEventBase();
sl@0: 	IMPORT_C void Construct();
sl@0: 	void SetCancelFunction(const TCallBack &aCallBack);
sl@0: 	virtual void Request()=0;
sl@0: 	inline TInt Count() {return iCount;}
sl@0: protected:
sl@0: 	virtual void doRunL()=0;
sl@0: 	IMPORT_C void RunL();
sl@0: 	IMPORT_C void CancelHandler();
sl@0: protected:
sl@0: 	TBool iCancelRequested;
sl@0: 	TCallBack iCancelCallBack;
sl@0: 	RWsSession *iWs;
sl@0: 	TInt iCount;
sl@0: 	};
sl@0: 
sl@0: class CTRedraw : public CTEventBase
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTRedraw(RWsSession *aWs);
sl@0: 	IMPORT_C ~CTRedraw();
sl@0: 	IMPORT_C void Request();
sl@0: protected:
sl@0: 	IMPORT_C void DoCancel();
sl@0: 	IMPORT_C void doRunL();
sl@0: 	};
sl@0: 
sl@0: class TlibWsEvent : public TWsEvent
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTWindowGroup *WindowGroup();
sl@0: 	IMPORT_C CTBaseWin *BaseWin();
sl@0: 	};
sl@0: 
sl@0: class CTEvent : public CTEventBase
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTEvent(RWsSession *aWs);
sl@0: 	IMPORT_C ~CTEvent();
sl@0: 	IMPORT_C void Request();
sl@0: 	IMPORT_C virtual void LogEvent(const TWsEvent &aEvent);
sl@0: protected:
sl@0: 	IMPORT_C void DoCancel();
sl@0: 	IMPORT_C void doRunL();
sl@0: 	};
sl@0: 
sl@0: class CTClient : public CBase
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTClient();
sl@0: 	IMPORT_C ~CTClient();
sl@0: 	IMPORT_C virtual void ConstructL();
sl@0: 	IMPORT_C virtual void ConstructEventHandlerL();
sl@0: 	IMPORT_C void DestroyWindows();
sl@0: 	IMPORT_C TWindowTitle *Title();
sl@0: 	IMPORT_C void ResetFocus();
sl@0: 	IMPORT_C TBool QueueRead();
sl@0: 	IMPORT_C void CancelRead();
sl@0: 	IMPORT_C void CancelRedrawRead();
sl@0: 	IMPORT_C void SetCancelFunction(const TCallBack &aCallBack);
sl@0: 	IMPORT_C void SetRedrawCancelFunction(const TCallBack &aCallBack);
sl@0: 	IMPORT_C void RequestRedraw();
sl@0: 	IMPORT_C void LogMessage(const TLogMessageText &aMessage);
sl@0: 	inline void Flush() {iWs.Flush();}
sl@0: 	inline void SetScreenNumber(TInt aScreenNumber);
sl@0: 	IMPORT_C TBool IsEventWaiting();
sl@0: 	IMPORT_C TBool WaitUntilEventPending();
sl@0: 	IMPORT_C TBool WaitUntilRedrawPending();
sl@0: 	inline CTEvent* EventHandler();
sl@0: 	inline CTRedraw* RedrawHandler();
sl@0: 	IMPORT_C TInt WaitForRedrawsToFinish();
sl@0: 	IMPORT_C TInt WaitForAllEventProcessingToFinish();
sl@0: private:
sl@0: 	TBool WaitUntilEventPending(const TRequestStatus& aStatus);
sl@0: 	TInt WaitForEventsToFinish(TBool aAll);
sl@0: protected:
sl@0: 	CTEvent *iEventHandler;
sl@0: 	CTRedraw *iRedrawEventHandler;
sl@0: public:
sl@0: 	CWindowGc *iGc;
sl@0: 	CTWindowGroup *iGroup;
sl@0: 	RWsSession iWs;
sl@0: 	CWsScreenDevice *iScreen;
sl@0: protected:
sl@0: 	TWindowTitle iTitle;
sl@0: 	TInt iScreenNumber;
sl@0: 	};
sl@0: 
sl@0: class CTAutoKey;
sl@0: class CTDialog : public CTTitledWindow
sl@0: 	{
sl@0: public:
sl@0: 	enum
sl@0: 		{
sl@0: 		EDialogWaitForButtonUp=0x0001,
sl@0: 		EDialogDisplayAtBottom=0x0002,
sl@0: 		EDialogDisplayAtLeft=0x0008,
sl@0: 		};
sl@0: public:
sl@0: 	IMPORT_C CTDialog();
sl@0: 	IMPORT_C ~CTDialog();
sl@0: 	IMPORT_C void ConstructLD(CTWinBase &aParent, CWindowGc &aGc);
sl@0: 	IMPORT_C void Draw();
sl@0: 	IMPORT_C void WinKeyL(const TKeyEvent &aKey,const TTime &aTime);
sl@0: 	IMPORT_C void PointerL(const TPointerEvent &aPointer,const TTime &aTime);
sl@0: 	IMPORT_C virtual void ButtonPressL(TInt aButton);
sl@0: 	IMPORT_C void SetLine1(const TDesC &aLine1);
sl@0: 	IMPORT_C void SetLine2(const TDesC &aLine2);
sl@0: 	IMPORT_C void SetNumButtons(TInt aNum);
sl@0: 	IMPORT_C void SetButtonText(TInt aNum,const TDesC &aButton);
sl@0: 	IMPORT_C void SetWindowSize();
sl@0: 	IMPORT_C void RelinquishFocus();
sl@0: 	IMPORT_C TInt Display();
sl@0: 	IMPORT_C void SetFlags(TUint aFlags);
sl@0: protected:
sl@0: 	void SetResult(TInt aButton);
sl@0: 	inline void SetTakeFocus() {iTakeFocus=ETrue;}
sl@0: private:
sl@0: 	void SetMaxWid(TInt &aMax, TInt aWid);
sl@0: 	TRect ButtonRect(TInt aIndex) const;
sl@0: private:
sl@0: 	TBool iIsActive;
sl@0: 	TBool iActivated;
sl@0: 	TBool iWinActive;
sl@0: 	TBool iTakeFocus;
sl@0: 	TInt iNumButtons;
sl@0: 	TInt iButWid;
sl@0: 	CTBaseWin *iOldFocus;
sl@0: 	TInt *iResultPtr;
sl@0: 	TBuf<0x40> iLine1;
sl@0: 	TBuf<0x40> iLine2;
sl@0: 	TBuf<0x20> iButton[3];
sl@0: 	TInt iButtonClickOn;
sl@0: 	TUint iFlags;
sl@0: 	CTAutoKey* iAutoKey;
sl@0: 	};
sl@0: 
sl@0: class CInfoDialog : public CTDialog
sl@0: 	{		  
sl@0: private:
sl@0: 	enum
sl@0: 		{
sl@0: 		eSeconds=1000000,
sl@0: 		eTimes=6,
sl@0: 		};
sl@0: public:
sl@0: 	IMPORT_C CInfoDialog(CTWindowGroup *aGroupWin,CWindowGc *aGc);
sl@0: 	IMPORT_C void ConstructLD();
sl@0: 	IMPORT_C void TimerResults();
sl@0: 	//Virtual function from CTDialog
sl@0: 	IMPORT_C void ButtonPressL(TInt aButton);
sl@0: private:
sl@0: 	void AppendProfileTime(TDes &aDes, TInt aNum);
sl@0: 	void AppendProfileCount(TDes &aDes, TInt aNum);
sl@0: 	void AddComma(TDes &aDes);
sl@0: private:
sl@0: 	CTWindowGroup *iGroupWin;
sl@0: 	CWindowGc *iGc;
sl@0: 	};
sl@0: 
sl@0: class CEventWindow : public CTWin
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CEventWindow(TInt aLogSize);
sl@0: 	IMPORT_C ~CEventWindow();
sl@0: 	IMPORT_C void ConstructL(CTWinBase &parent);
sl@0: 	IMPORT_C void SetUpL(const TPoint &pos, CTWinBase *parent, CWindowGc &aGc);
sl@0: 	IMPORT_C void Draw();
sl@0: 	IMPORT_C void WinKeyL(const TKeyEvent &,const TTime &aTime);
sl@0: 	IMPORT_C void LogEvent(const TWsEvent &aEvent);
sl@0: private:
sl@0: 	void DrawLine(TInt aLine, const TDesC &aText);
sl@0: 	void LogEvent(TInt aLogNum, const TWsEvent &aEvent);
sl@0: private:
sl@0: 	TInt iLineHeight;
sl@0: 	TInt iCount;
sl@0: 	TInt iLogSize;
sl@0: 	TInt iNumLogged;
sl@0: 	TWsEvent *iLoggedEvents;
sl@0: 	};
sl@0: 
sl@0: class CBlankWindow : public CTWin
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CBlankWindow(TRgb aCol);
sl@0: 	IMPORT_C CBlankWindow();
sl@0: 	IMPORT_C void ConstructL(CTWinBase &parent);
sl@0: 	IMPORT_C void SetColor(TRgb aColor);
sl@0: 	IMPORT_C void RealDraw(TBool aRealDraw);
sl@0: 	IMPORT_C virtual void Draw();
sl@0: 	IMPORT_C void DrawNow();
sl@0: 	IMPORT_C void DrawNow(TRect& aRect);
sl@0: 	IMPORT_C TBool Check(const CTClient& aClient);
sl@0: protected:
sl@0: 	TRgb iCol;
sl@0: 	TBool iRealDraw;
sl@0: 	};
sl@0: 
sl@0: struct TSpriteCreateParams;
sl@0: 
sl@0: class CTSpriteBase : public CBase
sl@0: 	{
sl@0: public:
sl@0: 	typedef void (*TSpriteDrawFunction)(CBitmapContext *aGc,TInt aIndex, const TSize &aSize, TBool aDoMask, TAny *aParam);
sl@0: protected:
sl@0: 	virtual RWsSpriteBase &SpriteBase()=0;
sl@0: 	void CreateBitmapL(CFbsBitmap *&aBitmap, CFbsBitmapDevice *&aBitmapDevice, TSpriteCreateParams *aParams, TBool aDoMask);
sl@0: public:
sl@0: 	IMPORT_C void UpdateL(TInt aIndex, TSpriteCreateParams *aParams);
sl@0: 	IMPORT_C void RedrawL(CFbsBitmap *&aBitmap, CFbsBitmap *&aMaskBitmap, TSpriteCreateParams *aParams);
sl@0: 	};
sl@0: 
sl@0: class CTSprite : public CTSpriteBase
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTSprite(RWsSession &aWs);
sl@0: 	IMPORT_C ~CTSprite();
sl@0: 	IMPORT_C void ConstructL(RWindowTreeNode &aWindow, const TPoint &aPos, TInt aCount, TSpriteCreateParams *aParams, TInt aFlags);
sl@0: 	IMPORT_C RWsSpriteBase &SpriteBase();
sl@0: 	IMPORT_C RWsSprite &Sprite();
sl@0: private:
sl@0: 	RWsSprite iSprite;
sl@0: 	};
sl@0: 
sl@0: class CTPointerCursor : public CTSpriteBase
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C CTPointerCursor(RWsSession &aWs);
sl@0: 	IMPORT_C ~CTPointerCursor();
sl@0: 	IMPORT_C void ConstructL(TInt aFlags);
sl@0: 	IMPORT_C void ConstructL(TInt aCount, TSpriteCreateParams *aParams, TInt aFlags, CFbsBitmap *&aBitmap, CFbsBitmap *&aMaskBitmap);
sl@0: 	IMPORT_C void ConstructL(TInt aCount, TSpriteCreateParams *aParams, TInt aFlags);
sl@0: 	IMPORT_C RWsSpriteBase &SpriteBase();
sl@0: 	IMPORT_C RWsPointerCursor &PointerCursor();
sl@0: private:
sl@0: 	RWsPointerCursor iCursor;
sl@0: 	};
sl@0: 
sl@0: struct TSpriteCreateParams
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C TSpriteCreateParams(TSize aSize,TPoint aOffset,CTSpriteBase::TSpriteDrawFunction aDrawFunc,TAny *aDrawFuncParam=NULL, TBool aMask=ETrue,CGraphicsContext::TDrawMode aDrawMode=CGraphicsContext::EDrawModePEN);
sl@0: 	IMPORT_C TSpriteCreateParams();
sl@0: public:
sl@0: 	TSize iSize;
sl@0: 	TPoint iOffset;
sl@0: 	CTSpriteBase::TSpriteDrawFunction iDrawFunc;
sl@0: 	TAny *iDrawFuncParam;
sl@0: 	TBool iMask;
sl@0: 	CGraphicsContext::TDrawMode iDrawMode;
sl@0: 	TTimeIntervalMicroSeconds32 iInterval;
sl@0: 	};
sl@0: 
sl@0: class CTUser
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C static void Splat(CTClient *aClient, const TRect &aRect, const TRgb &aRgb);
sl@0: 	};
sl@0: 
sl@0: IMPORT_C void DisplayDialog(const TWindowTitle &aTitle, const TDesC &aLine1, const TDesC &aLine2, const RWindowGroup *aGroup=NULL);
sl@0: IMPORT_C void DisplayDialog(TInt aScreenNumber,const TWindowTitle &aTitle, const TDesC &aLine1, const TDesC &aLine2, const RWindowGroup *aGroup=NULL);
sl@0: IMPORT_C void DisplayDialog(CTClient *aClient, const TWindowTitle &aTitle, const TDesC &aLine1, const TDesC &aLine2);
sl@0: IMPORT_C TInt TestLibStartUp(TCreateClientFunc aFunc);
sl@0: IMPORT_C TInt TestLibStartUp(TCreateClientFunc aFunc,TInt aScreenNumber);
sl@0: 
sl@0: 
sl@0: inline TRgb CTTitledWindow::Color()
sl@0: 	{return(iWinColor);}
sl@0: inline CWindowGc *CTBaseWin::Gc()
sl@0: 	{return(iGc);}
sl@0: inline RWindow *CTWin::Win() const
sl@0: 	{return((RWindow *)BaseWin());}
sl@0: inline const RBlankWindow *CTBlankWindow::BlankWin()const
sl@0: 	{return(&iWin);}
sl@0: inline RBlankWindow *CTBlankWindow::BlankWin()
sl@0: 	{return(&iWin);}
sl@0: inline void CTClient::SetScreenNumber(TInt aScreenNumber)
sl@0: 	{iScreenNumber=aScreenNumber;}
sl@0: inline CTEvent* CTClient::EventHandler()
sl@0: 	{return iEventHandler;}
sl@0: inline CTRedraw* CTClient::RedrawHandler()
sl@0: 	{return iRedrawEventHandler;}
sl@0: #endif