~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/desktop/applets/kickoff/ui/urlitemview.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

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 URLITEMVIEW_H
 
21
#define URLITEMVIEW_H
 
22
 
 
23
// Qt
 
24
#include <QAbstractItemView>
 
25
 
 
26
namespace Kickoff
 
27
{
 
28
 
 
29
class ItemStateProvider;
 
30
class UrlItemView : public QAbstractItemView
 
31
{
 
32
    Q_OBJECT
 
33
 
 
34
public:
 
35
    UrlItemView(QWidget *parent = 0);
 
36
    virtual ~UrlItemView();
 
37
 
 
38
    void setItemStateProvider(ItemStateProvider *provider);
 
39
    ItemStateProvider *itemStateProvider() const;
 
40
 
 
41
    // reimplemented from QAbstractItemView
 
42
    virtual QModelIndex indexAt(const QPoint& point) const;
 
43
    virtual void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible);
 
44
    virtual QRect visualRect(const QModelIndex& index) const;
 
45
    virtual void setModel(QAbstractItemModel *model);
 
46
 
 
47
    /* if nothing is selected, the first item is
 
48
     * @returns whether the selection has changed
 
49
     */
 
50
    bool initializeSelection();
 
51
 
 
52
protected:
 
53
    // reimplemented from QAbstractItemView
 
54
    virtual int horizontalOffset() const;
 
55
    virtual bool isIndexHidden(const QModelIndex& index) const;
 
56
    virtual QModelIndex moveCursor(CursorAction action, Qt::KeyboardModifiers modifiers);
 
57
    virtual void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags);
 
58
    virtual int verticalOffset() const;
 
59
    virtual QRegion visualRegionForSelection(const QItemSelection& selection) const;
 
60
    virtual void startDrag(Qt::DropActions supportedActions);
 
61
    virtual void dragEnterEvent(QDragEnterEvent *event);
 
62
    virtual void dragLeaveEvent(QDragLeaveEvent *event);
 
63
    virtual void dragMoveEvent(QDragMoveEvent *event);
 
64
 
 
65
    // reimplemented from QWidget
 
66
    virtual void paintEvent(QPaintEvent *event);
 
67
    virtual void resizeEvent(QResizeEvent *event);
 
68
    virtual void mouseMoveEvent(QMouseEvent *event);
 
69
    virtual void mousePressEvent(QMouseEvent *event);
 
70
    virtual void mouseReleaseEvent(QMouseEvent *event);
 
71
    virtual void dropEvent(QDropEvent *event);
 
72
    virtual void leaveEvent(QEvent *event);
 
73
 
 
74
 
 
75
private Q_SLOTS:
 
76
    // lays out all items in the view and sets the current index to the first
 
77
    // selectable item
 
78
    void updateLayout();
 
79
 
 
80
private:
 
81
    class Private;
 
82
    Private * const d;
 
83
};
 
84
 
 
85
}
 
86
 
 
87
#endif // URLITEMVIEW_H