/***************************************************************************
 *   Project TupiTube Desk                                                 *
 *   Project Contact: info@tupitube.com                                    *
 *   Project Website: http://www.tupitube.com                              * 
 *                                                                         *
 *   Developers:                                                           *
 *   2025:                                                                 *
 *    Utopian Lab Development Team                                         *
 *   2010:                                                                 *
 *    Gustav Gonzalez                                                      *
 *   ---                                                                   *
 *   KTooN's versions:                                                     *
 *   2006:                                                                 *
 *    David Cuadrado                                                       *
 *    Jorge Cuadrado                                                       *
 *   2003:                                                                 *
 *    Fernado Roldan                                                       *
 *    Simena Dinas                                                         *
 *                                                                         *
 *   License:                                                              *
 *   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.                                   *
 *                                                                         *
 *   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         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
 ***************************************************************************/

#ifndef TUPBUTTONITEM_H
#define TUPBUTTONITEM_H

#include "tupabstractserializable.h"
#include "tglobal.h"

#include <QGraphicsItem>
#include <QIcon>
#include <QFont>

class TUPITUBE_EXPORT TupButtonItem : public QObject, public QGraphicsItem, public TupAbstractSerializable
{
    Q_OBJECT
    Q_INTERFACES(QGraphicsItem)

    public:
        TupButtonItem(QGraphicsItem *parent = nullptr);
        ~TupButtonItem();
        
        virtual void fromXml(const QString &xml);
        virtual QDomElement toXml(QDomDocument &doc) const;
        
        virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *w);
        QRectF boundingRect() const;
        
        virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
        virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
        virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
        
    public:
        void setIconSize(const QSize &size);
        void setIcon(const QIcon &icon);
        void setText(const QString &text);
        void setFont(const QFont &font);
        
    signals:
        void clicked();
        
    private:
        QSize m_iconSize;
        QIcon m_icon;
        QString m_text;
        QFont m_font;
};

#endif
