lafagnosticuifoundation/cone/tef/TCone5Step.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 // Testing of function CalcTextBaselineOffset introduced by PREQ527
       
    15 // Testing of function CalcTextBaselineOffset introduced by PREQ527
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent - Internal Symbian test code
       
    22  @SYMPREQ PREQ527
       
    23  @file
       
    24  @internalComponent
       
    25  @SYMPREQ PREQ527
       
    26 */
       
    27 
       
    28 #if !defined(__TCONE5STEP_H__)
       
    29 #define __TCONE5STEP_H__
       
    30 
       
    31 #include <coecntrl.h>
       
    32 #include <coelayoutman.h>
       
    33 #include <test/testexecutestepbase.h>
       
    34 #include "TConeTestServer.h"
       
    35 #include "appfwk_test_AppUi.h"
       
    36 //! A CTestStep Derived Class.\n
       
    37 
       
    38 /**   Incorporates the tests on Control Layout Manager support.\n  */
       
    39 
       
    40 class CTCone5Step : public CTmsTestStep
       
    41 	{
       
    42 public:
       
    43 	CTCone5Step();
       
    44 	~CTCone5Step();
       
    45 	virtual TVerdict doTestStepL();
       
    46 	void ConstructCone5AppL(CCoeEnv* aCoe);
       
    47 private:
       
    48 	};
       
    49 
       
    50 //! A Class derived from CObject and MCoeLayoutManager interface.\n
       
    51 
       
    52 /**  Implements the MCoeLayoutManager interface.\n */
       
    53 
       
    54 class CLayoutTest : public CObject, public MCoeLayoutManager
       
    55 	{
       
    56 public:
       
    57 
       
    58 	~CLayoutTest();
       
    59 
       
    60 	virtual TBool CanAttach() const;
       
    61 	virtual void AttachL(CCoeControl& aCompoundControl);
       
    62 	virtual void Detach(CCoeControl& aCompoundControl);
       
    63 	virtual TSize CalcMinimumSize(const CCoeControl& aCompoundControl) const;
       
    64 	virtual void PerformLayout();
       
    65 	virtual TInt CalcTextBaselineOffset(const CCoeControl& aCompoundControl, 
       
    66 		const TSize& aSize) const;
       
    67 	virtual void SetTextBaselineSpacing(TInt aBaselineSpacing);
       
    68 	virtual TInt TextBaselineSpacing() const;
       
    69 	virtual void HandleAddedControlL(const CCoeControl& aCompoundControl, const CCoeControl& aAddedControl);
       
    70 	virtual void HandleRemovedControl(const CCoeControl& aCompoundControl, const CCoeControl& aRemovedControl);
       
    71 	virtual TInt HandleControlReplaced(const CCoeControl& aOldControl, const CCoeControl& aNewControl);
       
    72 
       
    73 	TUint LayoutsPerformed() const;
       
    74 	
       
    75 private:
       
    76 	void  LayoutRow(TInt& aCurCtrlIndex);
       
    77 	void  FindRectangle();
       
    78 	TInt  LayoutControl(TUint aCurCtrlIndex, TSize aCtrlSize);
       
    79 	TBool SpaceForControl(TUint aMaxHeight);
       
    80 	
       
    81 private:
       
    82 	//! array containing list of component controls.\n
       
    83 	RPointerArray<CCoeControl> iCtrlArray;
       
    84 	//! Index of the Control which owns the Window.\n
       
    85 	TUint iWinOwningCtrlIndex;
       
    86 	//! Window size already allocated to controls.\n
       
    87 	TSize iSizeUsed;
       
    88 	//! Rectange to be used for allocating Controls.\n
       
    89 	TRect iLayoutRect;
       
    90 	//! Boolean to indicate if Layout is in progress.\n 
       
    91 	TBool iLayoutInProgress;
       
    92 	//! Number of controls for which layout is done.\n
       
    93 	TUint iControlsCompleted;
       
    94 	//! Number of Layouts performed.\n
       
    95 	TUint iLayoutsPerformed;
       
    96 	};
       
    97 	
       
    98 
       
    99 
       
   100 //
       
   101 //
       
   102 // CTest5Control
       
   103 //
       
   104 //
       
   105 //! A CCoeControl derived class.\n
       
   106 
       
   107 /**   The class is used to create component controls.\n */
       
   108 
       
   109 class CTest5Control : public CCoeControl
       
   110     {
       
   111 public:
       
   112 	static CTest5Control* NewL(CLayoutTest* aLayoutMan, 
       
   113 		CCoeControl& aContainer, const TRect& aRect);
       
   114 	~CTest5Control();
       
   115     
       
   116 private:
       
   117 	CTest5Control();
       
   118 	void ConstructL(CLayoutTest* aLayoutMan, CCoeControl& aContainer, 
       
   119     			    const TRect& aRect);
       
   120     // Inherited from CCoeControl
       
   121 	void Draw(const TRect& /*aRect*/) const;
       
   122     };
       
   123 
       
   124 
       
   125 //
       
   126 //
       
   127 // CLayoutTestAppView
       
   128 //
       
   129 //
       
   130 //! A CCoeControl derived class.\n
       
   131 
       
   132 /**   View Class for TCone5Step.\n */
       
   133 
       
   134 class CLayoutTestAppView : public CCoeControl
       
   135     {
       
   136 public:
       
   137 	static CLayoutTestAppView* NewL(CLayoutTest* aLayoutMan, const TRect& aRect);
       
   138 	
       
   139 	~CLayoutTestAppView();
       
   140 	virtual TBool RequestRelayout(const CCoeControl* aChildControl);
       
   141 	const RPointerArray<CTest5Control>& CtrlArray() const;
       
   142     
       
   143     
       
   144 protected:
       
   145 	CCoeControl* ComponentControl(TInt aIndex) const;
       
   146 	TInt CountComponentControls() const;
       
   147 private:
       
   148 	CLayoutTestAppView();
       
   149 	void ConstructL(CLayoutTest* aLayoutMan, const TRect& aRect);
       
   150     // Inherited from CCoeControl
       
   151 	void Draw(const TRect& /*aRect*/) const;
       
   152 
       
   153 private:
       
   154 	//! Array containing list of component controls.\n
       
   155 	RPointerArray<CTest5Control> iCtrlArray;
       
   156     };
       
   157 
       
   158 
       
   159 
       
   160 //! A CTestCoeAppUi derived class.\n
       
   161 
       
   162 /**   AppUi Class for TCone5Step.\n */
       
   163 
       
   164 class CCone5TestAppUi : public CTestCoeAppUi
       
   165     {
       
   166 public:
       
   167 	CCone5TestAppUi(CTmsTestStep* aStep);
       
   168     ~CCone5TestAppUi();
       
   169     void ConstructL();
       
   170 	void DoTestsL();
       
   171 protected:
       
   172 	void RunTestStepL(TInt aStepNum);
       
   173 	
       
   174 private:
       
   175 	CLayoutTestAppView* iTestAppView;
       
   176 	CLayoutTest* 		iLayoutMan;
       
   177    	};
       
   178 
       
   179 //! TCone5 Test Step Name.\n
       
   180 _LIT(KTCone5Step,"TCone5");
       
   181 
       
   182 #endif
       
   183 
       
   184