Add (and install) svg for the new krunner interface.
[kdebase/uwolfer.git] / workspace / plasma / applets / kickoff / ui / flipscrollview.h
blobbabd0e56c445a3d8b17e5d40b2494b0f63788d15
1 /*
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
23 // Qt
24 #include <QAbstractItemView>
26 namespace Kickoff
29 /**
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
37 * children.
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
46 Q_OBJECT
48 public:
49 /** Construct a new FlipScrollView with the specified parent. */
50 FlipScrollView(QWidget *parent = 0);
51 virtual ~FlipScrollView();
53 /** Go to the root item. */
54 void viewRoot();
56 // reimplemented from QAbstractItemView
57 virtual QModelIndex indexAt(const QPoint& point) const;
58 virtual void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible);
59 virtual QRect visualRect(const QModelIndex& index) const;
61 virtual void setModel(QAbstractItemModel *model);
63 protected:
64 // reimplemented from QWidget
65 virtual void paintEvent(QPaintEvent *event);
66 virtual void mouseMoveEvent(QMouseEvent *event);
67 virtual void mouseReleaseEvent(QMouseEvent *event);
68 virtual void resizeEvent(QResizeEvent *event);
69 virtual void keyPressEvent(QKeyEvent *event);
71 // reimplemented from QAbstractItemView
72 virtual bool isIndexHidden(const QModelIndex& index) const;
73 virtual int horizontalOffset() const;
74 virtual int verticalOffset() const;
75 virtual QRegion visualRegionForSelection(const QItemSelection& selection) const;
76 virtual QModelIndex moveCursor(CursorAction cursorAction,Qt::KeyboardModifiers modifiers);
77 virtual void setSelection(const QRect& rect , QItemSelectionModel::SelectionFlags flags);
78 virtual void startDrag(Qt::DropActions supportedActions);
80 private Q_SLOTS:
81 void openItem(const QModelIndex& index);
82 void updateFlipAnimation(qreal value);
84 private:
85 void paintItems(QPainter &painter, QPaintEvent *event, QModelIndex &index);
87 class Private;
88 Private * const d;
93 #endif // FLIPSCROLLVIEW_H