kdeglwidget.h
上传用户:center1979
上传日期:2022-07-26
资源大小:50633k
文件大小:2k
源码类别:

OpenGL

开发平台:

Visual C++

  1. /***************************************************************************
  2.                           kdeglwidget.h  -  description
  3.                              -------------------
  4.     begin                : Tue Jul 16 2002
  5.     copyright            : (C) 2002 by Christophe Teyssier
  6.     email                : chris@teyssier.org
  7.  ***************************************************************************/
  8. /***************************************************************************
  9.  *                                                                         *
  10.  *   This program is free software; you can redistribute it and/or modify  *
  11.  *   it under the terms of the GNU General Public License as published by  *
  12.  *   the Free Software Foundation; either version 2 of the License, or     *
  13.  *   (at your option) any later version.                                   *
  14.  *                                                                         *
  15.  ***************************************************************************/
  16. #ifndef KDEGLWIDGET_H
  17. #define KDEGLWIDGET_H
  18. #include <qgl.h>
  19. #include <qevent.h>
  20. #include <kaction.h>
  21. #include "celestiacore.h"
  22. #include "celengine/simulation.h"
  23. #include <celengine/starbrowser.h>
  24. #include <string>
  25. #include <vector>
  26. /**
  27.   *@author Christophe Teyssier
  28.   */
  29. class KdeGlWidget : public QGLWidget, public CelestiaCore::CursorHandler {
  30.     Q_OBJECT
  31. public:
  32.     KdeGlWidget( QWidget* parent, const char* name, CelestiaCore* core);
  33.     ~KdeGlWidget();
  34.     void setCursorShape(CelestiaCore::CursorShape);
  35.     CelestiaCore::CursorShape getCursorShape() const;
  36.     
  37. protected:
  38.     void initializeGL();
  39.     void paintGL();
  40.     void resizeGL( int w, int h );
  41.     virtual void mouseMoveEvent( QMouseEvent* m );
  42.     virtual void mousePressEvent( QMouseEvent* m );
  43.     virtual void mouseReleaseEvent( QMouseEvent* m );
  44.     virtual void wheelEvent( QWheelEvent* w );
  45.     virtual void keyPressEvent( QKeyEvent* e );
  46.     virtual void keyReleaseEvent( QKeyEvent* e );
  47.     bool handleSpecialKey(QKeyEvent* e, bool down);
  48. private:
  49.     CelestiaCore* appCore;
  50.     Renderer* appRenderer;
  51.     Simulation* appSim;
  52.     int lastX;
  53.     int lastY;
  54.     CelestiaCore::CursorShape currentCursor;
  55.     KActionCollection* actionColl;
  56. };
  57. #endif