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 #ifndef GUI_PHOTOVIEWWIDGET_H 00018 #define GUI_PHOTOVIEWWIDGET_H 00019 00020 //-------------------- 00021 //forward declarations 00022 class QPixmap; 00023 class QPoint; 00024 class Photo; 00025 //-------------------- 00026 00027 #include <qwidget.h> 00028 00029 //===================================== 00032 //===================================== 00033 class PhotoViewWidget : public QWidget 00034 { 00035 Q_OBJECT 00036 00037 public: 00039 PhotoViewWidget(QWidget *parent=0, 00040 const char* name=0); 00041 00043 ~PhotoViewWidget(); 00044 00046 void setPhoto(Photo* photo); 00047 00050 void getSelection(QPoint &topLeft, QPoint &bottomRight); 00051 //---------------------- 00052 protected: 00053 void paintEvent( QPaintEvent *e); 00054 void mousePressEvent( QMouseEvent *e); 00055 void mouseReleaseEvent( QMouseEvent *); 00056 void mouseMoveEvent( QMouseEvent *e); 00057 //---------------------- 00058 private slots: 00059 void selectAll(); 00060 //---------------------- 00061 private: 00063 QPoint cropSelectedPoint(QPoint p); 00064 00066 QPixmap* photo; 00067 00069 Photo* photoObject; 00070 00072 QPoint* corner1; 00073 00075 QPoint* corner2; 00076 00078 bool currentlyDragging; 00079 //---------------------- 00080 }; 00081 //====================== 00082 00083 #endif //GUI_PHOTOVIEWWIDGET_H
1.3.4