~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy

« back to all changes in this revision

Viewing changes to plasma/kickoff/src/ui/flipscrollview.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-10-11 14:04:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071011140448-v0eb7lxbb24zagca
Tags: 3.94.0-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  
 
2
    Copyright 2007 Robert Knight <robertknight@gmail.com>
 
3
 
 
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.
 
8
 
 
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.
 
13
 
 
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.
 
18
*/
 
19
 
 
20
#ifndef FLIPSCROLLVIEW_H
 
21
#define FLIPSCROLLVIEW_H
 
22
 
 
23
// Qt
 
24
#include <QAbstractItemView>
 
25
 
 
26
namespace Kickoff
 
27
{
 
28
 
 
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).
 
32
 *
 
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.
 
38
 * 
 
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.
 
43
 */
 
44
class FlipScrollView : public QAbstractItemView
 
45
{
 
46
Q_OBJECT 
 
47
 
 
48
public:
 
49
    /** Construct a new FlipScrollView with the specified parent. */
 
50
    FlipScrollView(QWidget *parent = 0);
 
51
    virtual ~FlipScrollView();
 
52
 
 
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;
 
57
 
 
58
    virtual void setModel(QAbstractItemModel *model);
 
59
 
 
60
protected:
 
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);
 
66
 
 
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);
 
74
 
 
75
private Q_SLOTS:
 
76
    void openItem(const QModelIndex& index);
 
77
    void updateFlipAnimation(qreal value);
 
78
 
 
79
private:
 
80
    class Private;
 
81
    Private * const d;
 
82
};
 
83
 
 
84
}
 
85
 
 
86
#endif // FLIPSCROLLVIEW_H