uiresources_plat/layout_data_api/inc/AknLayout2ScalableDef.h
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef AKNLAYOUT2SCALABLEDEF_H
       
    20 #define AKNLAYOUT2SCALABLEDEF_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <avkon.hrh>
       
    24 
       
    25 #include "AknLayout2Def.h"
       
    26 
       
    27 class TAknLayoutRect;
       
    28 
       
    29 /* 
       
    30  * this is in global namespace, as it needs to be used by multiple different classes
       
    31  */
       
    32 enum TAknLayoutScalableComponentType 
       
    33 	{ 
       
    34 	EAknLayoutScalableComponentTypeUnknown, 
       
    35 	EAknLayoutScalableComponentTypeScreen, 
       
    36 	EAknLayoutScalableComponentTypeContainer, 
       
    37 	EAknLayoutScalableComponentTypePane, 
       
    38 	EAknLayoutScalableComponentTypeGraphic, 
       
    39 	EAknLayoutScalableComponentTypeText
       
    40 	};
       
    41 
       
    42 /**
       
    43 * Defines the valid range of a table lookup index.
       
    44 * A table index is valid if it satisfies iFirstIndex <= index <= iLastIndex
       
    45 */
       
    46 class TAknLayoutScalableTableLimits
       
    47 	{
       
    48 public:
       
    49 	IMPORT_C TAknLayoutScalableTableLimits();
       
    50 	IMPORT_C TAknLayoutScalableTableLimits(TInt aFirstIndex, TInt aLastIndex);
       
    51 	IMPORT_C TAknLayoutTableLimits LayoutLimits() const;
       
    52 
       
    53 	IMPORT_C TInt FirstIndex() const;
       
    54 	IMPORT_C TInt LastIndex() const;
       
    55 	IMPORT_C void SetFirstIndex(TInt aIndex);
       
    56 	IMPORT_C void SetLastIndex(TInt aIndex);
       
    57 private:
       
    58 	TInt iFirstIndex;
       
    59 	TInt iLastIndex;
       
    60 	};
       
    61 
       
    62 /**
       
    63 * Defines the valid maximum value of the parameters that can be passed into a scalable layout API
       
    64 * An index is valid if it satisfies index < iMaxVarietys etc
       
    65 */
       
    66 class TAknLayoutScalableParameterLimits
       
    67 	{
       
    68 public:
       
    69 	IMPORT_C TAknLayoutScalableParameterLimits();
       
    70 	IMPORT_C TAknLayoutScalableParameterLimits(
       
    71 		TInt aFirstVariety, TInt aLastVariety, 
       
    72 		TInt aFirstColumn, TInt aLastColumn, 
       
    73 		TInt aFirstRow, TInt aLastRow);
       
    74 
       
    75 	IMPORT_C TInt FirstVariety() const;
       
    76 	IMPORT_C TInt LastVariety() const;
       
    77 	IMPORT_C TInt FirstColumn() const;
       
    78 	IMPORT_C TInt LastColumn() const;
       
    79 	IMPORT_C TInt FirstRow() const;
       
    80 	IMPORT_C TInt LastRow() const;
       
    81 	IMPORT_C void SetFirstVariety(TInt FirstVariety);
       
    82 	IMPORT_C void SetLastVariety(TInt LastVariety);
       
    83 	IMPORT_C void SetFirstColumn(TInt aFirstColumn);
       
    84 	IMPORT_C void SetLastColumn(TInt aLastColumn);
       
    85 	IMPORT_C void SetFirstRow(TInt aFirstRow);
       
    86 	IMPORT_C void SetLastRow(TInt aLastRow);
       
    87 private:
       
    88 	TInt iFirstVariety;
       
    89 	TInt iLastVariety;
       
    90 	TInt iFirstColumn;
       
    91 	TInt iLastColumn;
       
    92 	TInt iFirstRow;
       
    93 	TInt iLastRow;
       
    94 	};
       
    95 
       
    96 
       
    97 class TAknTextComponentLayout;
       
    98 struct TAknTextComponentLayoutAttrs;
       
    99 class TAknTextLineLayout;
       
   100 /**
       
   101 * A window component structure from scalable layout.
       
   102 *
       
   103 * The data members of this class have the following invariants which must be preserved in any methods
       
   104 * of this class.
       
   105 *
       
   106 *  il + iW + ir = parentRect.Width()
       
   107 *  it + iH + ib = parentRect.Height()
       
   108 *
       
   109 * The data format of the data members are as follows: (AknLayoutUtils knows this)
       
   110 *  any of il,iW,ir, it,iH,ib may be one of the following
       
   111 *    1) coordinate value
       
   112 *    2) ELayoutEmpty
       
   113 *    3) ELayoutP - value
       
   114 */
       
   115 class TAknWindowComponentLayout
       
   116 	{
       
   117 public:
       
   118 	/**
       
   119 	 * contructor
       
   120 	 *
       
   121 	 */
       
   122 	IMPORT_C TAknWindowComponentLayout();
       
   123 
       
   124 	/*
       
   125 	 * create a layout line using the old layout API structure
       
   126 	 * 
       
   127 	 * @return layout line
       
   128 	 */
       
   129 	IMPORT_C TAknWindowLineLayout LayoutLine() const;
       
   130 	
       
   131 	/*
       
   132 	 * create a layout line using the old layout API structure
       
   133 	 * such that the values are all non-empty
       
   134 	 * 
       
   135 	 * @return layout line
       
   136 	 */
       
   137 	IMPORT_C TAknWindowLineLayout LayoutLineNoEmptys() const;
       
   138 	
       
   139 	/* 
       
   140 	 * Return the type of the component, as specified in the layout
       
   141 	 * Note that a TAknWindowComponentLayout is data layout 
       
   142 	 * compatible with TAknTextComponentLayout, and the actual
       
   143 	 * type can be accessed using this method before casting. 
       
   144 	 * However, casting to the wrong type may cause unexpected results.
       
   145 	 * 
       
   146 	 * @return the type of the component
       
   147 	 * 
       
   148 	 */
       
   149 	IMPORT_C TAknLayoutScalableComponentType LayoutComponentType() const;
       
   150 	
       
   151 private:
       
   152 	// note that the following get and set methods do not follow coding conventions
       
   153 	// this is to increase source compatibility with existing implementation
       
   154 	// that directly accesses the public members of the corresponding non-scalable
       
   155 	// data structures. also note that the parameter names don't follow coding conventions, 
       
   156 	// this is to maintain consistency with the layout specifications.
       
   157 	// also note that they are not inline so that they can be modified
       
   158 	// for dynamic layout calculation without breaking BC. 
       
   159 	IMPORT_C TInt16 C() const;
       
   160 	IMPORT_C TInt16 l() const;
       
   161 	IMPORT_C TInt16 t() const;
       
   162 	IMPORT_C TInt16 r() const;
       
   163 	IMPORT_C TInt16 b() const;
       
   164 	IMPORT_C TInt16 W() const;
       
   165 	IMPORT_C TInt16 H() const;
       
   166 	IMPORT_C void SetC(TInt16 aC);
       
   167 	IMPORT_C void Setl(TInt16 al);
       
   168 	IMPORT_C void Sett(TInt16 at);
       
   169 	IMPORT_C void Setr(TInt16 ar);
       
   170 	IMPORT_C void Setb(TInt16 ab);
       
   171 	IMPORT_C void SetW(TInt16 aW);
       
   172 	IMPORT_C void SetH(TInt16 aH);
       
   173 
       
   174 public:
       
   175 	/* 
       
   176 	 * Compose two window lines together
       
   177 	 * note that this is not commutative, line2 should lie inside line1
       
   178 	 *
       
   179 	 * Compose puts two layout lines together in the following way:
       
   180 	 *    TRect --aLine1--> TRect --aLine2--> TRect
       
   181 	 *  
       
   182 	 * becomes
       
   183 	 *    TRect --------result--------------> TRect
       
   184      *
       
   185 	 * The arrow direction points towards smaller rectangles. 
       
   186 	 *
       
   187 	 *  The rectangle in the middle gets hidden and is shared by aLine1 and aLine2 in such way that
       
   188 	 *  aLine1's child rectangle becomes parent rectangle of aLine2. 
       
   189 	 *
       
   190 	 * Compose() works pretty well with AknLayoutUtils. Here's two equivalent code pieces:
       
   191 	 *    1) Chain of 2 AknLayoutUtils calls
       
   192 	 *          TAknLayoutRect rect;
       
   193 	 *          rect.LayoutRect(parent1, AknLayoutScalable::xxxx1().LayoutLine());
       
   194 	 *          TAknLayoutRect rect2;
       
   195 	 *          rect2.LayoutRect(rect.Rect(), AknLayoutScalable::xxxx2().LayoutLine());
       
   196 	 *          ... use rect2.Rect()....
       
   197 	 *    2) Compose + one AknLayoutUtils call
       
   198 	 *         TAknWindowLineLayout combined = Compose(AknLayoutScalable::xxxx1(), AknLayoutScalable::xxxx2()).LayoutLine();
       
   199 	 *         TAknLayoutRect rect2;
       
   200 	 *         rect2.LayoutRect(parent1, combined);
       
   201 	 *         ... use rect2.Rect()...
       
   202 	 *
       
   203 	 *     The only differences between the two pieces of code is that the version (2)
       
   204 	 *     cannot use rect.Rect() for positioning any CCoeControl's or drawable elements.
       
   205 	 *     Compose() hides that rectangle completely and it is no longer accessible.
       
   206      *
       
   207 	 *     Compose() works without the parent rectangle! In the version (1), the
       
   208 	 *     parent rectangle must be provided at beginning. In version (2), the parent
       
   209 	 *     rectangle is provided after combining two layout lines; This property of Compose() allows
       
   210 	 *     us to use it in adaptation layer where parent rectangle is not always known.
       
   211      *     
       
   212 	 *  Compose() is associative. Compose(x,Compose(y,z)) == Compose(Compose(x,y),z).
       
   213 	 *
       
   214 	 *  Mathematically, Compose() corresponds to function composition for TRect f(TRect) -type functions.
       
   215      *
       
   216 	 *  Compose() implementation generates values for TAknWindowComponentLayout which are not coordinates:
       
   217 	 *     1) any of l,t,r,b,W,H may become ELayoutEmpty
       
   218 	 *     2) any of l,t,r,b,W,H may become ELayoutP - XX, where XX is some number.
       
   219      *   This is why the data members of TAknWindowComponentLayout (or TAknWindowLineLayout) should not be accessed.
       
   220      *   AknLayoutUtils and all related classes which access these values must handle these cases.
       
   221      *
       
   222 	 *  Compose() implementation preserves some invariants of TAknWindowComponentLayout
       
   223 	 *      l+W+r = p.W
       
   224 	 *      t+H+b = p.H
       
   225 	 * 
       
   226 	 * @param aLine1 window line
       
   227 	 * @param aLine2 window line
       
   228 	 */
       
   229     IMPORT_C static TAknWindowComponentLayout Compose(TAknWindowComponentLayout aLine1, TAknWindowComponentLayout aLine2);
       
   230 
       
   231 	/* 
       
   232 	 * compose a window line with a text line
       
   233 	 * note that this is not commutative, line2 should lie inside line1
       
   234 	 *
       
   235 	 * ComposeText puts two layout lines together in the following way:
       
   236 	 *    TRect --aLine1--> TRect --aLine2--> Text
       
   237 	 *  
       
   238 	 * becomes
       
   239 	 *    TRect --------result--------------> Text
       
   240 	 *
       
   241 	 * ComposeText() is associative. ComposeText(x,ComposeText(y,z)) = ComposeText(Compose(x,y),z).
       
   242 	 *
       
   243 	 * @param aLine1 window line
       
   244 	 * @param aLine2 text line
       
   245 	 */
       
   246     IMPORT_C static TAknTextComponentLayout ComposeText(TAknWindowComponentLayout aLine1, TAknTextComponentLayout aLine2);
       
   247 
       
   248 	/*
       
   249 	 * intersect two layout lines that share the same parent rectangle
       
   250 	 *
       
   251  	 * Intersect combines two layout lines in such way that
       
   252      *   a) their parent rectangles will become the same rectangle
       
   253 	 *   b) the child rectangle is intersection of the child rectangles of aLine and aLine2
       
   254 	 *
       
   255      * Intersect can fail if the rectangles have no overlap. This can be detected by negative
       
   256 	 * values in resulting TAknWindowComponentLayout.
       
   257 	 *
       
   258 	 * @param aLine
       
   259 	 * @param aLine2
       
   260 	 */
       
   261     IMPORT_C static TAknWindowComponentLayout Intersect(TAknWindowComponentLayout aLine, TAknWindowComponentLayout aLine2);
       
   262 
       
   263 	/**
       
   264 	 * subtract two layout lines relative to the same parent rectangle
       
   265 	 *
       
   266  	 * Minus combines two layout lines in such way that
       
   267      *   a) the result is aLine with it's parent rectangle changed
       
   268 	 *   b) aLine and aParentDiff's parent rectangles becomes the same; and result's parent rectangle is calculated to be aParentDiff's child rectangle.
       
   269 	 *
       
   270 	 * @param aLine the inner rect
       
   271 	 * @param aParentDiff the difference between the parent and the inner rect
       
   272 	 */
       
   273     IMPORT_C static TAknWindowComponentLayout Minus(TAknWindowComponentLayout aLine, TAknWindowComponentLayout aParentDiff);
       
   274     
       
   275     /**
       
   276      * Treat two layout lines as if one is a child of the other. 
       
   277      * The two layouts must have the same parent.
       
   278      * They must also have the same pattern of absolute, ElayoutEmptys and Parent relative
       
   279      * measurements, both vertically and horizontally.
       
   280      * 
       
   281 	 * @param aSiblingTreatedAsParent
       
   282 	 * @param aSiblingTreatedAsChild
       
   283      * 
       
   284      * @return a layout representing aSiblingTreated as child, relative to aSiblingTreatedAsParent 
       
   285      */
       
   286     IMPORT_C static TAknWindowComponentLayout SiblingAsChild(TAknWindowComponentLayout aSiblingTreatedAsParent, TAknWindowComponentLayout aSiblingTreatedAsChild);
       
   287 
       
   288     /**
       
   289     * Makes the window zero-sized, positioned in the top left corner.
       
   290     */
       
   291     IMPORT_C void SetZeroSized();
       
   292         
       
   293 	/**
       
   294      * This method splits parent rectangle to one of the 9 pieces based on aLine.
       
   295 	 *
       
   296 	 *  aValue is one of the numbers:
       
   297 	 *       0    1    2
       
   298 	 *       3    4    5
       
   299 	 *       6    7    8
       
   300      * This is highly related to "frames" in skins. This allows us to generate a skin frame definition
       
   301 	 * from a single TAknWindowComponentLayout.
       
   302   	 */
       
   303 	IMPORT_C static TAknWindowComponentLayout Split(TAknWindowComponentLayout aLine, TInt aValue);
       
   304 
       
   305 
       
   306 	/**
       
   307 	 * This method calculates a grid item position in based on first cell.
       
   308 	 *
       
   309 	 */
       
   310 	IMPORT_C static TAknWindowComponentLayout MultiLineGrid(TAknWindowComponentLayout aFirst, TInt aColumnIndex, TInt aRowIndex, TInt aGapBetweenColumns, TInt aGapBetweenRows);
       
   311 	/**
       
   312 	 * This method calculates a grid item position in X-dimension based on first cell.
       
   313 	 *
       
   314 	 */
       
   315 	IMPORT_C static TAknWindowComponentLayout MultiLineX(TAknWindowComponentLayout aFirst, TInt aColumnIndex, TInt aGapBetweenColumns);
       
   316 	/**
       
   317      * This method calculates a list item position based on first item.
       
   318 	 * This can be used to calculate either list item positions or grid cell Y-positions.
       
   319 	 */
       
   320 	IMPORT_C static TAknWindowComponentLayout MultiLineY(TAknWindowComponentLayout aFirst, TInt aItemIndex, TInt aGapBetweenItems);
       
   321 
       
   322 public:
       
   323 	struct TRangeTriplet;
       
   324     IMPORT_C static TAknWindowComponentLayout Anim(TAknWindowComponentLayout aLine, 
       
   325 											TAknWindowComponentLayout aLine2, 
       
   326 											const TRangeTriplet &aTriplet);
       
   327 	IMPORT_C TAknWindowComponentLayout( TAknWindowLineLayout aLine );
       
   328 
       
   329     IMPORT_C TAknWindowComponentLayout operator=( TAknWindowLineLayout aLine );
       
   330 
       
   331 
       
   332 public:
       
   333 static void FormFieldHack(TAknWindowComponentLayout &aLayout) { aLayout.SetH(ELayoutEmpty); }
       
   334     static void ListGenPaneHack(TAknWindowComponentLayout &aLayout) { aLayout.Setl(0); aLayout.Sett(0); }
       
   335 	static TAknWindowComponentLayout ListPaneHack(const TAknWindowComponentLayout &aLayout, const TAknWindowComponentLayout aListGenPane)
       
   336 		{
       
   337 		TAknWindowComponentLayout layout = aLayout;
       
   338 		TAknWindowComponentLayout l3 = aListGenPane; // 0 = find pane on
       
   339 
       
   340 	TAknWindowComponentLayout &aLine1 = layout;	
       
   341 	if (aLine1.r() == ELayoutEmpty)
       
   342         {
       
   343         aLine1.Setr( TInt16(ELayoutP - aLine1.W() - aLine1.l()));
       
   344         }
       
   345     if (aLine1.b() == ELayoutEmpty)
       
   346         {
       
   347         aLine1.Setb(TInt16(ELayoutP - aLine1.H() - aLine1.t()));
       
   348         }
       
   349 
       
   350     if (aLine1.l() == ELayoutEmpty)
       
   351         {
       
   352         aLine1.Setl(TInt16(ELayoutP - aLine1.W() - aLine1.r()));
       
   353         }
       
   354     if (aLine1.t() == ELayoutEmpty)
       
   355         {
       
   356         aLine1.Sett(TInt16(ELayoutP - aLine1.H() - aLine1.b()));
       
   357         }
       
   358     if (aLine1.W() == ELayoutEmpty)
       
   359         {
       
   360         aLine1.SetW(TInt16(ELayoutP - aLine1.l() - aLine1.r()));
       
   361         }
       
   362     if (aLine1.H() == ELayoutEmpty)
       
   363         {
       
   364         aLine1.SetH(TInt16(ELayoutP - aLine1.t() - aLine1.b()));
       
   365         }
       
   366 
       
   367 		
       
   368 		layout.il = TInt16(layout.il + l3.il);
       
   369 		layout.it = TInt16(layout.it + l3.it);
       
   370 		layout.ib = ELayoutEmpty;
       
   371 		layout.ir = ELayoutEmpty;
       
   372 		return layout;
       
   373 		}
       
   374 		
       
   375 	// this is a method to get the arrowhead scroll indicators working.
       
   376 	// aDirection is the nudge button direction, 1 = up, 2 = down.
       
   377 	static void ScrollIndicatorHack( const TAknWindowComponentLayout& aWidthHeightLayout,
       
   378 									 TAknWindowComponentLayout& aParent,
       
   379 									 TAknWindowComponentLayout& aLayout,
       
   380 									 TInt aDirection)
       
   381 		{
       
   382 		aParent.SetW( aWidthHeightLayout.W() );
       
   383 	
       
   384 		aLayout.Setl( aParent.W() / 2 - aParent.W() / 39 );
       
   385 		if (aDirection == 0)
       
   386 			{
       
   387 			aLayout.Sett( 0 );
       
   388 			aLayout.SetH( ( aWidthHeightLayout.H() - aParent.t() ) / 2);
       
   389 			}
       
   390 		else
       
   391 			{
       
   392 			aLayout.Sett( ( aWidthHeightLayout.H() - aParent.t() ) / 2 );
       
   393 			aLayout.SetH( ( aWidthHeightLayout.H() - aParent.t() ) / 2 );
       
   394 			}
       
   395 			
       
   396 		aLayout.SetW( aParent.W() - 2 * aLayout.l() );
       
   397 		}
       
   398 							
       
   399 private:
       
   400     // structural information
       
   401     TInt16 iFirstChildID;
       
   402     TInt16 iNextSiblingID;
       
   403     TInt16 iParentID;
       
   404     TInt16 iParentVariety;
       
   405 
       
   406     TInt16 iAttributeSetID;
       
   407     TInt16 iType;
       
   408 
       
   409     // the following entries are the layout data
       
   410     TInt16 iC;
       
   411     TInt16 il;
       
   412     TInt16 it;
       
   413 
       
   414     TInt16 ir;
       
   415     TInt16 ib;
       
   416     TInt16 iW;
       
   417     TInt16 iH;
       
   418     
       
   419     // the following entries are to force this structure to be castable to TAknTextComponentLayout
       
   420     TInt16 iReserved1;
       
   421     TInt16 iReserved2;
       
   422     TInt16 iReserved3;
       
   423     
       
   424 private:
       
   425 	static TAknWindowComponentLayout RemoveLayoutEmptys(TAknWindowComponentLayout aLine1);
       
   426 	static TAknWindowComponentLayout ExtractWindow(TAknTextComponentLayout aText);
       
   427 	static TAknTextComponentLayout CombineAttrs(TAknWindowComponentLayout aLine1, const TAknTextComponentLayoutAttrs &aAttrs);
       
   428 	friend class TAknTextComponentLayout;
       
   429 
       
   430 public:
       
   431 struct TRangeTriplet
       
   432 {
       
   433 	TInt16 iX; // 0.0 .. 1.0, scaled by 12 bits.
       
   434 	TInt16 iY; // 0.0 .. 1.0
       
   435 	TInt16 iP;
       
   436 };
       
   437 
       
   438 private:
       
   439 class TScaledInt
       
   440 {
       
   441 public:
       
   442 	TScaledInt(TInt32 aValue) : iValue(aValue) { }
       
   443 
       
   444 	friend inline TScaledInt operator*(TScaledInt aValue, TScaledInt aValue2)
       
   445 	{
       
   446 	return TInt16( (aValue.Value() * aValue2.Value()) >> 12 );
       
   447 	}
       
   448 	
       
   449 	friend TScaledInt MultiplyByScaled(TInt16 aValue, TScaledInt aValue2)
       
   450 	{
       
   451 	return TInt32( TInt32(aValue) * TInt32(aValue2.Value()) );
       
   452     }
       
   453 	TInt16 NonScaled() { return TInt16(iValue >> 12); }
       
   454 
       
   455 	TInt32 Value() { return iValue; }
       
   456 
       
   457 private:
       
   458   TInt32 iValue;
       
   459 };
       
   460 static TInt16 MultiplyValue(TInt16 aValue, TScaledInt aMultiplier, TScaledInt aPMultiplier);
       
   461 
       
   462 
       
   463 struct TTriplet
       
   464 	{
       
   465 	TTriplet(const TTriplet &aValue);
       
   466 	TTriplet(TInt16 aX, TInt16 aY, TInt16 aP);
       
   467 	TScaledInt iX;
       
   468 	TScaledInt iY;
       
   469 	TScaledInt iP;
       
   470 	};
       
   471 static TAknWindowComponentLayout Multiply(TAknWindowComponentLayout aLine1, const TTriplet &aTriplet);
       
   472 static TTriplet FromRangeToTriplet(const TRangeTriplet &aRange);
       
   473 
       
   474 	};
       
   475 
       
   476 
       
   477 /**
       
   478 * A text component structure from layout.
       
   479 */
       
   480 class TAknTextComponentLayout
       
   481 	{
       
   482 public:
       
   483 	/**
       
   484 	 * contructor
       
   485 	 *
       
   486 	 */
       
   487 	IMPORT_C TAknTextComponentLayout();
       
   488 
       
   489 	/*
       
   490 	 * create a layout line using the old layout API structure
       
   491 	 * note that the B value will contain the b value and may be parent relative
       
   492 	 * note also that the fontId will be encoded
       
   493 	 * see AknFontSpecification and AknLayoutUtils for helper methods
       
   494 	 * 
       
   495 	 * @return layout line
       
   496 	 */
       
   497 	IMPORT_C TAknTextLineLayout LayoutLine() const;
       
   498 	IMPORT_C static TAknMultiLineTextLayout Multiline(const RArray<TAknTextComponentLayout> &aLayouts);
       
   499 
       
   500 	/*
       
   501 	 * create a layout line using the old layout API structure
       
   502 	 * such that the values are all non-empty
       
   503 	 * 
       
   504 	 * @return layout line
       
   505 	 */
       
   506 	IMPORT_C TAknTextLineLayout LayoutLineNoEmptys() const;
       
   507 
       
   508 	/* 
       
   509 	 * Return the type of the component, as specified in the layout
       
   510 	 * Note that a TAknWindowComponentLayout is data layout 
       
   511 	 * compatible with TAknTextComponentLayout, and the actual
       
   512 	 * type can be accessed using this method before casting. 
       
   513 	 * However, casting to the wrong type may cause unexpected results.
       
   514 	 * 
       
   515 	 * @return the type of the component
       
   516 	 * 
       
   517 	 */
       
   518 	IMPORT_C TAknLayoutScalableComponentType LayoutComponentType() const;
       
   519 
       
   520 public:
       
   521 	// note that the following get and set methods do not follow coding conventions
       
   522 	// this is to increase source compatibility with existing implementation
       
   523 	// that directly accesses the public members of the corresponding non-scalable
       
   524 	// data structures. also note that the parameter names don't follow coding conventions, 
       
   525 	// this is to maintain consistency with the layout specifications.
       
   526 	// also note that they are not inline so that they can be modified
       
   527 	// for dynamic layout calculation without breaking BC. 
       
   528 	IMPORT_C TInt16 C() const;
       
   529 	IMPORT_C TInt16 l() const;
       
   530 	IMPORT_C TInt16 t() const;
       
   531 	IMPORT_C TInt16 r() const;
       
   532 	IMPORT_C TInt16 b() const;
       
   533 	IMPORT_C TInt16 W() const;
       
   534 	IMPORT_C TInt16 H() const;
       
   535 	IMPORT_C TInt16 J() const;
       
   536     IMPORT_C TInt32 Font() const;
       
   537     IMPORT_C void SetC(TInt16 aC);
       
   538 	IMPORT_C void Setl(TInt16 al);
       
   539 	IMPORT_C void Sett(TInt16 at);
       
   540 	IMPORT_C void Setr(TInt16 ar);
       
   541 	IMPORT_C void Setb(TInt16 ab);
       
   542 	IMPORT_C void SetW(TInt16 aW);
       
   543 	IMPORT_C void SetH(TInt16 aH);
       
   544 	IMPORT_C void SetJ(TInt16 aJ);
       
   545     IMPORT_C void SetFont(TInt32 aFont);
       
   546 
       
   547 public:
       
   548 
       
   549     IMPORT_C static TAknTextComponentLayout Anim(TAknTextComponentLayout aLine,
       
   550 					    TAknTextComponentLayout aLine2, 
       
   551 						const TAknWindowComponentLayout::TRangeTriplet &aTriplet);
       
   552 
       
   553     
       
   554     /**
       
   555      * This method calculates a list item position based on first item.
       
   556      * This can be used to calculate list item positions.
       
   557      */
       
   558     IMPORT_C static TAknTextComponentLayout MultiLineY(TAknTextComponentLayout aFirst, TInt aItemIndex, TInt aGapBetweenItems);
       
   559     IMPORT_C TAknTextComponentLayout( TAknTextLineLayout aLine );
       
   560     IMPORT_C TAknTextComponentLayout operator=(TAknTextLineLayout aLine);
       
   561 
       
   562 public:
       
   563 
       
   564 	static TInt FormDataHack(TAknTextComponentLayout aLayout)
       
   565 		{ 
       
   566 		aLayout = RemoveLayoutEmptys(aLayout);
       
   567 		return ELayoutP - aLayout.it - aLayout.iH;
       
   568 		}
       
   569 	static void FormDataHack2(TAknTextComponentLayout &aLayout)
       
   570 		{ 
       
   571 		aLayout.ib = ELayoutEmpty;
       
   572 		}
       
   573 
       
   574 private:
       
   575     IMPORT_C static TAknTextComponentLayout RemoveLayoutEmptys(TAknTextComponentLayout aLayout);
       
   576 
       
   577 private:
       
   578     // structural information
       
   579     TInt16 iFirstChildID;
       
   580     TInt16 iNextSiblingID;
       
   581     TInt16 iParentID;
       
   582     TInt16 iParentVariety;
       
   583 
       
   584     TInt16 iAttributeSetID;
       
   585     TInt16 iType;
       
   586 
       
   587     // the following entries are the layout data
       
   588     TInt16 iC;
       
   589     TInt16 il;
       
   590     TInt16 it;
       
   591 
       
   592     TInt16 ir;
       
   593     TInt16 ib; // note that this is bottom, not baseline
       
   594     TInt16 iW;
       
   595     TInt16 iH;
       
   596     
       
   597     // the following entries are specific to text components
       
   598     TInt16 iJ;
       
   599     mutable TInt32 iFont;
       
   600     };
       
   601 
       
   602 
       
   603 
       
   604 #endif
       
   605 // End of File