ganeswidgets/inc/HgContainer.h
changeset 2 49c70dcc3f17
parent 1 e48454f237ca
child 3 c863538fcbb6
equal deleted inserted replaced
1:e48454f237ca 2:49c70dcc3f17
   101     void activated(const QModelIndex &index);
   101     void activated(const QModelIndex &index);
   102     void longPressed(const QModelIndex &index, const QPointF &coords);
   102     void longPressed(const QModelIndex &index, const QPointF &coords);
   103     void scrollingStarted();
   103     void scrollingStarted();
   104     void scrollingEnded();
   104     void scrollingEnded();
   105 
   105 
       
   106 protected slots:    
       
   107 
       
   108     virtual void onScrollingStarted();
       
   109     virtual void onScrollingEnded();
       
   110 
   106 private slots:
   111 private slots:
   107 
   112 
   108     void updateBySpringPosition();
   113     void updateBySpringPosition();
   109     void redraw();
   114     void redraw();
   110     void updateLongPressVisualizer();
   115     void updateLongPressVisualizer();
   134     virtual qreal getCameraRotationY(qreal springVelocity);
   139     virtual qreal getCameraRotationY(qreal springVelocity);
   135     virtual void handleTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex);
   140     virtual void handleTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex);
   136     virtual void handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex);
   141     virtual void handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex);
   137     virtual void onScrollPositionChanged(qreal pos);
   142     virtual void onScrollPositionChanged(qreal pos);
   138     virtual void handleCurrentChanged(const QModelIndex &current);
   143     virtual void handleCurrentChanged(const QModelIndex &current);
   139     virtual QRectF drawableRect() const;
       
   140 
   144 
   141 protected:
   145 protected:
   142 
   146 
   143     enum ItemActionType
   147     enum ItemActionType
   144     {
   148     {
   156     bool handlePanning(QPanGesture *gesture);
   160     bool handlePanning(QPanGesture *gesture);
   157     bool handleTap(Qt::GestureState state, const QPointF &pos);
   161     bool handleTap(Qt::GestureState state, const QPointF &pos);
   158     bool handleLongTap(Qt::GestureState state, const QPointF &pos);
   162     bool handleLongTap(Qt::GestureState state, const QPointF &pos);
   159     bool handleItemAction(const QPointF &pos, ItemActionType action);
   163     bool handleItemAction(const QPointF &pos, ItemActionType action);
   160 
   164 
   161     void selectItem();
   165     void selectItem(int index);
   162     void updateSelectedItem();
   166     void updateSelectedItem();
   163     void unselectItem();
   167     void unselectItem();
   164 
   168 
   165     bool hasItemAt(const QPointF& pos);
   169     bool hasItemAt(const QPointF& pos);
   166     HgWidgetItem* getItemAt(const QPointF& pos, int& index);
   170     HgWidgetItem* getItemAt(const QPointF& pos, int& index);
   167     void startLongPressWatcher(const QPointF& pos);
   171     void startLongPressWatcher(const QPointF& pos);
   168     void stopLongPressWatcher();
   172     void stopLongPressWatcher();
   169     bool updateSelectionModel(HgWidgetItem* item);
   173     bool updateSelectionModel(HgWidgetItem* item);
   170 
   174 
   171     QTransform qtToVgTransform() const;
       
   172     QPointF mapQtToVg(const QPointF& p) const;
       
   173     
   175     
   174     virtual void updateItemSizeAndSpacing();
   176     virtual void updateItemSizeAndSpacing();
   175     virtual QSizeF getAutoItemSize() const;
   177     virtual QSizeF getAutoItemSize() const;
   176     virtual QSizeF getAutoItemSpacing() const;
   178     virtual QSizeF getAutoItemSpacing() const;
   177 
   179 
   194 
   196 
   195     bool mAnimateUsingScrollBar;
   197     bool mAnimateUsingScrollBar;
   196 
   198 
   197     HgWidget::SelectionMode mSelectionMode;
   199     HgWidget::SelectionMode mSelectionMode;
   198     QItemSelectionModel *mSelectionModel;
   200     QItemSelectionModel *mSelectionModel;
   199     HgImage *mMarkImage;
   201     HgImage *mMarkImageOn;
       
   202     HgImage *mMarkImageOff;
   200     
   203     
   201     qreal mSpringVelAtDragStart;
   204     qreal mSpringVelAtDragStart;
   202     bool mDragged;
   205     bool mDragged;
   203     int mFramesDragged;
   206     int mFramesDragged;
   204 
   207 
   217     HgWidget::ItemSizePolicy mItemSizePolicy;
   220     HgWidget::ItemSizePolicy mItemSizePolicy;
   218     QSizeF mUserItemSize;
   221     QSizeF mUserItemSize;
   219     QSizeF mUserItemSpacing;
   222     QSizeF mUserItemSpacing;
   220     
   223     
   221     Qt::Orientation mOrientation;
   224     Qt::Orientation mOrientation;
       
   225     QModelIndex mDelayedScrollToIndex;
       
   226     bool mIgnoreTap;
   222 };
   227 };
   223 
   228 
   224 #endif
   229 #endif