// Qt Viewer for libVRML97
//
// Copyright (C) 1999 by Kenneth Bentley <bentley@nuc.net>
//
// This software may be distributed under the terms of the Q
// Public License, version 1.0 or later. Please see the file LICENSE for 
// terms. 

// based on libVRML97 by Chris Morley. and gtkLookat, by Erik Andersen

// libVRML97 is Copyright (C) 1998,1999 Chris Morley (cmorley@vermontel.com)

// gtkLookat is Copyright (C) 1998 by Erik Andersen <andersee@debian.org> under
// the terms of the GNU Public License. Erik Anderson has granted permission to 
// license this derivative work under QPL.


#ifndef _VIEWERQt_
#define _VIEWERQt_

#include <stdio.h>

#ifdef Qt2x
#define rodent_LEFT  Qt::LeftButton
#define rodent_RIGHT Qt::RightButton
#define rodent_MID   Qt::MidButton
#define rodent_NONE  Qt::NoButton
#else
#define rodent_LEFT  LeftButton
#define rodent_RIGHT RightButton
#define rodent_MID   MidButton
#define rodent_NONE  NoButton
#endif

#include <OpenVRML/GL/ViewerOpenGL.h>
#include <qobject.h>

class QMouseEvent;
class vGLWidget;

class ViewerQt : public QObject, public ViewerOpenGL {

public:

  // Create a named OpenGL drawing area widget
  ViewerQt(QObject * parent, VrmlScene *, vGLWidget* da_widg);
  virtual ~ViewerQt();

  // public so the callback functions can access them
  void timerUpdate();
  void handleInput( ViewerOpenGL::EventInfo *e );
  void handleRedraw();
  void SetStop( bool state);
  void vMousePressEvent( QMouseEvent *e);
  void vMouseReleaseEvent( QMouseEvent *e);
  void vMouseMoveEvent( QMouseEvent *e);

protected:

  // Window system specific methods

  virtual void wsPostRedraw();
  virtual void wsSetCursor( CursorStyle );
  virtual void wsSwapBuffers();
  virtual void wsSetTimer( double );
  virtual void timerEvent(QTimerEvent *); //overrides QObject::timerEvent

  int warn(char *);

private:

  int d_timer;
  bool d_Stop;
  bool d_redrawNeeded;
  int d_width, d_height;
  vGLWidget* da_widget;

};

#endif /* _VIEWERQt_ */



