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 void keyReleaseEvent( QKeyEvent *e); 00058 //---------------------- 00059 private slots: 00060 void selectAll(); 00061 //---------------------- 00062 private: 00064 QPoint cropSelectedPoint(QPoint p); 00065 00067 QPixmap* photo; 00068 00070 Photo* photoObject; 00071 00073 QPoint* corner1; 00074 00076 QPoint* corner2; 00077 00079 bool currentlyDragging; 00080 //---------------------- 00081 }; 00082 //====================== 00083 00084 #endif //GUI_PHOTOVIEWWIDGET_H