Main Page   Compound List   File List   Compound Members   File Members  

PhotoWidget Class Reference

#include <photoWidget.h>

List of all members.


Detailed Description

Displays photo thumbnail and description.

Definition at line 34 of file photoWidget.h.

Public Member Functions

 PhotoWidget (PhotosIconView *parent, Photo *phto)
 Sets subalbum pointer.

Photo * getPhoto ()
 Returns photo pointer.

void sync ()
 Syncs photo's description.

void updateImage ()
 Update photo thumbnail from background object.

void updateDescription ()
 Update photo description.

void paintItem (QPainter *p, const QColorGroup &cg)
 Repain iconview item.

void setText (const QString &text)
bool acceptDrop (const QMimeSource *e) const
int compare (QIconViewItem *i) const

Private Member Functions

void dropped (QDropEvent *e, const QValueList< QIconDragItem > &lst)

Private Attributes

Photo * phto
 Pointer to photo backend object.

PhotosIconView * parent
 Parent.


Constructor & Destructor Documentation

PhotoWidget::PhotoWidget PhotosIconView *  parent,
Photo *  phto
 

Sets subalbum pointer.

Definition at line 30 of file photoWidget.cpp.

References PADDED_THUMBNAIL, and phto.

00031                                         : QIconViewItem( parent,
00032                                                          phto->getDescription(),
00033                                                          *phto->getImage(PADDED_THUMBNAIL) )
00034 {
00035   this->parent = parent;
00036   this->phto = phto;
00037 }


Member Function Documentation

bool PhotoWidget::acceptDrop const QMimeSource *  e  )  const
 

Definition at line 116 of file photoWidget.cpp.

00117 {
00118   return true;
00119 }

int PhotoWidget::compare QIconViewItem *  i  )  const
 

Definition at line 121 of file photoWidget.cpp.

00122 {
00123   if( pos().y() > (i->pos().y() + height()) ||
00124       (
00125         pos().y() >= i->pos().y() &&
00126         pos().x() >= i->pos().x()
00127       ))
00128   { return 1; }
00129   else
00130   { return -1; }
00131 }

void PhotoWidget::dropped QDropEvent *  e,
const QValueList< QIconDragItem > &  lst
[private]
 

Definition at line 101 of file photoWidget.cpp.

References parent.

00102 {
00103   if(e->source()->parentWidget() == parent)
00104   {
00105     if(e->pos().x() < (x() + (width()/2)))
00106     {
00107       parent->currentItem()->move(x() - 1, y());
00108     }
00109     else
00110     {
00111       parent->currentItem()->move(x() + (width()/2) + 1, y());
00112     }
00113   }
00114 }

Photo * PhotoWidget::getPhoto  ) 
 

Returns photo pointer.

Definition at line 39 of file photoWidget.cpp.

References phto.

Referenced by Subalbum::syncPhotoList().

00040 {
00041   return phto;
00042 }

void PhotoWidget::paintItem QPainter *  p,
const QColorGroup &  cg
 

Repain iconview item.

Definition at line 59 of file photoWidget.cpp.

00061 {
00062   if(isSelected())
00063   {
00064     //draw red border around item
00065     int align = AlignHCenter;
00066     align |= WordBreak | BreakAnywhere;
00067     
00068     //create buffer to draw in
00069     QRect rct = rect();
00070     rct.moveBy(-x(), -y());
00071     QPixmap buffer( size() );
00072     //create a painter pointing to the buffer
00073     QPainter bp( &buffer );
00074     //paint to buffer
00075     bp.setBrushOrigin( p->brushOrigin() );
00076     bp.fillRect( rct, white );
00077     QRect pr = pixmapRect(false);
00078     pr.moveBy(-x(), -y());
00079     bp.drawPixmap(pr, *pixmap());
00080     QRect tr = textRect(false);
00081     tr.moveBy(-x(), -y());
00082     bp.drawText(tr,align, text());
00083     bp.setPen( red );    
00084     bp.drawRect(rct); 
00085     bp.end();
00086     //paint buffer to widget
00087     p->drawPixmap( x(), y(), buffer );
00088   }
00089   else
00090   {
00091     QIconViewItem::paintItem ( p, cg);
00092   }
00093 }

void PhotoWidget::setText const QString &  text  ) 
 

Definition at line 95 of file photoWidget.cpp.

References sync().

Referenced by updateDescription().

00096 {
00097   sync();
00098   QIconViewItem::setText(text);
00099 }

void PhotoWidget::sync  ) 
 

Syncs photo's description.

Definition at line 44 of file photoWidget.cpp.

References phto, and Photo::setDescription().

Referenced by setText(), and SubalbumWidget::syncPhotos().

00045 {
00046   phto->setDescription(text());  
00047 }

void PhotoWidget::updateDescription  ) 
 

Update photo description.

Definition at line 54 of file photoWidget.cpp.

References Photo::getDescription(), phto, and setText().

00055 {
00056   this->setText( phto->getDescription() );
00057 }

void PhotoWidget::updateImage  ) 
 

Update photo thumbnail from background object.

Definition at line 49 of file photoWidget.cpp.

References Photo::getImage(), PADDED_THUMBNAIL, and phto.

00050 {
00051   this->setPixmap(*(phto->getImage(PADDED_THUMBNAIL)));
00052 }


Member Data Documentation

PhotosIconView* PhotoWidget::parent [private]
 

Parent.

Definition at line 70 of file photoWidget.h.

Referenced by dropped().

Photo* PhotoWidget::phto [private]
 

Pointer to photo backend object.

Definition at line 67 of file photoWidget.h.

Referenced by getPhoto(), PhotoWidget(), sync(), updateDescription(), and updateImage().


The documentation for this class was generated from the following files:
Generated on Tue Jun 10 23:41:23 2003 for AlbumShaper by doxygen 1.3.1