/* -*- mode: c++; indent-tabs-mode: nil; -*-
 *
 * Copyright (c) 2000-2003, Roland Jesse
 * All rights reserved.
 *
 * This file is part of the Mango recipe management distribution.
 * For license and copyright information see the file COPYRIGHT or 
 * <http://www.opensource.org/licenses/bsd-license.html>.
 *
 * $Id: BusyWidget.h,v 1.5 2003/01/12 16:19:55 rjesse Exp $
 */
 
#ifndef BUSY_WIDGET_HPP
#define BUSY_WIDGET_HPP

#include <qgl.h>

class QMouseEvent;

/**
 * Widget which indicates whether or not the application is busy doing 
 * something (like searching or what not).
 */
class BusyWidget : public QGLWidget {
      Q_OBJECT

   public:
      BusyWidget( QWidget* parent, const char* name = 0);
	  ~BusyWidget();

   public slots:
	  void start();
	  void stop();
	  
   protected:
      void initializeGL();
      void paintGL();
      void resizeGL( int w, int h);

   private slots:
   	  void slotSpinScene();
	  void slotChangeCubeDirection();

   private:
	  void polygon(int, int, int, int);
	  void cube();
	  QTimer* m_spinTimer;
	  QTimer* m_directionTimer;

      GLuint makeObject();
      GLuint m_object;
      GLfloat scale;

      static GLfloat m_colours[][3];
      GLuint faceColourIndexForM( GLuint);
      
      static const GLfloat m_normals[][3];
      static const GLfloat m_vertices[][3];
      static const GLfloat m_verticesM[][3];
      typedef GLuint Face[4];
      static const Face m_facesM[];
      GLfloat m_theta[3];
      GLint m_axis;
};
#endif // BUSY_WIDGET_HPP
