Main Page   Compound List   File List   Compound Members   File Members  

subalbumsIconView.cpp

Go to the documentation of this file.
00001 //==============================================
00002 //  copyright            : (C) 2003 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 //  As a special exception, Will Stokes gives permission to 
00011 //  link this program with Qt non-commercial edition, and 
00012 //  distribute the resulting executable, without including the 
00013 //  source code for the Qt non-commercial edition in the 
00014 //  source distribution. 
00015 //==============================================
00016 
00017 //Systemwide includes
00018 #include <qpixmap.h>
00019 #include <qpainter.h>
00020 
00021 //Projectwide includes
00022 #include "subalbumsIconView.h"
00023 
00024 #include <iostream.h>
00025 
00026 //==============================================
00027 SubalbumsIconView::SubalbumsIconView( QWidget *parent ) : QIconView( parent )
00028 {
00029 }
00030 //==============================================
00031 void SubalbumsIconView::contentsDropEvent( QDropEvent *e )
00032 {
00033   QIconView::contentsDropEvent( e );
00034 
00035   //get iconviewitem that was dropped  
00036   QIconViewItem *item = findItem( e->pos() );
00037   
00038   //if item exists and drop item was originally in this viewport then
00039   //user has dragged item within iconview, emit item has moved signal
00040   if( item != NULL && e->source() == viewport())
00041     emit itemHasMoved();
00042 }
00043 //==============================================
00044  void SubalbumsIconView::drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph )
00045 {
00046     if( bufferPixmap.size() != size())
00047     {  bufferPixmap.resize( size() ); }
00048     QPainter bufferPainter( &bufferPixmap, viewport() );
00049     int xOffset = clipx - contentsX();
00050     int yOffset = clipy - contentsY();
00051 
00052     bufferPainter.translate( -contentsX(), -contentsY() );
00053     QIconView::drawContents( &bufferPainter, clipx, clipy, clipw, cliph );
00054     bitBlt(p->device(), xOffset, yOffset, &bufferPixmap, xOffset, yOffset, clipw, cliph );
00055 }
00056 //==============================================

Generated on Tue Jun 10 23:41:21 2003 for AlbumShaper by doxygen 1.3.1