|
1 /* |
|
2 * Copyright (c) 2008-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: stub hbview |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef HBLISTVIEW_H |
|
19 #define HBLISTVIEW_H |
|
20 |
|
21 #include "hbwidget.h" |
|
22 #include "hblistviewitem.h" |
|
23 #include "hbscrollbar.h" |
|
24 #include "hbabstractitemview.h" |
|
25 #include "videosortfilterproxymodel.h" |
|
26 |
|
27 #include <QGraphicsItem> |
|
28 #include <QModelIndex> |
|
29 #include <qgraphicswidget.h> |
|
30 #include <QList> |
|
31 #include <QPointF> |
|
32 #include <qitemselectionmodel.h> |
|
33 |
|
34 class HbScrollArea |
|
35 { |
|
36 public: |
|
37 enum ClampingStyle |
|
38 { |
|
39 InvalidClamping, |
|
40 BounceBackClamping |
|
41 }; |
|
42 enum ScrollingStyle |
|
43 { |
|
44 InvalidScrolling, |
|
45 PanOrFlick |
|
46 }; |
|
47 }; |
|
48 |
|
49 class HbListView : public HbAbstractItemView |
|
50 { |
|
51 Q_OBJECT |
|
52 |
|
53 public: |
|
54 |
|
55 signals: |
|
56 |
|
57 /** |
|
58 * dummy signal |
|
59 */ |
|
60 void scrollPositionChanged(const QPointF &); |
|
61 |
|
62 /** |
|
63 * dummy signal |
|
64 */ |
|
65 void scrollingEnded(); |
|
66 |
|
67 /** |
|
68 * dummy signal |
|
69 */ |
|
70 void scrollingStarted(); |
|
71 |
|
72 public: |
|
73 /** |
|
74 * contructor |
|
75 */ |
|
76 HbListView(QGraphicsItem *parent = 0) : |
|
77 mItem(0), mVerticalSB(0), mSelectionModel(0) |
|
78 { |
|
79 Q_UNUSED(parent); |
|
80 mItem = new HbListViewItem(); |
|
81 mVerticalSB = new HbScrollBar(); |
|
82 } |
|
83 |
|
84 /** |
|
85 * destructor |
|
86 */ |
|
87 virtual ~HbListView() |
|
88 { |
|
89 delete mSelectionModel; |
|
90 delete mItem; |
|
91 delete mVerticalSB; |
|
92 QList<HbAbstractViewItem*>::const_iterator iter = mVisibleItems.constBegin(); |
|
93 while(iter != mVisibleItems.constEnd()) |
|
94 { |
|
95 delete *iter; |
|
96 ++iter; |
|
97 } |
|
98 mVisibleItems.clear(); |
|
99 } |
|
100 |
|
101 HbScrollBar* verticalScrollBar() |
|
102 { |
|
103 if(mVScrollBarIsNull) |
|
104 { |
|
105 return 0; |
|
106 } |
|
107 return mVerticalSB; |
|
108 } |
|
109 |
|
110 /** |
|
111 * dummy method |
|
112 */ |
|
113 void setModel(VideoSortFilterProxyModel *model) |
|
114 { |
|
115 mLatestModel = model; |
|
116 } |
|
117 |
|
118 /** |
|
119 * dummy method |
|
120 */ |
|
121 HbListViewItem *listItemPrototype() |
|
122 { |
|
123 if(mReturnNullPrototype) |
|
124 { |
|
125 return 0; |
|
126 } |
|
127 return mItem; |
|
128 } |
|
129 |
|
130 /** |
|
131 * dummy method |
|
132 */ |
|
133 void setItemRecycling(bool value) |
|
134 { |
|
135 mLatestrecycling = value; |
|
136 } |
|
137 |
|
138 /** |
|
139 * dummy method |
|
140 */ |
|
141 void setClampingStyle(HbScrollArea::ClampingStyle style) |
|
142 { |
|
143 mLatestClamping = style; |
|
144 } |
|
145 |
|
146 /** |
|
147 * dummy method |
|
148 */ |
|
149 void setScrollingStyle(HbScrollArea::ScrollingStyle style) |
|
150 { |
|
151 mLatestScrolling = style; |
|
152 } |
|
153 |
|
154 /** |
|
155 * dummy method |
|
156 */ |
|
157 void setFrictionEnabled(bool value) |
|
158 { |
|
159 mLatestFrictionEnabled = value; |
|
160 } |
|
161 |
|
162 /** |
|
163 * dummy method |
|
164 */ |
|
165 void setUniformItemSizes(bool value) |
|
166 { |
|
167 mLatestUniformItemSizes = value; |
|
168 } |
|
169 |
|
170 /** |
|
171 * dummy method |
|
172 */ |
|
173 void setVisible(bool value) |
|
174 { |
|
175 mLatestVisibility = value; |
|
176 } |
|
177 |
|
178 /** |
|
179 * dummy method |
|
180 */ |
|
181 void setEnabled(bool value) |
|
182 { |
|
183 mLatestEnableValue = value; |
|
184 } |
|
185 |
|
186 /** |
|
187 * dummy method |
|
188 */ |
|
189 void setSelectionMode(HbAbstractItemView::SelectionMode mode) |
|
190 { |
|
191 mSelectionMode = mode; |
|
192 } |
|
193 |
|
194 QList<HbAbstractViewItem*> visibleItems() |
|
195 { |
|
196 return mVisibleItems; |
|
197 } |
|
198 |
|
199 /** |
|
200 * dummy method |
|
201 */ |
|
202 HbAbstractItemView::SelectionMode selectionMode() |
|
203 { |
|
204 return mSelectionMode; |
|
205 } |
|
206 |
|
207 /** |
|
208 * dummy method |
|
209 */ |
|
210 QModelIndex currentIndex() |
|
211 { |
|
212 return mCurrentIndex; |
|
213 } |
|
214 |
|
215 /** |
|
216 * sets mLongPressedPoint |
|
217 */ |
|
218 void longPressGesture (const QPointF &point) |
|
219 { |
|
220 mLongPressedPoint = point; |
|
221 } |
|
222 |
|
223 /** |
|
224 * dummy method |
|
225 */ |
|
226 void clearSelection() |
|
227 { |
|
228 mAllSelectedStatus = 0; |
|
229 } |
|
230 |
|
231 /** |
|
232 * dummy method |
|
233 */ |
|
234 void scrollTo(const QModelIndex &index) |
|
235 { |
|
236 Q_UNUSED(index); |
|
237 |
|
238 // nop |
|
239 } |
|
240 |
|
241 /** |
|
242 * dummy method |
|
243 */ |
|
244 void selectAll() |
|
245 { |
|
246 mAllSelectedStatus = 1; |
|
247 } |
|
248 |
|
249 /** |
|
250 * dummy method |
|
251 */ |
|
252 QItemSelectionModel *selectionModel() |
|
253 { |
|
254 if (!mSelectionModel) |
|
255 { |
|
256 mSelectionModel = new QItemSelectionModel(mLatestModel); |
|
257 } |
|
258 return mSelectionModel; |
|
259 } |
|
260 |
|
261 /** |
|
262 * dummy method |
|
263 */ |
|
264 HbAbstractViewItem* itemAtPosition(const QPointF &position) |
|
265 { |
|
266 return mItem; |
|
267 } |
|
268 public: |
|
269 |
|
270 /** |
|
271 * items to be returned from visibleItems |
|
272 */ |
|
273 static QList<HbAbstractViewItem*> mVisibleItems; |
|
274 |
|
275 /** |
|
276 * selection model to be returned |
|
277 */ |
|
278 static HbAbstractItemView::SelectionMode mSelectionMode; |
|
279 |
|
280 /** |
|
281 * provided model |
|
282 */ |
|
283 static VideoSortFilterProxyModel *mLatestModel; |
|
284 |
|
285 /** |
|
286 * -1 == initialized |
|
287 * 0 == nothing selected |
|
288 * 1 == all selected |
|
289 */ |
|
290 static int mAllSelectedStatus; |
|
291 |
|
292 /** |
|
293 * item to returned from listItemPrototype and from itemAtPosition |
|
294 */ |
|
295 HbListViewItem *mItem; |
|
296 |
|
297 /** |
|
298 * item to be returned from verticalScrollBar |
|
299 */ |
|
300 HbScrollBar *mVerticalSB; |
|
301 |
|
302 /** |
|
303 * selection model |
|
304 */ |
|
305 QItemSelectionModel *mSelectionModel; |
|
306 |
|
307 /** |
|
308 * if true verticalScrollBar return null |
|
309 */ |
|
310 static bool mVScrollBarIsNull; |
|
311 |
|
312 /** |
|
313 * if true, listItemPrototype returns null |
|
314 */ |
|
315 static bool mReturnNullPrototype; |
|
316 |
|
317 /** |
|
318 * latest value settes in setItemRecycling |
|
319 */ |
|
320 static bool mLatestrecycling; |
|
321 |
|
322 /** |
|
323 * value setted in longPressGesture |
|
324 */ |
|
325 static QPointF mLongPressedPoint; |
|
326 |
|
327 /** |
|
328 * latest value settes in setClampingStyle |
|
329 */ |
|
330 static HbScrollArea::ClampingStyle mLatestClamping; |
|
331 |
|
332 /** |
|
333 * latest value setted in setScrollingStyle |
|
334 */ |
|
335 static HbScrollArea::ScrollingStyle mLatestScrolling; |
|
336 |
|
337 /** |
|
338 * latest value setted in setFrictionEnabled |
|
339 */ |
|
340 static bool mLatestFrictionEnabled; |
|
341 |
|
342 /** |
|
343 * latest value setted in setUniformItemSizes |
|
344 */ |
|
345 static bool mLatestUniformItemSizes; |
|
346 |
|
347 /** |
|
348 * latest value setted in setVisible |
|
349 */ |
|
350 static bool mLatestVisibility; |
|
351 |
|
352 /** |
|
353 * latest value setted in setEnabled |
|
354 */ |
|
355 static bool mLatestEnableValue; |
|
356 |
|
357 /** |
|
358 * index value to be returned from current index |
|
359 */ |
|
360 static QModelIndex mCurrentIndex; |
|
361 }; |
|
362 |
|
363 #endif |