00001 //============================================== 00002 // copyright : (C) 2003-2005 by Will Stokes 00003 //============================================== 00004 // This program is free software; you can redistribute it 00005 // and/or modify it under the terms of the GNU General 00006 // Public License as published by the Free Software 00007 // Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 //============================================== 00010 00011 #ifndef GUI_SUBALBUMPREVIEWWIDGET_H 00012 #define GUI_SUBALBUMPREVIEWWIDGET_H 00013 00014 //-------------------- 00015 //forward declarations 00016 class Subalbum; 00017 class QPixmap; 00018 class QString; 00019 class SubalbumsIconView; 00020 //-------------------- 00021 00022 #include <qiconview.h> 00023 #include <qobject.h> 00024 00025 //===================================== 00028 //===================================== 00029 class SubalbumPreviewWidget : public QIconViewItem 00030 { 00031 public: 00033 SubalbumPreviewWidget( SubalbumsIconView* parent, 00034 Subalbum* salbum ); 00035 00037 Subalbum* getSubalbum(); 00038 00039 void paintFocus( QPainter *p, const QColorGroup &cg ); 00040 00041 bool acceptDrop( const QMimeSource *e) const; 00042 00043 int compare ( QIconViewItem * i ) const; 00044 00045 static QPixmap* createSubalbumPixmap( QString imageName ); 00046 00047 void setText ( const QString & text ); 00048 void setMousedOver(bool val); 00049 void paint( QPainter *p ); 00050 //---------------------- 00051 protected: 00052 void calcRect ( const QString & text_ = QString::null ); 00053 void paintItem( QPainter* p, 00054 const QColorGroup& cg); 00055 //---------------------- 00056 private: 00057 void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); 00058 00059 QColor blendColors( QColor a, QColor b, double alpha); 00060 00062 Subalbum* subalbum; 00063 00065 QPixmap* subalbumPreviewImage; 00066 00068 QString* subalbumName; 00069 00071 SubalbumsIconView* parent; 00072 00074 bool mousedOver; 00075 00076 //initializes item rect size 00077 void initializeItemRect(); 00078 //---------------------- 00079 }; 00080 //====================== 00081 00082 #endif //GUI_SUBALBUMPREVIEWWIDGET_H