Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

blogdelegate.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Martin Mueller                                  *
00003  *   orvio@orvio.de                                                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef BLOKKALUIBLOGDELEGATE_H
00021 #define BLOKKALUIBLOGDELEGATE_H
00022 
00023 #include "checkboxdelegate.h"
00024 
00025 #include "../blokkal_export.h"
00026 
00027 namespace Blokkal {
00028 class Account;
00029 class Blog;
00030 namespace Ui {
00031 class BlogView;
00032 class BLOKKAL_EXPORT BlogDelegate : public Blokkal::Ui::CheckBoxDelegate
00033 {
00034 Q_OBJECT
00035 public:
00040         enum DisplayOptions {
00041                 DisplayAccountIcon = 0x001, 
00042                 DisplayBlogIcon = 0x002, 
00043                 DisplayBlogDescription = 0x004, 
00044                 DisplayBlogCount = 0x008, 
00045                 DisplayCheckBoxes = 0x010, 
00046                 DisplayAccountStates = 0x020 
00047         };
00048                 
00052         BlogDelegate( unsigned int displayOptions = 0 );
00053         ~BlogDelegate( void );
00054 
00055         unsigned int displayOptions( void ) const;
00056 
00060         virtual void paint( QPainter * painter,
00061                             const QStyleOptionViewItem & option,
00062                             const QModelIndex &index) const;
00063 
00067         virtual QSize sizeHint(const QStyleOptionViewItem & option,
00068                                const QModelIndex & index) const;
00069         
00070         virtual QRect checkBoxRect( const QStyleOptionViewItem & option,
00071                                     const QModelIndex & index ) const;
00072 
00073 protected:
00074         void layoutAccount( const QStyleOptionViewItem & option,
00075                             const Blokkal::Account * account,
00076                             QRect & iconRect,
00077                             QRect & textRect,
00078                             QRect & countRect ) const;
00079 
00080         void layoutBlog( const QStyleOptionViewItem & option,
00081                          const QModelIndex & index,
00082                          const Blokkal::Blog * blog,
00083                          QRect & iconRect,
00084                          QRect & textRect,
00085                          QRect & infoRect ) const;
00086 private:
00087         class Private;
00088         Private * const d;
00089 };
00090 }
00091 }
00092 #endif