os/graphics/windowing/windowserver/test/t_stress/inc/compwin.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/t_stress/inc/compwin.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,98 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent
    1.23 +*/
    1.24 +
    1.25 +#ifndef COMPWIN_H
    1.26 +#define COMPWIN_H
    1.27 +
    1.28 +#include <w32std.h>
    1.29 +#include "test_step_conf.h"
    1.30 +
    1.31 +//common configuration parameter names
    1.32 +_LIT(KT_WservStressParamEnabled, "enabled");
    1.33 +_LIT(KT_WservStressParamTransparent, "transparent");
    1.34 +_LIT(KT_WservStressParamRandomizeAlpha, "randomize_alpha");
    1.35 +_LIT(KT_WservStressParamRandomizePenStyle, "randomize_pen_style");
    1.36 +_LIT(KT_WservStressParamRandomizeBrushStyle, "randomize_brush_style");
    1.37 +_LIT(KT_WservStressParamTransparentForegroundWindow, "transparent_foreground_window");
    1.38 +
    1.39 +
    1.40 +/*******************************************************************************
    1.41 +Base class for all windows in this test.
    1.42 +*******************************************************************************/
    1.43 +_LIT8(KCommonWindowType, "Common");
    1.44 +class CCompWin : public CBase
    1.45 +	{
    1.46 +public:
    1.47 +	static CCompWin* NewLC(RWsSession& aWs, RWindowGroup* aGroup, CCompWin* aParent, CWindowGc& aGc);
    1.48 +	static void LoadConfiguration(const MTestStepConfigurationContext* aContext);
    1.49 +	~CCompWin();
    1.50 +	
    1.51 +	TInt NumChildren() { return iChildren.Count(); }
    1.52 +	RDrawableWindow * Window() { return iWindow; }
    1.53 +	const TSize Size() const { return iSize; }
    1.54 +	const TPoint Pos() const { return iPos; }
    1.55 +	virtual void SetPos(const TPoint & aPos);
    1.56 +	virtual void SetSize(const TSize & aSize);
    1.57 +	CCompWin * CCompWin::RandomWindow();
    1.58 +	void AddChildL(CCompWin* aChild);
    1.59 +	void RemoveChild(CCompWin* aChild);
    1.60 +	void HandleRedraw(TWsRedrawEvent& aEvent);
    1.61 +	void SendToBackL();
    1.62 +	void BringToFrontL();
    1.63 +	void Dump(RFile & aFile, TPoint & aOrigin, TInt aDepth, CCompWin * aMark);
    1.64 +	virtual void DumpDetails(RFile & aFile, TInt aDepth);
    1.65 +	virtual void Redraw(const TRect& aRect) = 0;
    1.66 +	virtual void DrawBitmap(CFbsBitGc* aGc, TRect& aClip, TPoint& aOrigin);
    1.67 +	virtual void ClearBitmapBackground(CFbsBitGc* aGc, TRect& aClip, TPoint& aOrigin);
    1.68 +	virtual const TDesC8& TypeName() { return KCommonWindowType; }
    1.69 +	//If a window has been modified in TickL it should return ETrue
    1.70 +	virtual TBool TickL() { return EFalse; }
    1.71 +	virtual void ToggleVisible();
    1.72 +	virtual TBool QueryReadyForVerification();
    1.73 +	virtual void SubSelfFromRegion(TRegion& aRegion, const TRect& aClip, const TPoint& aOrigin);
    1.74 +	virtual TRgb BackgroundColor() { return TRgb(0, sBackgroundAlpha); }
    1.75 +	TBool IsVisible() { return iVisible; }
    1.76 +	void SetVerifyTick(TUint32 aTick);
    1.77 +	
    1.78 +protected:
    1.79 +	CCompWin(RWsSession& aWs, RWindowGroup* aGroup, CCompWin* aParent, CWindowGc& aGc);
    1.80 +	void PreConstructL(TBool aTransparency = ETrue, TBool aBackedup = EFalse);
    1.81 +	void PostConstructL();
    1.82 +	static CGraphicsContext::TDrawMode GetRandomDrawMode();
    1.83 +	static CGraphicsContext::TPenStyle GetRandomPenStyle();
    1.84 +	static CGraphicsContext::TBrushStyle GetRandomBrushStyle();
    1.85 +protected:
    1.86 +	static TInt sBackgroundAlpha;
    1.87 +	RWsSession& iWs;
    1.88 +	RWindowGroup* iGroup;
    1.89 +	CCompWin* iParent;
    1.90 +	CWindowGc& iWsGc;
    1.91 +	RDrawableWindow* iWindow;
    1.92 +	RWindow* iRedrawWindow;
    1.93 +	RBackedUpWindow* iBackedupWindow;
    1.94 +	RPointerArray<CCompWin> iChildren;
    1.95 +	TPoint iPos;
    1.96 +	TSize iSize;
    1.97 +	TBool iVisible;
    1.98 +	TUint32 iVerifyTick;
    1.99 +	};
   1.100 +
   1.101 +#endif // COMPWIN_H