2014-09-26 22:39:29 +08:00
|
|
|
/*
|
|
|
|
Copyright (C) 2014 by Project Tox <https://tox.im>
|
|
|
|
|
|
|
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
|
|
|
|
|
|
|
This program is libre 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 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the COPYING file for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MASKABLEPIXMAPWIDGET_H
|
|
|
|
#define MASKABLEPIXMAPWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class MaskablePixmapWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-10-01 02:10:42 +08:00
|
|
|
MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName = QString());
|
2014-09-26 22:39:29 +08:00
|
|
|
|
2014-09-30 02:18:03 +08:00
|
|
|
void autopickBackground();
|
|
|
|
void setBackground(QColor color);
|
2014-09-28 00:00:13 +08:00
|
|
|
void setClickable(bool clickable);
|
2014-10-01 02:10:42 +08:00
|
|
|
void setPixmap(const QPixmap &pmap, QColor background);
|
2014-09-26 22:39:29 +08:00
|
|
|
void setPixmap(const QPixmap &pmap);
|
|
|
|
QPixmap getPixmap() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void clicked();
|
|
|
|
|
|
|
|
protected:
|
2014-09-27 21:39:17 +08:00
|
|
|
virtual void paintEvent(QPaintEvent *);
|
2014-09-26 22:39:29 +08:00
|
|
|
virtual void mousePressEvent(QMouseEvent *);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPixmap pixmap;
|
|
|
|
QPixmap mask;
|
|
|
|
QSize size;
|
|
|
|
QString maskName;
|
2014-09-27 23:41:17 +08:00
|
|
|
QColor backgroundColor;
|
2014-09-28 00:00:13 +08:00
|
|
|
bool clickable;
|
2014-09-26 22:39:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MASKABLEPIXMAPWIDGET_H
|