]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinviewautoscroller.h
I'm very sorry for breaking the build: I forgot to add the new files :-(
[dolphin.git] / src / dolphinviewautoscroller.h
index 177c6ee0f4cde03aa001d94a058cec58d451aec2..a858d27cbf8f5c60407e3cad4a1acf075b4b96f9 100644 (file)
@@ -23,6 +23,7 @@
 #include <QObject>
 
 class QAbstractItemView;
+class QModelIndex;
 class QTimer;
 
 /**
@@ -38,27 +39,36 @@ class DolphinViewAutoScroller : public QObject
 public:
     DolphinViewAutoScroller(QAbstractItemView* parent);
     virtual ~DolphinViewAutoScroller();
-    
+    bool isActive() const;
+
+    /**
+     * Must be invoked by the parent item view, when QAbstractItemView::currentChanged()
+     * has been called. Assures that the current item stays visible when it has been
+     * changed by the keyboard.
+     */
+    void handleCurrentIndexChange(const QModelIndex& current, const QModelIndex& previous);
+
 protected:
     virtual bool eventFilter(QObject* watched, QEvent* event);
 
 private slots:
     void scrollViewport();
-    void scrollToCurrentIndex();
-    
+
 private:
     void triggerAutoScroll();
     void stopAutoScroll();
-    
+
     /**
-     * Calculates the scroll increment m_scrollInc dependent from
+     * Calculates the scroll increment dependent from
      * the cursor position \a cursorPos and the range 0 - \a rangeSize - 1.
      */
-    void calculateScrollIncrement(int cursorPos, int rangeSize);
-    
+    int calculateScrollIncrement(int cursorPos, int rangeSize) const;
+
 private:
     bool m_rubberBandSelection;
-    int m_scrollInc;
+    bool m_keyPressed;
+    int m_horizontalScrollInc;
+    int m_verticalScrollInc;
     QAbstractItemView* m_itemView;
     QTimer* m_timer;
 };