Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / plasma / applets / devicenotifier / itemdelegate.h
blob9a61bd012698eed10f3601a3b8a99e4f9ce501f0
1 /*
2 Copyright 2007 Robert Knight <robertknight@gmail.com>
3 Copyright 2007 Alexis Menard <darktears31@gmail.com>
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.
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.
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.
22 #ifndef ITEMDELEGATE_H
23 #define ITEMDELEGATE_H
25 // Qt
26 #include <QtGui/QAbstractItemDelegate>
28 namespace Notifier
31 enum SpecificRoles {
32 SolidUdiRole = Qt::UserRole + 1,
33 PredicateFilesRole = Qt::UserRole + 2,
34 ActionRole = Qt::UserRole + 3
39 class ItemDelegate : public QAbstractItemDelegate
41 public:
43 ItemDelegate();
45 virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
46 virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
48 // margin is equivalent to ItemDelegate::BACK_ARROW_WIDTH + ItemDelegate::BACK_ARROW_SPACING
49 static const int HEADER_LEFT_MARGIN = 5;
50 static const int HEADER_TOP_MARGIN = 10;
51 static const int HEADER_BOTTOM_MARGIN = 10;
52 static const int HEADER_HEIGHT = 35;
53 static const int FIRST_HEADER_HEIGHT = 20;
55 static const int ICON_TEXT_MARGIN = 10;
56 static const int ICON_SIZE = 32;
58 static const int ITEM_LEFT_MARGIN = 5;
59 static const int ITEM_RIGHT_MARGIN = 7;
60 static const int ITEM_HEIGHT = 32;
61 static const int TOP_OFFSET = 5;
63 static const int BACK_ARROW_WIDTH = 20;
64 static const int BACK_ARROW_SPACING = 5;
66 private:
67 QPainterPath roundedRectangle(const QRectF &rect, qreal radius) const;
68 QFont fontForSubTitle(const QFont &titleFont) const;
72 #endif // ITEMDELEGATE_H