17 |
17 |
18 #ifndef HGWIDGET_H |
18 #ifndef HGWIDGET_H |
19 #define HGWIDGET_H |
19 #define HGWIDGET_H |
20 |
20 |
21 #include <QItemSelectionModel> |
21 #include <QItemSelectionModel> |
22 #include <hbglobal.h> |
22 #include <HbGlobal> |
23 #include <hbnamespace.h> |
23 #include <hbnamespace.h> |
24 #include <hbwidget.h> |
24 #include <HbWidget> |
25 |
25 |
26 #ifdef BUILD_HG_WIDGETS |
26 #ifdef BUILD_HG_WIDGETS |
27 # define HG_WIDGETS_EXPORT Q_DECL_EXPORT |
27 # define HG_WIDGETS_EXPORT Q_DECL_EXPORT |
28 # define HG_WIDGETS_PRIVATE_EXPORT Q_DECL_EXPORT |
28 # define HG_WIDGETS_PRIVATE_EXPORT Q_DECL_EXPORT |
29 #else |
29 #else |
51 Q_ENUMS(ItemSizePolicy) |
51 Q_ENUMS(ItemSizePolicy) |
52 public: |
52 public: |
53 |
53 |
54 enum HgDataRole |
54 enum HgDataRole |
55 { |
55 { |
56 HgVisibilityRole = Qt::UserRole + 1 |
56 HgVisibilityRole = Qt::UserRole + 1 |
57 }; |
57 }; |
58 |
58 |
59 enum IndexFeedbackPolicy { |
59 enum IndexFeedbackPolicy { |
60 IndexFeedbackNone = 0, |
60 IndexFeedbackNone = 0, |
61 IndexFeedbackSingleCharacter, |
61 IndexFeedbackSingleCharacter, |
62 IndexFeedbackThreeCharacter, |
62 IndexFeedbackThreeCharacter, |
63 IndexFeedbackString |
63 IndexFeedbackString |
64 }; |
64 }; |
65 |
65 |
66 enum ScrollBarPolicy { |
66 enum ScrollBarPolicy { |
67 ScrollBarAsNeeded = Qt::ScrollBarAsNeeded, |
67 ScrollBarAsNeeded = Qt::ScrollBarAsNeeded, |
68 ScrollBarAlwaysOff = Qt::ScrollBarAlwaysOff, |
68 ScrollBarAlwaysOff = Qt::ScrollBarAlwaysOff, |
69 ScrollBarAlwaysOn = Qt::ScrollBarAlwaysOn, |
69 ScrollBarAlwaysOn = Qt::ScrollBarAlwaysOn, |
70 ScrollBarAutoHide |
70 ScrollBarAutoHide |
71 }; |
71 }; |
72 |
72 |
73 enum ItemSizePolicy { |
73 enum ItemSizePolicy { |
74 ItemSizeAutomatic, |
74 ItemSizeAutomatic, |
75 ItemSizeUserDefined |
75 ItemSizeUserDefined |
76 }; |
76 }; |
77 |
77 |
110 HbScrollBar *scrollBar() const; |
110 HbScrollBar *scrollBar() const; |
111 void setScrollBar(HbScrollBar *scrollBar); |
111 void setScrollBar(HbScrollBar *scrollBar); |
112 |
112 |
113 bool getItemOutline(const QModelIndex& index, QPolygonF& points); |
113 bool getItemOutline(const QModelIndex& index, QPolygonF& points); |
114 Qt::Orientation scrollDirection() const; |
114 Qt::Orientation scrollDirection() const; |
115 |
115 |
116 QList<QModelIndex> getVisibleItemIndices() const; |
116 QList<QModelIndex> getVisibleItemIndices() const; |
117 |
117 |
118 void setIndexFeedbackPolicy( IndexFeedbackPolicy policy); |
118 void setIndexFeedbackPolicy( IndexFeedbackPolicy policy); |
119 IndexFeedbackPolicy indexFeedbackPolicy() const; |
119 IndexFeedbackPolicy indexFeedbackPolicy() const; |
120 |
120 |
121 void setDefaultImage(QImage defaultImage); |
121 void setDefaultImage(QImage defaultImage); |
122 |
122 |
123 void setItemSizePolicy(ItemSizePolicy policy); |
123 void setItemSizePolicy(ItemSizePolicy policy); |
124 ItemSizePolicy itemSizePolicy() const; |
124 ItemSizePolicy itemSizePolicy() const; |
125 |
125 |
126 void setItemSize(const QSizeF& size); |
126 void setItemSize(const QSizeF& size); |
127 QSizeF itemSize() const; |
127 QSizeF itemSize() const; |
128 |
128 |
129 void setItemSpacing(const QSizeF& spacing); |
129 void setItemSpacing(const QSizeF& spacing); |
130 QSizeF itemSpacing() const; |
130 QSizeF itemSpacing() const; |
131 |
131 |
132 signals: |
132 signals: |
133 void activated(const QModelIndex &index); |
133 void activated(const QModelIndex &index); |
134 void longPressed(const QModelIndex &index, const QPointF &coords); |
134 void longPressed(const QModelIndex &index, const QPointF &coords); |
135 void scrollingStarted(); |
135 void scrollingStarted(); |
136 void scrollingEnded(); |
136 void scrollingEnded(); |
137 public slots: |
137 public slots: |
138 |
138 |
139 void aboutToChangeOrientation(); |
139 void aboutToChangeOrientation(); |
140 void orientationChanged(Qt::Orientation orientation); |
140 void orientationChanged(Qt::Orientation orientation); |
141 |
141 |
142 protected slots: |
142 protected slots: |
143 |
143 |
144 void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); |
144 void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); |
145 |
145 |
146 protected: |
146 protected: |
148 HgWidget(HgWidgetPrivate &dd, QGraphicsItem *parent); |
148 HgWidget(HgWidgetPrivate &dd, QGraphicsItem *parent); |
149 |
149 |
150 bool eventFilter(QObject *obj,QEvent *event); |
150 bool eventFilter(QObject *obj,QEvent *event); |
151 |
151 |
152 bool event(QEvent *event); |
152 bool event(QEvent *event); |
153 |
153 |
154 private: |
154 private: |
155 Q_DECLARE_PRIVATE_D(p_ptr, HgWidget) |
155 Q_DECLARE_PRIVATE_D(p_ptr, HgWidget) |
156 Q_DISABLE_COPY(HgWidget) |
156 Q_DISABLE_COPY(HgWidget) |
157 Q_PRIVATE_SLOT(d_func(), void _q_scrollPositionChanged(qreal index, bool scrollBarAnimation)) |
157 Q_PRIVATE_SLOT(d_func(), void _q_scrollPositionChanged(qreal index, bool scrollBarAnimation)) |
158 Q_PRIVATE_SLOT(d_func(), void _q_releaseItems(int releaseStart, int releaseEnd)) |
158 Q_PRIVATE_SLOT(d_func(), void _q_releaseItems(int releaseStart, int releaseEnd)) |
162 Q_PRIVATE_SLOT(d_func(), void _q_insertRows(const QModelIndex &parent, int start, int end)) |
162 Q_PRIVATE_SLOT(d_func(), void _q_insertRows(const QModelIndex &parent, int start, int end)) |
163 Q_PRIVATE_SLOT(d_func(), void _q_removeRows(const QModelIndex &parent, int start, int end)) |
163 Q_PRIVATE_SLOT(d_func(), void _q_removeRows(const QModelIndex &parent, int start, int end)) |
164 Q_PRIVATE_SLOT(d_func(), void _q_moveRows(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)) |
164 Q_PRIVATE_SLOT(d_func(), void _q_moveRows(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)) |
165 Q_PRIVATE_SLOT(d_func(), void _q_groovePressed(qreal, Qt::Orientation)) |
165 Q_PRIVATE_SLOT(d_func(), void _q_groovePressed(qreal, Qt::Orientation)) |
166 Q_PRIVATE_SLOT(d_func(), void _q_modelReset()) |
166 Q_PRIVATE_SLOT(d_func(), void _q_modelReset()) |
|
167 Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentItem(const QModelIndex ¤t, const QModelIndex &previous)) |
167 }; |
168 }; |
168 |
169 |
169 #endif //HGWIDGET_H |
170 #endif //HGWIDGET_H |
170 |
171 |