]> cloud.milkyroute.net Git - dolphin.git/blob - src/kcategorizedview.h
Factorize all the view-related action handling to DolphinViewActionHandler, to remove...
[dolphin.git] / src / kcategorizedview.h
1 /**
2 * This file is part of the KDE project
3 * Copyright (C) 2007 Rafael Fernández López <ereslibre@kde.org>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifndef KCATEGORIZEDVIEW_H
22 #define KCATEGORIZEDVIEW_H
23
24 #include <QtGui/QListView>
25
26 #include <libdolphin_export.h>
27
28 class KCategoryDrawer;
29
30 /**
31 * @short Item view for listing items
32 *
33 * KCategorizedView allows you to use it as it were a QListView. You can add an
34 * itemCategorizer to it, so your items became categorized depending on the
35 * KItemCategorizer inherited class rules.
36 *
37 * @see KItemCategorizer, KSortFilterProxyModel
38 *
39 * @author Rafael Fernández López <ereslibre@kde.org>
40 */
41 class LIBDOLPHINPRIVATE_EXPORT KCategorizedView
42 : public QListView
43 {
44 Q_OBJECT
45
46 public:
47 KCategorizedView(QWidget *parent = 0);
48
49 ~KCategorizedView();
50
51 virtual void setModel(QAbstractItemModel *model);
52
53 void setGridSize(const QSize &size);
54
55 virtual QRect visualRect(const QModelIndex &index) const;
56
57 KCategoryDrawer *categoryDrawer() const;
58
59 void setCategoryDrawer(KCategoryDrawer *categoryDrawer);
60
61 virtual QModelIndex indexAt(const QPoint &point) const;
62
63 public Q_SLOTS:
64 virtual void reset();
65
66 protected:
67 virtual void paintEvent(QPaintEvent *event);
68
69 virtual void resizeEvent(QResizeEvent *event);
70
71 virtual void setSelection(const QRect &rect,
72 QItemSelectionModel::SelectionFlags flags);
73
74 virtual void mouseMoveEvent(QMouseEvent *event);
75
76 virtual void mousePressEvent(QMouseEvent *event);
77
78 virtual void mouseReleaseEvent(QMouseEvent *event);
79
80 virtual void leaveEvent(QEvent *event);
81
82 virtual void startDrag(Qt::DropActions supportedActions);
83
84 virtual void dragMoveEvent(QDragMoveEvent *event);
85
86 virtual void dragLeaveEvent(QDragLeaveEvent *event);
87
88 virtual void dropEvent(QDropEvent *event);
89
90 virtual QModelIndex moveCursor(CursorAction cursorAction,
91 Qt::KeyboardModifiers modifiers);
92
93 protected Q_SLOTS:
94 virtual void rowsInserted(const QModelIndex &parent,
95 int start,
96 int end);
97
98 virtual void rowsInsertedArtifficial(const QModelIndex &parent,
99 int start,
100 int end);
101
102 virtual void rowsRemoved(const QModelIndex &parent,
103 int start,
104 int end);
105
106 virtual void updateGeometries();
107
108 virtual void slotLayoutChanged();
109
110 virtual void currentChanged(const QModelIndex &current,
111 const QModelIndex &previous);
112
113
114 private:
115 class Private;
116 Private *d;
117 };
118
119 #endif // KCATEGORIZEDVIEW_H