2
Copyright 2007 Robert Knight <robertknight@gmail.com>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
20
#ifndef FLIPSCROLLVIEW_H
21
#define FLIPSCROLLVIEW_H
24
#include <QAbstractItemView>
30
* An "iPod-style" item view for single-column tree and list data models which
31
* displays items in pages (one per tree branch).
33
* Clicking on an item which has children (eg. a folder in a directory model)
34
* scrolls the whole contents of the view to show the items children. A large back
35
* arrow is displayed on the left of the display if the current item has a valid parent,
36
* when clicked on this scrolls the whole contents of the view to show the parent item's
39
* The view assumes that the item delegate will fill the background with the current palette's
40
* highlight color when the user hovers over items with the mouse. Item delegates should check
41
* for the QStyle::State_MouseOver or QStyle::State_Selected flags in the state
42
* field of the QStyleOptionViewItem passed to the QAbstractItemDelegate::paint() method.
44
class FlipScrollView : public QAbstractItemView
49
/** Construct a new FlipScrollView with the specified parent. */
50
FlipScrollView(QWidget *parent = 0);
51
virtual ~FlipScrollView();
53
// reimplemented from QAbstractItemView
54
virtual QModelIndex indexAt(const QPoint& point) const;
55
virtual void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible);
56
virtual QRect visualRect(const QModelIndex& index) const;
58
virtual void setModel(QAbstractItemModel *model);
61
// reimplemented from QWidget
62
virtual void paintEvent(QPaintEvent *event);
63
virtual void mouseMoveEvent(QMouseEvent *event);
64
virtual void mouseReleaseEvent(QMouseEvent *event);
65
virtual void resizeEvent(QResizeEvent *event);
67
// reimplemented from QAbstractItemView
68
virtual bool isIndexHidden(const QModelIndex& index) const;
69
virtual int horizontalOffset() const;
70
virtual int verticalOffset() const;
71
virtual QRegion visualRegionForSelection(const QItemSelection& selection) const;
72
virtual QModelIndex moveCursor(CursorAction cursorAction,Qt::KeyboardModifiers modifiers);
73
virtual void setSelection(const QRect& rect , QItemSelectionModel::SelectionFlags flags);
76
void openItem(const QModelIndex& index);
77
void updateFlipAnimation(qreal value);
86
#endif // FLIPSCROLLVIEW_H