windowing/windowserver/test/t_stress/inc/compwin.h
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2008-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent
       
    20 */
       
    21 
       
    22 #ifndef COMPWIN_H
       
    23 #define COMPWIN_H
       
    24 
       
    25 #include <w32std.h>
       
    26 #include "test_step_conf.h"
       
    27 
       
    28 //common configuration parameter names
       
    29 _LIT(KT_WservStressParamEnabled, "enabled");
       
    30 _LIT(KT_WservStressParamTransparent, "transparent");
       
    31 _LIT(KT_WservStressParamRandomizeAlpha, "randomize_alpha");
       
    32 _LIT(KT_WservStressParamRandomizePenStyle, "randomize_pen_style");
       
    33 _LIT(KT_WservStressParamRandomizeBrushStyle, "randomize_brush_style");
       
    34 _LIT(KT_WservStressParamTransparentForegroundWindow, "transparent_foreground_window");
       
    35 
       
    36 
       
    37 /*******************************************************************************
       
    38 Base class for all windows in this test.
       
    39 *******************************************************************************/
       
    40 _LIT8(KCommonWindowType, "Common");
       
    41 class CCompWin : public CBase
       
    42 	{
       
    43 public:
       
    44 	static CCompWin* NewLC(RWsSession& aWs, RWindowGroup* aGroup, CCompWin* aParent, CWindowGc& aGc);
       
    45 	static void LoadConfiguration(const MTestStepConfigurationContext* aContext);
       
    46 	~CCompWin();
       
    47 	
       
    48 	TInt NumChildren() { return iChildren.Count(); }
       
    49 	RDrawableWindow * Window() { return iWindow; }
       
    50 	const TSize Size() const { return iSize; }
       
    51 	const TPoint Pos() const { return iPos; }
       
    52 	virtual void SetPos(const TPoint & aPos);
       
    53 	virtual void SetSize(const TSize & aSize);
       
    54 	CCompWin * CCompWin::RandomWindow();
       
    55 	void AddChildL(CCompWin* aChild);
       
    56 	void RemoveChild(CCompWin* aChild);
       
    57 	void HandleRedraw(TWsRedrawEvent& aEvent);
       
    58 	void SendToBackL();
       
    59 	void BringToFrontL();
       
    60 	void Dump(RFile & aFile, TPoint & aOrigin, TInt aDepth, CCompWin * aMark);
       
    61 	virtual void DumpDetails(RFile & aFile, TInt aDepth);
       
    62 	virtual void Redraw(const TRect& aRect) = 0;
       
    63 	virtual void DrawBitmap(CFbsBitGc* aGc, TRect& aClip, TPoint& aOrigin);
       
    64 	virtual void ClearBitmapBackground(CFbsBitGc* aGc, TRect& aClip, TPoint& aOrigin);
       
    65 	virtual const TDesC8& TypeName() { return KCommonWindowType; }
       
    66 	//If a window has been modified in TickL it should return ETrue
       
    67 	virtual TBool TickL() { return EFalse; }
       
    68 	virtual void ToggleVisible();
       
    69 	virtual TBool QueryReadyForVerification();
       
    70 	virtual void SubSelfFromRegion(TRegion& aRegion, const TRect& aClip, const TPoint& aOrigin);
       
    71 	virtual TRgb BackgroundColor() { return TRgb(0, sBackgroundAlpha); }
       
    72 	TBool IsVisible() { return iVisible; }
       
    73 	void SetVerifyTick(TUint32 aTick);
       
    74 	
       
    75 protected:
       
    76 	CCompWin(RWsSession& aWs, RWindowGroup* aGroup, CCompWin* aParent, CWindowGc& aGc);
       
    77 	void PreConstructL(TBool aTransparency = ETrue, TBool aBackedup = EFalse);
       
    78 	void PostConstructL();
       
    79 	static CGraphicsContext::TDrawMode GetRandomDrawMode();
       
    80 	static CGraphicsContext::TPenStyle GetRandomPenStyle();
       
    81 	static CGraphicsContext::TBrushStyle GetRandomBrushStyle();
       
    82 protected:
       
    83 	static TInt sBackgroundAlpha;
       
    84 	RWsSession& iWs;
       
    85 	RWindowGroup* iGroup;
       
    86 	CCompWin* iParent;
       
    87 	CWindowGc& iWsGc;
       
    88 	RDrawableWindow* iWindow;
       
    89 	RWindow* iRedrawWindow;
       
    90 	RBackedUpWindow* iBackedupWindow;
       
    91 	RPointerArray<CCompWin> iChildren;
       
    92 	TPoint iPos;
       
    93 	TSize iSize;
       
    94 	TBool iVisible;
       
    95 	TUint32 iVerifyTick;
       
    96 	};
       
    97 
       
    98 #endif // COMPWIN_H