not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / applets / kickoff / ui / itemdelegate.h
bloba84431adcb3cad69fc6072ca288bec521b2bd2f0
1 /*
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
23 // Qt
24 #include <QtGui/QAbstractItemDelegate>
26 //Plasma
27 #include <Plasma/Delegate>
29 // Local
30 #include "core/models.h"
32 namespace Kickoff
35 /**
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
41 * will be drawn.
43 class ItemDelegate : public Plasma::Delegate , public ItemStateProvider
45 public:
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 // margin is equivalent to ItemDelegate::BACK_ARROW_WIDTH + ItemDelegate::BACK_ARROW_SPACING
53 static const int HEADER_LEFT_MARGIN = 5;
54 static const int HEADER_TOP_MARGIN = 15;
55 static const int HEADER_BOTTOM_MARGIN = 4;
56 static const int HEADER_HEIGHT = 35;
57 static const int FIRST_HEADER_HEIGHT = 20;
59 static const int ITEM_LEFT_MARGIN = 25;
60 static const int ITEM_RIGHT_MARGIN = 7;
61 static const int TOP_OFFSET = 5;
63 static const int BACK_ARROW_WIDTH = 20;
64 static const int BACK_ARROW_SPACING = 5;
69 #endif // ITEMDELEGATE_H