moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / thumbnaileditor.h
blobd6da8d8510595c442164f4b99adca9fc05daa406
1 /***************************************************************************
2 thumbnaileditor.h - description
3 -------------------
4 begin : Thu Mar 2 2005
5 copyright : (C) 2005 by Jason Harris
6 email : kstars@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef THUMBNAILEDITOR_H
19 #define THUMBNAILEDITOR_H
21 #include <kdialogbase.h>
22 #include <qlabel.h>
24 class ThumbnailEditorUI;
25 class ThumbnailPicker;
26 class QPoint;
28 class ThumbImage : public QLabel
30 Q_OBJECT
31 public:
32 ThumbImage( QWidget *parent, const char *name = 0 );
33 ~ThumbImage();
35 void setImage( QPixmap *pm ) { Image = pm; setFixedSize( Image->width(), Image->height() ); }
36 QPixmap* image() { return Image; }
37 QPixmap croppedImage();
39 void setCropRect( int x, int y, int w, int h ) { CropRect->setRect( x, y, w, h ); }
40 QRect* cropRect() const { return CropRect; }
42 signals:
43 void cropRegionModified();
45 protected:
46 // void resizeEvent( QResizeEvent *e);
47 void paintEvent( QPaintEvent *);
48 void mousePressEvent( QMouseEvent *e );
49 void mouseReleaseEvent( QMouseEvent *e );
50 void mouseMoveEvent( QMouseEvent *e );
52 private:
53 QRect *CropRect;
54 QPoint *Anchor;
55 QPixmap *Image;
57 bool bMouseButtonDown;
58 bool bTopLeftGrab, bBottomLeftGrab, bTopRightGrab, bBottomRightGrab;
59 int HandleSize;
62 class ThumbnailEditor : public KDialogBase
64 Q_OBJECT
65 public:
66 ThumbnailEditor( QWidget *parent, const char *name=0 );
67 ~ThumbnailEditor();
68 QPixmap thumbnail();
70 private slots:
71 void slotUpdateCropLabel();
73 private:
74 ThumbnailEditorUI *ui;
75 ThumbnailPicker *tp;
79 #endif