icon_view.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * icon_view.hpp : Icon view for the Playlist
00003  ****************************************************************************
00004  * Copyright © 2010 the VideoLAN team
00005  * $Id: 9f539990d05ceb2a63e894e1636cd56cc8154c2a $
00006  *
00007  * Authors:         Jean-Baptiste Kempf <jb@videolan.org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software Foundation, Inc.,
00021  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef _ICON_VIEW_H_
00025 #define _ICON_VIEW_H_
00026 
00027 #include <QStyledItemDelegate>
00028 #include <QListView>
00029 #include <QTreeView>
00030 
00031 class QPainter;
00032 class PLModel;
00033 
00034 class AbstractPlViewItemDelegate : public QStyledItemDelegate
00035 {
00036 public:
00037     AbstractPlViewItemDelegate( QWidget * parent = 0 ) : QStyledItemDelegate(parent) {}
00038     QString getMeta( const QModelIndex & index, int meta ) const;
00039     void paintBackground( QPainter *, const QStyleOptionViewItem &, const QModelIndex & ) const;
00040     QPixmap getArtPixmap( const QModelIndex & index, const QSize & size ) const;
00041 };
00042 
00043 class PlIconViewItemDelegate : public AbstractPlViewItemDelegate
00044 {
00045     Q_OBJECT
00046 
00047 public:
00048     PlIconViewItemDelegate(QWidget *parent = 0) : AbstractPlViewItemDelegate( parent ) {}
00049     void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
00050     QSize sizeHint ( const QStyleOptionViewItem & option = QStyleOptionViewItem(),
00051                      const QModelIndex & index = QModelIndex() ) const;
00052 };
00053 
00054 class PlListViewItemDelegate : public AbstractPlViewItemDelegate
00055 {
00056     Q_OBJECT
00057 
00058 public:
00059     PlListViewItemDelegate(QWidget *parent = 0) : AbstractPlViewItemDelegate(parent) {}
00060 
00061     void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
00062     QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
00063 };
00064 
00065 class PlIconView : public QListView
00066 {
00067     Q_OBJECT
00068 
00069 public:
00070     PlIconView( PLModel *model, QWidget *parent = 0 );
00071 private:
00072     void startDrag ( Qt::DropActions supportedActions );
00073     void dragMoveEvent ( QDragMoveEvent * event );
00074 };
00075 
00076 class PlListView : public QListView
00077 {
00078     Q_OBJECT
00079 
00080 public:
00081     PlListView( PLModel *model, QWidget *parent = 0 );
00082 private:
00083     void startDrag ( Qt::DropActions supportedActions );
00084     void dragMoveEvent ( QDragMoveEvent * event );
00085 };
00086 
00087 class PlTreeView : public QTreeView
00088 {
00089     Q_OBJECT
00090 
00091 private:
00092     void startDrag ( Qt::DropActions supportedActions );
00093     void dragMoveEvent ( QDragMoveEvent * event );
00094 };
00095 
00096 #endif
00097 

Generated on Tue May 25 08:04:57 2010 for VLC by  doxygen 1.5.6