/* ============================================================
 * File  : toolbar_bt.cpp
 * Author: Stephane Gibault
 * Date  : Sun Feb 4 2007
 * Description :
 *
 * 
 *  (C) 2007 by Stephane Gibault
 *
 * 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, 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.
 *
 * ============================================================ */
#include <QtGui>
#include "toolbar_bt.h"

toolbar_bt::toolbar_bt ( QWidget * parent )
    : QPushButton(parent)
{
	this->setAttribute(Qt::WA_DeleteOnClose);
	isover = 0;
}

void toolbar_bt::enterEvent ( QEvent * ) 
{
	isover = 1;
}

void toolbar_bt::leaveEvent ( QEvent * ) 
{
	isover = 0;
}

// ********************************
// *** DESSIN DU FOND DU WIDGET ***
// ********************************

void toolbar_bt::paintEvent(QPaintEvent *)
{
	QPainter p;
	p.begin(this);

        if ( this->isChecked() == true )
        {
                p.drawPixmap(1,1,QPixmap(":/new/prefix2/Interface/Theme/clic.png"));
        }
        else
        {
                if ( isover == 1 )
                {
                    p.drawPixmap(1,1,QPixmap(":/new/prefix2/Interface/Theme/over.png"));
                }
        }

        p.drawPixmap(2,2,this->icon().pixmap(this->width()-4, this->height()-4, QIcon::Normal, QIcon::On));

        p.end();
}

