F:/KPlato/koffice/libs/kofficeui/KoDocumentSectionDelegate.h

Aller à la documentation de ce fichier.
00001 /*
00002   Copyright (c) 2006 Gábor Lehel <illissius@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 KO_DOCUMENT_SECTION_DELEGATE_H
00021 #define KO_DOCUMENT_SECTION_DELEGATE_H
00022 
00023 #include <QAbstractItemDelegate>
00024 #include <koffice_export.h>
00025 #include "KoDocumentSectionView.h"
00026 
00027 class QTreeView;
00028 class KoDocumentSectionModel;
00029 class KoDocumentSectionToolTip;
00030 
00031 class KOFFICEUI_EXPORT KoDocumentSectionDelegate: public QAbstractItemDelegate
00032 {
00033     typedef QAbstractItemDelegate super;
00034     Q_OBJECT
00035 
00036     public:
00037         KoDocumentSectionDelegate( KoDocumentSectionView *view, QObject *parent = 0 );
00038         virtual ~KoDocumentSectionDelegate();
00039 
00040         virtual void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00041         virtual QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00042         virtual bool editorEvent( QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index );
00043 
00044         virtual QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00045         virtual void setEditorData( QWidget *editor, const QModelIndex &index ) const;
00046         virtual void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const;
00047         virtual void updateEditorGeometry( QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex& index ) const;
00048 
00049 
00050     protected:
00051         virtual bool eventFilter( QObject *object, QEvent *event );
00052 
00053 
00054     private:
00055         typedef KoDocumentSectionModel Model;
00056         typedef KoDocumentSectionView View;
00057         class Private;
00058         Private* const d;
00059 
00060         static QStyleOptionViewItem getOptions( const QStyleOptionViewItem &option, const QModelIndex &index );
00061         int thumbnailHeight( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00062         int availableWidth( const QModelIndex &index ) const;
00063         int textBoxHeight( const QStyleOptionViewItem &option ) const;
00064         QRect textRect( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00065         QRect iconsRect( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00066         QRect thumbnailRect( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00067         QRect decorationRect( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00068         void drawText( QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00069         void drawIcons( QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00070         void drawThumbnail( QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00071         void drawDecoration( QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
00072 };
00073 
00074 #endif

Généré le Wed Nov 22 23:41:04 2006 pour KPlato par  doxygen 1.5.1-p1