1 | /* |
2 | * This file is part of the KDE project |
3 | * Copyright (C) 2006-2008 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 version 2 as published by the Free Software Foundation. |
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 PROGRESSLISTDELEGATE_H |
21 | #define PROGRESSLISTDELEGATE_H |
22 | |
23 | #include <QModelIndex> |
24 | |
25 | #include <kwidgetitemdelegate.h> |
26 | |
27 | class QListView; |
28 | |
29 | class ProgressListDelegate |
30 | : public KWidgetItemDelegate |
31 | { |
32 | Q_OBJECT |
33 | Q_ENUMS(ProgressItemRole) |
34 | |
35 | public: |
36 | explicit ProgressListDelegate(QObject *parent = 0, QListView *listView = 0); |
37 | ~ProgressListDelegate(); |
38 | |
39 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; |
40 | QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; |
41 | |
42 | void setSeparatorPixels(int separatorPixels); |
43 | void setLeftMargin(int leftMargin); |
44 | void setRightMargin(int rightMargin); |
45 | void setMinimumItemHeight(int minimumItemHeight); |
46 | void setMinimumContentWidth(int minimumContentWidth); |
47 | void setEditorHeight(int editorHeight); |
48 | |
49 | protected: |
50 | virtual QList<QWidget*> createItemWidgets() const; |
51 | virtual void updateItemWidgets(const QList<QWidget*> widgets, |
52 | const QStyleOptionViewItem &option, |
53 | const QPersistentModelIndex &index) const; |
54 | |
55 | private Q_SLOTS: |
56 | void slotPauseResumeClicked(); |
57 | void slotCancelClicked(); |
58 | void slotClearClicked(); |
59 | |
60 | private: |
61 | class Private; |
62 | Private *d; |
63 | }; |
64 | |
65 | #endif // PROGRESSLISTDELEGATE_H |
66 | |