/***************************************************************************
                          kmoviebutton.h  -  description
                             -------------------
    begin                : Mon Mai 6 2002
    copyright            : (C) 2002 by Dieter Landolt
    email                : dieter.landolt@secs.ch
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KMOVIEBUTTON_H
#define KMOVIEBUTTON_H

#include <qwidget.h>
#include <qpushbutton.h>
#include <qmovie.h>

/**Pushbutton witch can display a little video on Top of the Buuton
  *@author Dieter Landolt
  */

class kMovieButton : public QPushButton  {
   Q_OBJECT
public:
	kMovieButton(QWidget *parent=0, const char *name=0);
	~kMovieButton();
  // QSize sizeHint() const;
  /** set a new Movie to the button */
  void setMovie(const QMovie &mov);
  void setMovie(const QString &fileName);
  /** When the Mouse moves away */
  void mouseMoveEvent(QMouseEvent * e);
public slots:
  void slotPlay();
  void slotPause();
  void slotStop();
  void slotRestart();
  void slotMovieUpdate();
  /** Restart the Movie if button gets the focus */
  void focusInEvent(QFocusEvent* foc);

    /*!
        MovieButton::slotStatus(int state)
	Needes for Workaround an Infinite Loop on MNG Files 
	to Workaround a bug by QT
     */
    void slotStatus(int state)
    {
    if (state == QMovie::EndOfLoop)
         movie->pause();
     }
    // QT End Workarournd
protected:
  void paintEvent(QPaintEvent *ev);
  void closeEvent(QCloseEvent *ev);
   QMovie *movie;
};

#endif
