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 ITEMDELEGATE_H
21
#define ITEMDELEGATE_H
24
#include <QtGui/QAbstractItemDelegate>
27
#include <Plasma/Delegate>
30
#include "core/models.h"
36
* Item delegate for rendering items in the Kickoff launcher's views.
38
* The delegate makes use of the various additional Kickoff item data roles
39
* to draw the item. For example, if the DiskFreeSpaceRole and DiskUsedSpaceRole item
40
* data is valid then a bar chart showing the amount of free space available on the disk
43
class ItemDelegate : public Plasma::Delegate , public ItemStateProvider
46
ItemDelegate(QObject *parent = 0);
47
virtual void paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
49
// reimplemented from ItemStateProvider
50
virtual bool isVisible(const QModelIndex& index) const;
52
static const int HEADER_LEFT_MARGIN = 5;
53
static const int HEADER_TOP_MARGIN = 15;
54
static const int HEADER_BOTTOM_MARGIN = 4;
55
static const int HEADER_HEIGHT = 35;
56
static const int FIRST_HEADER_HEIGHT = 20;
58
static const int ITEM_LEFT_MARGIN = 12;
59
static const int ITEM_RIGHT_MARGIN = 7;
60
static const int TOP_OFFSET = 5;
65
#endif // ITEMDELEGATE_H