1 /*
2  * %kadu copyright begin%
3  * Copyright 2011 Piotr Galiszewski (piotr.galiszewski@kadu.im)
4  * Copyright 2010, 2014 Bartosz Brachaczek (b.brachaczek@gmail.com)
5  * Copyright 2010, 2011, 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
6  * %kadu copyright end%
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef LINE_EDIT_CLEAR_BUTTON_H
23 #define LINE_EDIT_CLEAR_BUTTON_H
24 
25 #include <QtGui/QIcon>
26 #include <QtWidgets/QWidget>
27 
28 class QTimeLine;
29 
30 class LineEditClearButton : public QWidget
31 {
32 	Q_OBJECT
33 
34 	QTimeLine *Timeline;
35 	QPixmap ButtonPixmap;
36 	QIcon ButtonIcon;
37 
38 	void setUpTimeLine();
39 
40 protected:
41 	void paintEvent(QPaintEvent *event);
42 	virtual bool event(QEvent *event);
43 
44 protected slots:
45 	void animationFinished();
46 
47 public:
48 	explicit LineEditClearButton(QWidget *parent);
49 	virtual ~LineEditClearButton();
50 
51 	void setPixmap(const QPixmap &buttonPixmap);
pixmap()52 	const QPixmap & pixmap() const { return ButtonPixmap; }
53 
sizeHint()54 	virtual QSize sizeHint() const { return ButtonPixmap.size(); }
55 
56 	void setAnimationsEnabled(bool animationsEnabled);
57 	void animateVisible(bool visible);
58 
59 };
60 
61 #endif // LINE_EDIT_CLEAR_BUTTON_H
62