|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
6 ** |
|
7 ** This file is part of the HbWidgets module of the UI Extensions for Mobile. |
|
8 ** |
|
9 ** GNU Lesser General Public License Usage |
|
10 ** This file may be used under the terms of the GNU Lesser General Public |
|
11 ** License version 2.1 as published by the Free Software Foundation and |
|
12 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
13 ** Please review the following information to ensure the GNU Lesser General |
|
14 ** Public License version 2.1 requirements will be met: |
|
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
16 ** |
|
17 ** In addition, as a special exception, Nokia gives you certain additional |
|
18 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
20 ** |
|
21 ** If you have questions regarding the use of this file, please contact |
|
22 ** Nokia at developer.feedback@nokia.com. |
|
23 ** |
|
24 ****************************************************************************/ |
|
25 |
|
26 #ifndef HBRADIOBUTTONLIST_H |
|
27 #define HBRADIOBUTTONLIST_H |
|
28 |
|
29 #include <hbglobal.h> |
|
30 #include <hbnamespace.h> |
|
31 #include <hblistview.h> |
|
32 |
|
33 class HbRadioButtonListPrivate; |
|
34 |
|
35 class HB_WIDGETS_EXPORT HbRadioButtonList: public HbListView |
|
36 { |
|
37 Q_OBJECT |
|
38 |
|
39 Q_ENUMS(PreviewMode) |
|
40 Q_PROPERTY(QStringList items READ items WRITE setItems) |
|
41 Q_PROPERTY(PreviewMode previewMode READ previewMode WRITE setPreviewMode) |
|
42 Q_PROPERTY(int selected READ selected WRITE setSelected NOTIFY itemSelected USER true) |
|
43 |
|
44 public: |
|
45 |
|
46 enum PreviewMode |
|
47 { |
|
48 NoPreview, |
|
49 Preview |
|
50 }; |
|
51 |
|
52 explicit HbRadioButtonList(QGraphicsItem *parent = 0); |
|
53 |
|
54 explicit HbRadioButtonList( |
|
55 const QStringList &list, |
|
56 int selected = -1, |
|
57 PreviewMode previewMode = NoPreview, |
|
58 QGraphicsItem *parent = 0); |
|
59 |
|
60 ~HbRadioButtonList(); |
|
61 |
|
62 void setItems(const QStringList &list); |
|
63 QStringList items() const; |
|
64 |
|
65 void setSelected(int index); |
|
66 int selected() const; |
|
67 |
|
68 void setPreviewMode(PreviewMode previewMode); |
|
69 PreviewMode previewMode() const; |
|
70 |
|
71 enum { Type = Hb::ItemType_RadioButtonList }; |
|
72 int type() const; |
|
73 |
|
74 public slots: |
|
75 virtual void reset(); |
|
76 |
|
77 signals: |
|
78 void itemSelected(int index); |
|
79 void startPreview(int index); |
|
80 |
|
81 protected: |
|
82 HbRadioButtonList(HbRadioButtonListPrivate &dd, HbAbstractItemContainer *container, QGraphicsItem *parent); |
|
83 |
|
84 void emitActivated(const QModelIndex &modelIndex); |
|
85 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
|
86 QItemSelectionModel::SelectionFlags selectionCommand( |
|
87 const HbAbstractViewItem *item, |
|
88 const QEvent *event); |
|
89 bool event(QEvent *e); |
|
90 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; |
|
91 |
|
92 protected slots: |
|
93 virtual void rowsInserted(const QModelIndex &parent, int start, int end); |
|
94 virtual void rowsRemoved(const QModelIndex &parent, int start, int end); |
|
95 |
|
96 private: |
|
97 Q_DECLARE_PRIVATE_D(d_ptr, HbRadioButtonList) |
|
98 Q_DISABLE_COPY(HbRadioButtonList) |
|
99 Q_PRIVATE_SLOT(d_func(), void _q_itemActivated(const QModelIndex&)) |
|
100 Q_PRIVATE_SLOT(d_func(), void _q_itemActivationTimerExpired()) |
|
101 Q_PRIVATE_SLOT(d_func(), void _q_itemPreviewTimerExpired()) |
|
102 }; |
|
103 |
|
104 #endif // HBRADIOBUTTONLIST_H |
|
105 |
|
106 |