AlbumShaper
1.0a3
|
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_EDITING_SELECTIONPLACEMENTINTERFACE_H 00012 #define GUI_EDITING_SELECTIONPLACEMENTINTERFACE_H 00013 00014 //-------------------- 00015 //forward declarations 00016 //-------------------- 00017 00018 #include <qwidget.h> 00019 #include <qimage.h> 00020 #include <qpoint.h> 00021 #include <qsize.h> 00022 00023 //===================================== 00025 //===================================== 00026 class SelectionPlacementInterface : public QWidget 00027 { 00028 Q_OBJECT 00029 00030 public: 00032 SelectionPlacementInterface(QString imageFilename, 00033 QWidget *parent=0, 00034 const char* name=0); 00035 00037 ~SelectionPlacementInterface(); 00038 00040 QRect getSelectedRegion(); 00041 00043 void setSelectedRegion(QRect selection); 00044 00045 virtual QSize sizeHint() const; 00046 virtual QSize minimumSizeHint() const; 00047 //---------------------- 00048 protected: 00049 void paintEvent( QPaintEvent *e); 00050 void mousePressEvent( QMouseEvent *e); 00051 void mouseReleaseEvent( QMouseEvent *); 00052 void mouseMoveEvent( QMouseEvent *e); 00053 //---------------------- 00054 private: 00056 QRect imageToDisplay( QRect r ); 00057 00059 bool overRegion( QPoint p ); 00060 00062 void recenterSelection(QPoint mousePosition); 00063 00065 QImage scaledImage; 00066 00068 QImage unselectedScaledImage; 00069 00071 QSize origImageSize; 00072 00074 QRect selection; 00075 00078 bool currentlyDragging; 00079 00082 bool currentMouseShapeIsDrag; 00083 //---------------------- 00084 signals: 00085 //emitted as the user drags the selection around 00086 void placementChanged( QRect ); 00087 //---------------------- 00088 }; 00089 //====================== 00090 00091 #endif //GUI_EDITING_SELECTIONPLACEMENTINTERFACE_H