Applets
itemdelegate.h
Go to the documentation of this file.00001 /* 00002 Copyright 2007 Robert Knight <robertknight@gmail.com> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef ITEMDELEGATE_H 00021 #define ITEMDELEGATE_H 00022 00023 // Qt 00024 #include <QtGui/QAbstractItemDelegate> 00025 00026 //Plasma 00027 #include <plasma/delegate.h> 00028 00029 // Local 00030 #include "core/models.h" 00031 00032 namespace Kickoff 00033 { 00034 00043 class ItemDelegate : public Plasma::Delegate , public ItemStateProvider 00044 { 00045 public: 00046 ItemDelegate(QObject *parent = 0); 00047 virtual void paint(QPainter *painter,const QStyleOptionViewItem& option,const QModelIndex& index) const; 00048 00049 // reimplemented from ItemStateProvider 00050 virtual bool isVisible(const QModelIndex& index) const; 00051 00052 // margin is equivalent to ItemDelegate::BACK_ARROW_WIDTH + ItemDelegate::BACK_ARROW_SPACING 00053 static const int HEADER_LEFT_MARGIN = 5; 00054 static const int HEADER_TOP_MARGIN = 15; 00055 static const int HEADER_BOTTOM_MARGIN = 4; 00056 static const int HEADER_HEIGHT = 35; 00057 static const int FIRST_HEADER_HEIGHT = 20; 00058 00059 static const int ITEM_LEFT_MARGIN = 25; 00060 static const int ITEM_RIGHT_MARGIN = 7; 00061 static const int TOP_OFFSET = 5; 00062 00063 static const int BACK_ARROW_WIDTH = 20; 00064 static const int BACK_ARROW_SPACING = 5; 00065 }; 00066 00067 } 00068 00069 #endif // ITEMDELEGATE_H