kstars
thumbnaileditor.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef THUMBNAILEDITOR_H
00019 #define THUMBNAILEDITOR_H
00020
00021 #include <kdialogbase.h>
00022 #include <qlabel.h>
00023
00024 class ThumbnailEditorUI;
00025 class ThumbnailPicker;
00026 class QPoint;
00027
00028 class ThumbImage : public QLabel
00029 {
00030 Q_OBJECT
00031 public:
00032 ThumbImage( QWidget *parent, const char *name = 0 );
00033 ~ThumbImage();
00034
00035 void setImage( QPixmap *pm ) { Image = pm; setFixedSize( Image->width(), Image->height() ); }
00036 QPixmap* image() { return Image; }
00037 QPixmap croppedImage();
00038
00039 void setCropRect( int x, int y, int w, int h ) { CropRect->setRect( x, y, w, h ); }
00040 QRect* cropRect() const { return CropRect; }
00041
00042 signals:
00043 void cropRegionModified();
00044
00045 protected:
00046
00047 void paintEvent( QPaintEvent *);
00048 void mousePressEvent( QMouseEvent *e );
00049 void mouseReleaseEvent( QMouseEvent *e );
00050 void mouseMoveEvent( QMouseEvent *e );
00051
00052 private:
00053 QRect *CropRect;
00054 QPoint *Anchor;
00055 QPixmap *Image;
00056
00057 bool bMouseButtonDown;
00058 bool bTopLeftGrab, bBottomLeftGrab, bTopRightGrab, bBottomRightGrab;
00059 int HandleSize;
00060 };
00061
00062 class ThumbnailEditor : public KDialogBase
00063 {
00064 Q_OBJECT
00065 public:
00066 ThumbnailEditor( QWidget *parent, const char *name=0 );
00067 ~ThumbnailEditor();
00068 QPixmap thumbnail();
00069
00070 private slots:
00071 void slotUpdateCropLabel();
00072
00073 private:
00074 ThumbnailEditorUI *ui;
00075 ThumbnailPicker *tp;
00076
00077 };
00078
00079 #endif