Applets
flipscrollview.h
Go to the documentation of this file.00001 /* 00002 Copyright 2007 Robert Knight <robertknight@gmail.com> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef FLIPSCROLLVIEW_H 00021 #define FLIPSCROLLVIEW_H 00022 00023 // Qt 00024 #include <QAbstractItemView> 00025 00026 namespace Kickoff 00027 { 00028 00044 class FlipScrollView : public QAbstractItemView 00045 { 00046 Q_OBJECT 00047 00048 public: 00050 FlipScrollView(QWidget *parent = 0); 00051 virtual ~FlipScrollView(); 00052 00054 void viewRoot(); 00055 00056 // reimplemented from QAbstractItemView 00057 virtual QModelIndex indexAt(const QPoint& point) const; 00058 virtual void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible); 00059 virtual QRect visualRect(const QModelIndex& index) const; 00060 00061 int itemHeight() const; 00062 00063 protected: 00064 // reimplemented from QWidget 00065 virtual void paintEvent(QPaintEvent *event); 00066 virtual void mouseMoveEvent(QMouseEvent *event); 00067 virtual void mousePressEvent(QMouseEvent *event); 00068 virtual void mouseReleaseEvent(QMouseEvent *event); 00069 virtual void resizeEvent(QResizeEvent *event); 00070 virtual void keyPressEvent(QKeyEvent *event); 00071 virtual void leaveEvent(QEvent *event); 00072 00073 // reimplemented from QAbstractItemView 00074 virtual bool isIndexHidden(const QModelIndex& index) const; 00075 virtual int horizontalOffset() const; 00076 virtual int verticalOffset() const; 00077 virtual QRegion visualRegionForSelection(const QItemSelection& selection) const; 00078 virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); 00079 virtual void setSelection(const QRect& rect , QItemSelectionModel::SelectionFlags flags); 00080 virtual void startDrag(Qt::DropActions supportedActions); 00081 00082 private Q_SLOTS: 00083 void openItem(const QModelIndex& index); 00084 void updateFlipAnimation(qreal value); 00085 00086 private: 00087 void paintItems(QPainter &painter, QPaintEvent *event, QModelIndex &index); 00088 00089 class Private; 00090 Private * const d; 00091 }; 00092 00093 } 00094 00095 #endif // FLIPSCROLLVIEW_H