FloatingWidget::FloatingWidget( QWidget * parent )
	: QWidget( parent, Qt::Window | Qt::FramelessWindowHint |
                       Qt::WindowStaysOnTopHint )
{
	setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );

	tb = new QToolBar;
	tb->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );

	QHBoxLayout *layout = new QHBoxLayout;
	layout->setSpacing(2);
	layout->setMargin(2);
	layout->addWidget(tb);

	setLayout(layout);

	_margin = 0;
	_animated = false;
	animation_timer = new QTimer(this);
	animation_timer->setInterval(2);
	connect( animation_timer, SIGNAL(timeout()), this, SLOT(animate()) );

	connect( &auto_hide_timer, SIGNAL(timeout()), 
             this, SLOT(checkUnderMouse()) );
	setAutoHide(true);
}
AutoHideWidget::AutoHideWidget(QWidget *parent)
    : QWidget(parent)
    ,turned_on(false)
    ,auto_hide(false)
    ,use_animation(false)
    ,spacing(0)
    ,perc_width(100)
    ,activation_area(Bottom)
    ,internal_widget(0)
    ,timer(0)
{
    setBackgroundRole(QPalette::Window);
    setAutoFillBackground(true);
    setLayoutDirection(Qt::LeftToRight);

    QWidget *widget_to_watch = parent;
    widget_to_watch->installEventFilter(this);
    installFiliter(widget_to_watch);

    timer = new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(checkUnderMouse()));
    timer->setInterval(3000);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setSpacing(0);
    layout->setMargin(0);
    setLayout(layout);
}