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_PHOTOPREVIEWWIDGET_H 00012 #define GUI_PHOTOPREVIEWWIDGET_H 00013 00014 //-------------------- 00015 //forward declarations 00016 class QPixmap; 00017 class QString; 00018 class Photo; 00019 //-------------------- 00020 00021 #define PHOTO_MARGIN 4 00022 #define PHOTO_SHADOW 3 00023 #define PHOTO_SHADOW_END_OFFSET 2 00024 #define PHOTO_TEXT_MARGIN 1 00025 00026 #include <qiconview.h> 00027 00028 //===================================== 00031 //===================================== 00032 class PhotoPreviewWidget : public QIconViewItem 00033 { 00034 public: 00036 PhotoPreviewWidget( QIconView *parent, Photo* phto ); 00037 00039 Photo* getPhoto(); 00040 00042 void updateImage(); 00043 00045 void updateDescription(); 00046 00047 void paint( QPainter *p ); 00048 00050 void paintItem( QPainter* p, 00051 const QColorGroup& cg); 00052 00053 void paintFocus( QPainter *p, const QColorGroup &cg ); 00054 00055 void setText ( const QString & text ); 00056 00057 void setPixmap(const QPixmap& p, bool redraw); 00058 00059 bool acceptDrop( const QMimeSource *e) const; 00060 00061 int compare ( QIconViewItem * i ) const; 00062 00063 void setMousedOver(bool val); 00064 00065 QRect getPhotoInfoRect(); 00066 00067 //returns the top left corner of the displayed image in screen coordinates 00068 QPoint getPhotoPos(); 00069 //---------------------- 00070 private: 00071 void initializeItemRect(); 00072 00074 Photo* phto; 00075 00076 int calibratedWidth; 00077 00078 bool mousedOver; 00079 00080 QRect photoInfoRect; 00081 00083 int pixmapXOffset, pixmapYOffset; 00085 }; 00086 //====================== 00087 00088 #endif //GUI_PHOTOPREVIEWWIDGET_H