|
1 /* |
|
2 * Copyright (c) 1997-2009 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 #if !defined(__EIKCAPCA_H__) |
|
20 #define __EIKCAPCA_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class CEikCaptionedControl; |
|
25 class CCoeControl; |
|
26 class CEikCapCArrayExtension; |
|
27 |
|
28 class CEikCapCArray : public CArrayPtrFlat<CEikCaptionedControl> |
|
29 { |
|
30 public: |
|
31 /** Constructor |
|
32 * |
|
33 * Creates CEikCapCArray with a granilarity. |
|
34 * |
|
35 * @param aGranularity how many items will be allocated each time allocation happens |
|
36 */ |
|
37 IMPORT_C CEikCapCArray(TInt aGranularity); |
|
38 |
|
39 /** Destructor |
|
40 * |
|
41 * Destroys CEikCapCArray |
|
42 */ |
|
43 IMPORT_C ~CEikCapCArray(); |
|
44 |
|
45 /** MinimumSize() returns minimum size for the array |
|
46 * |
|
47 * MinimumSize calculates minimum possible size for |
|
48 * the captioned control array. |
|
49 * |
|
50 * @return size in pixels |
|
51 */ |
|
52 IMPORT_C TSize MinimumSize(); |
|
53 |
|
54 /** SetRect() sets the rectangle of the captionedcontrolarray |
|
55 * |
|
56 * SetRect layouts the captionedcontrolarray. Captioned |
|
57 * control rectangles are calculated based on provided rectangle |
|
58 * and sizes of the captioned controls. |
|
59 * |
|
60 * @param aRect Rectangle for the whole array |
|
61 */ |
|
62 IMPORT_C void SetRect(const TRect& aRect); |
|
63 |
|
64 /** ResetMinimumSizes() clears size information |
|
65 * |
|
66 * ResetMinimumSizes goes through all captionedcontrols |
|
67 * and resets the minimum size information of the |
|
68 * captionedcontrols |
|
69 */ |
|
70 IMPORT_C void ResetMinimumSizes(); |
|
71 |
|
72 /** LineIndexFromId() provides line index in array based on id number |
|
73 * |
|
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 |
|
78 * |
|
79 * @param aControlId captionedcontrol's iId. |
|
80 */ |
|
81 IMPORT_C TInt LineIndexFromId(TInt aControlId) const; |
|
82 |
|
83 /** FindLineIndex() finds line index based on control |
|
84 * |
|
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. |
|
89 * |
|
90 * @param aControl control to be found |
|
91 */ |
|
92 IMPORT_C TInt FindLineIndex(const CCoeControl* aControl) const; |
|
93 |
|
94 /** DeleteLine() removes line from captionedcontrolarray |
|
95 * |
|
96 * Elements from CaptionedControlArray can be removed |
|
97 * by calling DeleteLine method. |
|
98 * |
|
99 * @param aIndex index of the line to be removed |
|
100 */ |
|
101 IMPORT_C void DeleteLine(TInt aIndex); |
|
102 |
|
103 /** AdjustAllIds() modified iId fields of the captionedcontrols |
|
104 * |
|
105 * @param aControlIdDelta how much to increase or decrease control id's |
|
106 */ |
|
107 IMPORT_C void AdjustAllIds(TInt aControlIdDelta); |
|
108 |
|
109 /** SetDensePacking() sets dense packing flag |
|
110 * |
|
111 * @param aDensePacking whether dense packing flag is on |
|
112 */ |
|
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; |
|
118 TRect Rect() 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; |
|
123 |
|
124 /** |
|
125 * Scrolls each item by aDelta pixels in y direction. |
|
126 */ |
|
127 TInt ScrollByPixels( TInt aDelta ); |
|
128 |
|
129 /** |
|
130 * Return the index of the line at aYPos. |
|
131 */ |
|
132 TInt YPositionToLineIndex( TInt aYPos ) const; |
|
133 |
|
134 /** |
|
135 * Returns line's top y coordinate. |
|
136 */ |
|
137 TInt LineIndexToYPosition( TInt aLine, TInt aTopY ) const; |
|
138 |
|
139 /** |
|
140 * Moves aLine to the visible screen area or out of it. |
|
141 */ |
|
142 void MoveLineToScreen( TInt aLine, TInt aTopY, TBool aVisible ); |
|
143 |
|
144 /** |
|
145 * Calculates the line that should be focused when a navigation key is |
|
146 * pressed while in form view mode. |
|
147 * |
|
148 * @since S60 5.2 |
|
149 * @param aCurrentLine Current line's index. |
|
150 * @param aTopY View's top y coordinate. |
|
151 * @return Line that should be focused. |
|
152 */ |
|
153 TInt FocusableLine( TInt aCurrentLine, TInt aTopY ); |
|
154 |
|
155 private: |
|
156 /** |
|
157 * Positions controls in real locations. |
|
158 */ |
|
159 void SetRealRect( const TRect& aRect, TInt aTop, TInt aBottom ); |
|
160 |
|
161 private: |
|
162 //TInt iCaptionWidth; |
|
163 CEikCapCArrayExtension *iExtension; |
|
164 TBool iDensePacking; |
|
165 //TRect iRect; |
|
166 }; |
|
167 |
|
168 #endif |