2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined(__EIKCAPCA_H__)
20 #define __EIKCAPCA_H__
24 class CEikCaptionedControl;
26 class CEikCapCArrayExtension;
28 class CEikCapCArray : public CArrayPtrFlat<CEikCaptionedControl>
33 * Creates CEikCapCArray with a granilarity.
35 * @param aGranularity how many items will be allocated each time allocation happens
37 IMPORT_C CEikCapCArray(TInt aGranularity);
41 * Destroys CEikCapCArray
43 IMPORT_C ~CEikCapCArray();
45 /** MinimumSize() returns minimum size for the array
47 * MinimumSize calculates minimum possible size for
48 * the captioned control array.
50 * @return size in pixels
52 IMPORT_C TSize MinimumSize();
54 /** SetRect() sets the rectangle of the captionedcontrolarray
56 * SetRect layouts the captionedcontrolarray. Captioned
57 * control rectangles are calculated based on provided rectangle
58 * and sizes of the captioned controls.
60 * @param aRect Rectangle for the whole array
62 IMPORT_C void SetRect(const TRect& aRect);
64 /** ResetMinimumSizes() clears size information
66 * ResetMinimumSizes goes through all captionedcontrols
67 * and resets the minimum size information of the
70 IMPORT_C void ResetMinimumSizes();
72 /** LineIndexFromId() provides line index in array based on id number
74 * Every captionedcontrol has iId and based on the id,
75 * LineIndexFromId goes through the captionedcontrolarray
76 * and finds the captionedcontrol's position in the array
77 * based on the id provided
79 * @param aControlId captionedcontrol's iId.
81 IMPORT_C TInt LineIndexFromId(TInt aControlId) const;
83 /** FindLineIndex() finds line index based on control
85 * Every captionedcontrol has iControl CCoeControl which
86 * implements the control for the DLG_LINE. FindLineIndex
87 * goes through all captionedcontrols and finds the one
88 * which has aControl as it's control.
90 * @param aControl control to be found
92 IMPORT_C TInt FindLineIndex(const CCoeControl* aControl) const;
94 /** DeleteLine() removes line from captionedcontrolarray
96 * Elements from CaptionedControlArray can be removed
97 * by calling DeleteLine method.
99 * @param aIndex index of the line to be removed
101 IMPORT_C void DeleteLine(TInt aIndex);
103 /** AdjustAllIds() modified iId fields of the captionedcontrols
105 * @param aControlIdDelta how much to increase or decrease control id's
107 IMPORT_C void AdjustAllIds(TInt aControlIdDelta);
109 /** SetDensePacking() sets dense packing flag
111 * @param aDensePacking whether dense packing flag is on
113 IMPORT_C void SetDensePacking(TBool aDensePacking);
114 TBool CalcItemIndexes(TInt &aTopItemIndex, TInt &aMiddleItems, TInt &aBottomItemIndex, TSize aAreaSize);
115 TInt NumberOfTextLines() const; // for scrollbar
116 TInt NumberOfTextLinesBeforeLine(TInt aLine) const;
117 TInt FindItemFromTextLine(TInt aTextLine) const;
119 void SetRect(const TRect& aRect, TInt aTop, TInt aMiddle, TInt aBottom);
120 TInt YPosToLine(const TRect &aRect, TInt aTop, TInt aMiddle, TInt aBottom, TInt aYCoord);
121 void CreateExtensionL();
122 CEikCapCArrayExtension *ExtensionOrNull() const;
125 * Scrolls each item by aDelta pixels in y direction.
127 TInt ScrollByPixels( TInt aDelta );
130 * Return the index of the line at aYPos.
132 TInt YPositionToLineIndex( TInt aYPos ) const;
135 * Returns line's top y coordinate.
137 TInt LineIndexToYPosition( TInt aLine, TInt aTopY ) const;
140 * Moves aLine to the visible screen area or out of it.
142 void MoveLineToScreen( TInt aLine, TInt aTopY, TBool aVisible );
146 * Positions controls in real locations.
148 void SetRealRect( const TRect& aRect, TInt aTop, TInt aBottom );
151 //TInt iCaptionWidth;
152 CEikCapCArrayExtension *iExtension;