
#include "TTip.h"
#include <qlabel.h>
#include <qpainter.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qlayout.h>


TTip::TTip(QWidget* parent, const char* name) : QWidget (0,"TTIP",WX11BypassWM)
{
	
	setBackgroundMode(NoBackground);
	//resize(200,100);
	//show();
//QHBox *h = new QHBox(this);
	
	m_view = new InfoPopup(this);
	QGridLayout *grid = new QGridLayout( this, 2, 2, 10, 10, "Layout"); 
	grid->addWidget( m_view, 1, 1 );
    	

    	resize( QSize(186, 62).expandedTo(minimumSizeHint()) );
	clearWState( WState_Polished );

}
TTip::~TTip()
{
	delete m_view;
}
void TTip::updateTip( const QString & e, double speed, const QString& lbl)
{
    m_view->updateTip(e,speed,lbl);
}
void TTip::drawIt(QPainter *p)
{
    //QBrush b1( Qt::blue );

    QBrush b2( paletteBackgroundColor() );//, Qt::Dense6Pattern );          // green 12% fill
    //QBrush b3( Qt::NoBrush );                           // void brush
    //QBrush b4( Qt::CrossPattern );                      // black cross pattern
   
    p->setBrush( b2 );
    p->drawRoundRect( 0, 0, width(), height(), 1600/width(), 1600/height() );
   
}
void TTip::paintEvent(QPaintEvent *e)
{
	QPainter p(this);
	drawIt(&p);
	
}
