~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/desktop/applets/kickoff/ui/itemdelegate.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright 2007 Robert Knight <robertknight@gmail.com>
 
3
 
 
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.
 
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 ITEMDELEGATE_H
 
21
#define ITEMDELEGATE_H
 
22
 
 
23
// Qt
 
24
#include <QtGui/QAbstractItemDelegate>
 
25
 
 
26
//Plasma
 
27
#include <Plasma/Delegate>
 
28
 
 
29
// Local
 
30
#include "core/models.h"
 
31
 
 
32
namespace Kickoff
 
33
{
 
34
 
 
35
/**
 
36
 * Item delegate for rendering items in the Kickoff launcher's views.
 
37
 *
 
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.
 
42
 */
 
43
class ItemDelegate : public Plasma::Delegate , public ItemStateProvider
 
44
{
 
45
public:
 
46
    ItemDelegate(QObject *parent = 0);
 
47
    virtual void paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
 
48
 
 
49
    // reimplemented from ItemStateProvider
 
50
    virtual bool isVisible(const QModelIndex& index) const;
 
51
 
 
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;
 
57
 
 
58
    static const int ITEM_LEFT_MARGIN = 12;
 
59
    static const int ITEM_RIGHT_MARGIN = 7;
 
60
    static const int TOP_OFFSET = 5;
 
61
};
 
62
 
 
63
}
 
64
 
 
65
#endif // ITEMDELEGATE_H