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