lafagnosticuifoundation/cone/tef/TConeTransition.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2005-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  @internalComponent - Internal Symbian test code
       
    19 */
       
    20 
       
    21 #if !defined(__TCONETRANSITION_H__)
       
    22 #define __TCONETRANSITION_H__
       
    23 
       
    24 #include <coecntrl.h>
       
    25 #include "TConeTestServer.h"
       
    26 #include "appfwk_test_AppUi.h"
       
    27 //! A CCoeControl Derived Class.\n
       
    28 /** 
       
    29   Class is used to instantiate simple controls.\n 
       
    30   Also serves as base class for CTestControlGcTriangle Class.\n
       
    31 */
       
    32 class CTestControlGc : public CCoeControl
       
    33     {
       
    34 friend class CTestControlBackground;
       
    35 public:
       
    36     void virtual ConstructL(TPoint, TSize, TRgb aPenColor, TRgb aBrushColor, const TDesC &aControlName);
       
    37     ~CTestControlGc();
       
    38     void Draw(const TRect& aRect) const;
       
    39     void SupressOutput(TBool aSupressOutput) 
       
    40     	{
       
    41     	iSupressOutput = aSupressOutput;
       
    42     	}
       
    43 protected: 
       
    44 	// framework
       
    45 	void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
    46 private: // framework
       
    47 	void FocusChanged(TDrawNow aDrawNow);
       
    48 protected:	
       
    49 	//! Colour combination for Pen.\n
       
    50 	TRgb	iPenColor;
       
    51 	//! Colour combination for Brush.\n
       
    52 	TRgb	iBrushColor;
       
    53 	//! Boolean to indicate whether the control should be drawn or not.\n
       
    54 	TBool 	iSupressOutput;
       
    55 	//! Name of the control.\n
       
    56 	TBuf<128>	iControlName;
       
    57     };
       
    58 //! A Class derived from CTestControlGc and MCoeControlHitTest interface.\n
       
    59 /**
       
    60   Implements the MCoeControlHitTest interface.\n
       
    61 */
       
    62 class CTestControlGcTriangle : public CTestControlGc
       
    63 			, public MCoeControlHitTest
       
    64     {
       
    65 public:
       
    66     void virtual ConstructL(TPoint, TSize, TBool aTop, TRgb aPenColor, TRgb aBrushColor, const TDesC &aControlName);
       
    67     ~CTestControlGcTriangle();
       
    68     void Draw(const TRect& aRect) const;
       
    69 protected:    
       
    70 	TBool HitRegionContains(const TPoint& aPoint, const CCoeControl& aControl) const;
       
    71 	TBool IsInside(const TPoint& pt) const;
       
    72 protected:
       
    73 	CArrayFix<TPoint>* iPoints;
       
    74     };
       
    75 //! A Class derived from CTestControlGc.\n
       
    76 /**
       
    77   Class used to test offscreen bitmap drawing.\n
       
    78 */
       
    79 class CTestControlImageGc : public CTestControlGc
       
    80     {
       
    81 public:
       
    82     ~CTestControlImageGc()
       
    83     	{
       
    84     	};
       
    85     void Draw(const TRect& aRect) const;
       
    86     void SetBitmap(CFbsBitmap* aBmp) 
       
    87     	{
       
    88     	iBmp = aBmp;
       
    89     	}
       
    90 protected:
       
    91 	//!A bitmap managed by the font and bitmap server.\n  
       
    92 	CFbsBitmap* iBmp;
       
    93     };
       
    94 
       
    95 //! A Class derived from CCoeControl and MCoeControlBackground interface.\n
       
    96 /**
       
    97   A Class implementing background drawing interface.\n
       
    98 */
       
    99 class CTestControlBackground : public CCoeControl
       
   100 								, public MCoeControlBackground
       
   101     {
       
   102 public:
       
   103     void ConstructL();
       
   104     ~CTestControlBackground();
       
   105     TInt SetChildGc();
       
   106 	void RestoreChildGc();
       
   107 	void ClearOffScreenBitmap();
       
   108 	void SetControlParent();
       
   109 	void SupressOutput(TInt aNumControl, TBool aSupress);
       
   110 	void GeneratePointerEventsOnControl1L();
       
   111 	void GeneratePointerEventsOnControl2L();
       
   112 	void GeneratePointerEventsOnControl3L();
       
   113 	TInt OffScreenDrawing();
       
   114 	TInt DirectScreenDrawing();
       
   115 	
       
   116 protected:
       
   117 	// MCoeControlBackground
       
   118 	void Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const;
       
   119 private: // framework
       
   120 	void FocusChanged(TDrawNow aDrawNow);
       
   121     void Draw(const TRect& aRect) const;
       
   122 private: // new functions
       
   123     void DrawBorder() const;
       
   124 	
       
   125 	TInt CountComponentControls() const;
       
   126 	CCoeControl* ComponentControl(TInt aIndex) const;
       
   127 private:
       
   128 	//! Simple control.\n 
       
   129     CTestControlGc*	iControl;
       
   130     //! Control implementing MCoeControlHitTest interface.\n
       
   131     CTestControlGcTriangle*	iControl2;
       
   132     //! Control implementing MCoeControlHitTest interface.\n
       
   133     CTestControlGcTriangle*	iControl3;
       
   134     //! Control with an bitmap.\n
       
   135     CTestControlImageGc*	iControlImage;
       
   136 	//! Window graphics context.\n
       
   137     CWindowGc* iGraphContext;
       
   138     //! Font and Bitmap server Graphic Context.\n
       
   139     CFbsBitGc* iMainFbsBitGc;
       
   140 	//! A graphics device to which a bitmap managed by the font and bitmap server can be drawn.\n
       
   141     CFbsBitmapDevice* iBitmapDevice2;
       
   142     //! Window server bitmap.\n
       
   143 	CWsBitmap *iBitmapView;
       
   144 	//!A bitmap managed by the font and bitmap server.\n
       
   145 	CFbsBitmap* iBmpBackground;
       
   146     };
       
   147 
       
   148 
       
   149 //! A CTestStep Derived Class.\n
       
   150 /**
       
   151   Incorporates the tests on direct screen and offscrreen bitmap drawing.\n
       
   152 */
       
   153 class CTConeTransitionStep : public CTmsTestStep
       
   154 	{
       
   155 public:
       
   156 	CTConeTransitionStep();
       
   157 	~CTConeTransitionStep();
       
   158 	virtual TVerdict doTestStepL();
       
   159 	void ConstructAppL(CCoeEnv* aCoe);
       
   160 
       
   161 private:
       
   162 	};
       
   163 //! A CTestCoeAppUi derived class.\n
       
   164 /**
       
   165   AppUi Class for TConeTransition test step.\n
       
   166 */	
       
   167 class CTConeTransitionAppUi : public CTestCoeAppUi
       
   168     {
       
   169 friend class CTestControlBackground;
       
   170 friend class CTestControlGc;
       
   171 public:
       
   172 	CTConeTransitionAppUi(CTmsTestStep* aStep);
       
   173 	~CTConeTransitionAppUi();
       
   174 	void ConstructL();
       
   175 private: // from CCoeAppUi
       
   176     TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   177 private: // utility
       
   178 	void RunTestStepL(TInt aStepNum);
       
   179 public:
       
   180 	TBuf<128>	iExpectedControlName;
       
   181 protected:
       
   182 	//! Control which supports background drawing.\n
       
   183 	CTestControlBackground* iViewControl;
       
   184     };
       
   185 
       
   186 //! TConeTransition Test Step Name.\n
       
   187 _LIT(KTConeTransitionStep,"TConeTransition");
       
   188 
       
   189 #endif
       
   190 
       
   191