1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8                           gradienteditor  -  description
9                              -------------------
10     begin                : Mit Mai 26 2004
11     copyright            : (C) 2004 by Franz Schmid
12     email                : Franz.Schmid@altmuehlnet.de
13  ***************************************************************************/
14 
15 /***************************************************************************
16  *                                                                         *
17  *   This program is free software; you can redistribute it and/or modify  *
18  *   it under the terms of the GNU General Public License as published by  *
19  *   the Free Software Foundation; either version 2 of the License, or     *
20  *   (at your option) any later version.                                   *
21  *                                                                         *
22  ***************************************************************************/
23 
24 #ifndef GRADIENTPREVIEW_H
25 #define GRADIENTPREVIEW_H
26 
27 #include <QList>
28 #include <QFrame>
29 #include <QPaintEvent>
30 #include <QMouseEvent>
31 #include <QKeyEvent>
32 #include <QVBoxLayout>
33 #include <QHBoxLayout>
34 
35 class QEvent;
36 
37 #include "scribusapi.h"
38 #include "vgradient.h"
39 
40 class SCRIBUS_API GradientPreview : public QFrame
41 {
42 	Q_OBJECT
43 
44 public:
45 	GradientPreview(QWidget *pa);
~GradientPreview()46 	~GradientPreview() {};
47 	void paintEvent(QPaintEvent *e);
48 	void keyPressEvent(QKeyEvent *);
49 	void mousePressEvent(QMouseEvent *m);
50 	void mouseReleaseEvent(QMouseEvent *);
51 	void mouseMoveEvent(QMouseEvent *m);
52 	void leaveEvent(QEvent*);
53 	void enterEvent(QEvent*);
54 	void updateDisplay();
55 	void setActColor(const QColor& c, const QString& n, int s);
56 	void setActTrans(double t);
57 	void setActStep(double t);
58 	void setGradient(const VGradient& gradient);
59 	void setGradientEditable(bool val);
60 
gradient()61 	const VGradient& gradient() { return fill_gradient; }
62 
63 	QList<int> StopM;
64 	bool Mpressed;
65 	bool outside;
66 	bool onlyselect;
67 	bool isEditable;
68 	int ActStop;
69 	int contextStop;
70 	QPoint mPos;
71 
72 private:
73 
74 	VGradient fill_gradient;
75 
76 private slots:
77 	void addStop();
78 	void removeStop();
79 
80 signals:
81 	void selectedColor(QString, int);
82 	void selectedStop(VColorStop*);
83 	void currTrans(double);
84 	void currStep(double);
85 	void gradientChanged();
86 };
87 #endif
88