summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/thumbnaileditor.h
blob: 4a4484d9b91b2ddd1955ca6d1d320960d5ca7dee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/***************************************************************************
                          thumbnaileditor.h  -  description
                             -------------------
    begin                : Thu Mar 2 2005
    copyright            : (C) 2005 by Jason Harris
    email                : kstars@30doradus.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef THUMBNAILEDITOR_H
#define THUMBNAILEDITOR_H

#include <kdialogbase.h>
#include <tqlabel.h>

class ThumbnailEditorUI;
class ThumbnailPicker;
class TQPoint;

class ThumbImage : public TQLabel
{
Q_OBJECT
  
public:
	ThumbImage( TQWidget *parent, const char *name = 0 );
	~ThumbImage();

	void setImage( TQPixmap *pm ) { Image = pm; setFixedSize( Image->width(), Image->height() ); }
	TQPixmap* image() { return Image; }
	TQPixmap croppedImage();

	void setCropRect( int x, int y, int w, int h ) { CropRect->setRect( x, y, w, h ); }
	TQRect* cropRect() const { return CropRect; }

signals:
	void cropRegionModified();

protected:
//	void resizeEvent( TQResizeEvent *e);
	void paintEvent( TQPaintEvent *);
	void mousePressEvent( TQMouseEvent *e );
	void mouseReleaseEvent( TQMouseEvent *e );
	void mouseMoveEvent( TQMouseEvent *e );

private:
	TQRect *CropRect;
	TQPoint *Anchor;
	TQPixmap *Image;
	
	bool bMouseButtonDown;
	bool bTopLeftGrab, bBottomLeftGrab, bTopRightGrab, bBottomRightGrab;
	int HandleSize;
};

class ThumbnailEditor : public KDialogBase
{
Q_OBJECT
  
public:
	ThumbnailEditor( TQWidget *parent, const char *name=0 );
	~ThumbnailEditor();
	TQPixmap thumbnail();

private slots:
	void slotUpdateCropLabel();

private:
	ThumbnailEditorUI *ui;
	ThumbnailPicker *tp;

};

#endif