53 |
53 |
54 /** |
54 /** |
55 * Two-phased constructor. |
55 * Two-phased constructor. |
56 */ |
56 */ |
57 static CMmListBoxView* NewLC(); |
57 static CMmListBoxView* NewLC(); |
58 |
58 |
59 /** |
59 /** |
60 * Calculate the bottom item index. |
60 * Calculate the bottom item index. |
61 * |
61 * |
62 * @since S60 v3.0 |
62 * @since S60 v3.0 |
63 */ |
63 */ |
64 void CalcBottomItemIndex(); |
64 void CalcBottomItemIndex(); |
65 |
65 |
66 /** |
66 /** |
67 * Draw the view. |
67 * Draw the view. |
68 * |
68 * |
69 * @since S60 v3.0 |
69 * @since S60 v3.0 |
70 * @param clipRect Clipping rectangle. |
70 * @param clipRect Clipping rectangle. |
71 */ |
71 */ |
72 void Draw(const TRect* clipRect) const; |
72 void Draw(const TRect* clipRect) const; |
73 |
73 |
74 /** |
74 /** |
75 * Draws the listbox within the given clipping rect. |
75 * Draws the listbox within the given clipping rect. |
76 * |
76 * |
77 * @since S60 v3.0 |
77 * @since S60 v3.0 |
78 * @param clipRect Clipping rectangle. |
78 * @param clipRect Clipping rectangle. |
79 */ |
79 */ |
80 void DoDraw(const TRect* aClipRect) const; |
80 void DoDraw(const TRect* aClipRect) const; |
81 |
81 |
82 /** |
82 /** |
83 * Draw item in view. It is possible that it |
83 * Draw item in view. It is possible that it |
84 * calls drawing of more than one item. |
84 * calls drawing of more than one item. |
85 * |
85 * |
86 * @since S60 v3.0 |
86 * @since S60 v3.0 |
87 * @param aItemIndex Item index. |
87 * @param aItemIndex Item index. |
88 */ |
88 */ |
89 void DrawItem(TInt aItemIndex) const; |
89 void DrawItem(TInt aItemIndex) const; |
90 |
90 |
91 /** |
91 /** |
92 * Draw a single item in view. |
92 * Draw a single item in view. |
93 * |
93 * |
94 * @since S60 v3.0 |
94 * @since S60 v3.0 |
95 * @param aItemIndex Item index. |
95 * @param aItemIndex Item index. |
96 */ |
96 */ |
97 void DrawSingleItem (TInt aItemIndex) const; |
97 void DrawSingleItem (TInt aItemIndex) const; |
98 |
98 |
99 /** |
99 /** |
100 * Get the number of items that fit in rectangle. |
100 * Sets aItemIndex to the index of the item whose bounding box contains aPosition. |
101 * |
101 * |
102 * @since S60 v3.0 |
102 * @since S60 v3.0 |
103 * @param aRect Clipping rectangle. |
103 * @param aPosition Item position. |
104 * @return Number of items that fit in rectangle. |
104 * @param aItemIndex Item index. |
105 */ |
105 * @return Was item found. |
106 TInt NumberOfItemsThatFitInRect(const TRect& aRect) const; |
106 */ |
107 |
|
108 /** |
|
109 * Get the number of items that fit in rectangle (with option to include |
|
110 * partial item at bottom of view). |
|
111 * |
|
112 * @since S60 v3.0 |
|
113 * @param aRect Rect for calculations. |
|
114 * @param aIncludePartialItem Should partial item be included. |
|
115 * @return Number of items that fit in rectangle. |
|
116 */ |
|
117 TInt GetNumberOfItemsThatFitInRect (const TRect& aRect, TBool aIncludePartialItem ) const; |
|
118 |
|
119 /** |
|
120 * Get item size. |
|
121 * |
|
122 * @since S60 v3.0 |
|
123 * @param aItemIndex Item index. |
|
124 * @return Size of item. |
|
125 */ |
|
126 TSize ItemSize(TInt aItemIndex) const; |
|
127 |
|
128 /** |
|
129 * Sets aItemIndex to the index of the item whose bounding box contains aPosition. |
|
130 * |
|
131 * @since S60 v3.0 |
|
132 * @param aPosition Item position. |
|
133 * @param aItemIndex Item index. |
|
134 * @return Was item found. |
|
135 */ |
|
136 TBool XYPosToItemIndex(TPoint aPosition, TInt& aItemIndex) const; |
107 TBool XYPosToItemIndex(TPoint aPosition, TInt& aItemIndex) const; |
137 |
108 |
138 /** |
109 /** |
139 * Gets item position. |
110 * Gets item position. |
140 * |
111 * |
141 * @since S60 v3.0 |
112 * @since S60 v3.0 |
142 * @param aItemIndex Item index. |
113 * @param aItemIndex Item index. |
143 * @return Item position. |
114 * @return Item position. |
144 */ |
115 */ |
145 TPoint ItemPos(TInt aItemIndex) const; |
116 TPoint ItemPos(TInt aItemIndex) const; |
146 |
117 |
147 /** |
118 /** |
148 * Sets item height. |
119 * Sets item height. |
149 * |
120 * |
150 * @since S60 v3.0 |
121 * @since S60 v3.0 |
151 * @param aItemHeight Item height. |
122 * @param aItemHeight Item height. |
152 */ |
123 */ |
153 void SetItemHeight(TInt aItemHeight); |
124 void SetItemHeight(TInt aItemHeight); |
154 |
125 |
155 /** |
126 /** |
156 * Calculates new top item index so item is visible. |
127 * Calculates new top item index so item is visible. |
157 * |
128 * |
158 * @since S60 v3.0 |
129 * @since S60 v3.0 |
159 * @param aItemIndex Item to be visible. |
130 * @param aItemIndex Item to be visible. |
160 * @return New top item index. |
131 * @return New top item index. |
161 */ |
132 */ |
162 TInt CalcNewTopItemIndexSoItemIsVisible(TInt aItemIndex) const; |
133 TInt CalcNewTopItemIndexSoItemIsVisible(TInt aItemIndex) const; |
163 |
134 |
164 /** |
135 /** |
165 * Draw background between rects. |
136 * Draw background between rects. |
166 * |
137 * |
167 * @since S60 v3.0 |
138 * @since S60 v3.0 |
168 * @param aUsedPortionOfViewRect Inner rect. |
139 * @param aUsedPortionOfViewRect Inner rect. |
169 * @param aSmallerViewRect Outer rect. |
140 * @param aSmallerViewRect Outer rect. |
170 */ |
141 */ |
171 void RedrawBackground( TRect aUsedPortionOfViewRect, TRect aSmallerViewRect) const; |
142 void RedrawBackground( TRect aUsedPortionOfViewRect, TRect aSmallerViewRect) const; |
172 |
143 |
173 /** |
144 /** |
174 * Draws background in list which is not covered by vivible items. |
145 * Draws background in list which is not covered by vivible items. |
175 * |
146 * |
176 * @since S60 v3.0 |
147 * @since S60 v3.0 |
177 */ |
148 */ |
178 void RedrawBackground() const; |
149 void RedrawBackground() const; |
179 |
150 |
180 /** |
151 /** |
181 * Gets total height of items within range. |
152 * Gets total height of items within range. |
182 * |
153 * |
183 * @since S60 v3.0 |
154 * @since S60 v3.0 |
184 * @param aStartIndex Start item index. |
155 * @param aStartIndex Start item index. |
185 * @param aEndIndex End item index. |
156 * @param aEndIndex End item index. |
186 * @return Total height of items starting from aStartIndex, ending with aEndIndex. |
157 * @return Total height of items starting from aStartIndex, ending with aEndIndex. |
187 */ |
158 */ |
188 TInt GetTotalHeight( TInt aStartIndex, TInt aEndIndex ) const; |
159 TInt GetTotalHeight( TInt aStartIndex, TInt aEndIndex ) const; |
189 |
160 |
190 /** |
161 /** |
191 * Gets the current widget vertical item offset. |
162 * Gets the current widget vertical item offset. |
192 * |
163 * |
193 * @since S60 v5.0 |
164 * @since S60 v5.0 |
194 * @return The current widget vertical item offset. |
165 * @return The current widget vertical item offset. |
195 */ |
166 */ |
196 TInt VerticalItemOffset() const; |
167 TInt VerticalItemOffset() const; |
197 |
168 |
198 /** |
169 /** |
199 * Overridden to allow for disabling this method in certain situations. |
170 * Overridden to allow for disabling this method in certain situations. |
200 * |
171 * |
201 * @param aItemIndex Item index. |
172 * @param aItemIndex Item index. |
202 */ |
173 */ |
203 TBool ScrollToMakeItemVisible(TInt aItemIndex); |
174 TBool ScrollToMakeItemVisible(TInt aItemIndex); |
204 |
175 |
205 /** |
176 /** |
206 * Disables ScrollToMakeItemVisible. |
177 * Disables ScrollToMakeItemVisible. |
207 * When disabled, ScrollToMakeItemVisible does nothing. |
178 * When disabled, ScrollToMakeItemVisible does nothing. |
208 * |
179 * |
209 * @param aDisable Self-explanatory. |
180 * @param aDisable Self-explanatory. |
210 */ |
181 */ |
211 void DisableScrollToItem( TBool aDisable ); |
182 void DisableScrollToItem( TBool aDisable ); |
212 |
183 |
213 /** |
184 /** |
227 /** |
198 /** |
228 * Default symbian 2nd stage constructor. |
199 * Default symbian 2nd stage constructor. |
229 */ |
200 */ |
230 void ConstructL(); |
201 void ConstructL(); |
231 |
202 |
232 /** |
203 /** |
233 * Updates average item height. |
204 * Updates average item height. |
234 * |
205 * |
235 * @since S60 v3.0 |
206 * @since S60 v3.0 |
236 */ |
207 */ |
237 void UpdateAverageItemHeight(); |
208 void UpdateAverageItemHeight(); |
238 |
209 |
239 /** |
210 /** |
240 * Gets last item index depending on height. |
211 * Gets last item index depending on height. |
241 * |
212 * |
242 * @since S60 v3.0 |
213 * @since S60 v3.0 |
243 * @param aStartIndex Start item index. |
214 * @param aStartIndex Start item index. |
244 * @param aHeight Height of area. |
215 * @param aHeight Height of area. |
245 * @return Last item index. |
216 * @return Last item index. |
246 */ |
217 */ |
247 TInt GetLastIndexInHeight( const TInt aStartIndex, TInt aHeight ) const; |
218 TInt GetLastIndexInHeight( const TInt aStartIndex, TInt aHeight ) const; |
248 |
219 |
249 /** |
220 /** |
250 * Sets the previously drawn current item index. |
221 * Sets the previously drawn current item index. |
251 * |
222 * |
252 * @since S60 v3.0 |
223 * @since S60 v3.0 |
253 * @param aIndex Current Item index. |
224 * @param aIndex Current Item index. |
254 */ |
225 */ |
255 void SetPreviouslyDrawnCurrentItemIndex( TBool aIndex ); |
226 void SetPreviouslyDrawnCurrentItemIndex( TBool aIndex ); |
256 |
227 |
257 private: |
228 private: |
258 |
229 |
259 /** |
230 /** |
260 * Scrollbar visibility flag. |
231 * Scrollbar visibility flag. |
261 */ |
232 */ |
262 TBool iScrollbarIsVisible; |
233 TBool iScrollbarIsVisible; |
263 |
234 |
264 /** |
235 /** |
265 * iCurrentItemIndex |
236 * iCurrentItemIndex |
266 */ |
237 */ |
267 TInt iPreviouslyDrawnCurrentItemIndex; |
238 TInt iPreviouslyDrawnCurrentItemIndex; |
268 |
239 |
269 /** |
240 /** |
270 * When ETrue, disables ScrollToMakeItemVisible method. |
241 * When ETrue, disables ScrollToMakeItemVisible method. |
271 */ |
242 */ |
272 TBool iScrollToItemDisabled; |
243 TBool iScrollToItemDisabled; |
273 }; |
244 }; |
274 |
245 |
275 #endif // MMLISTBOXVIEW_H |
246 #endif // MMLISTBOXVIEW_H |