Tulip  4.6.0
Better Visualization Through Research
library/tulip-gui/include/tulip/GlMainWidgetGraphicsItem.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 #ifndef GLMAINWIDGETGRAPHICSITEM_H
00022 #define GLMAINWIDGETGRAPHICSITEM_H
00023 
00024 #include <QGraphicsObject>
00025 
00026 
00027 #include <tulip/tulipconf.h>
00028 
00029 namespace tlp {
00030 class GlMainWidget;
00031 
00032 class TLP_QT_SCOPE GlMainWidgetGraphicsItem : public QGraphicsObject {
00033   Q_OBJECT
00034 public:
00035   GlMainWidgetGraphicsItem(tlp::GlMainWidget *glMainWidget, int width, int height);
00036   virtual ~GlMainWidgetGraphicsItem();
00037 
00038   void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00039 
00040   QRectF boundingRect() const;
00041 
00042   void resize(int width, int height);
00043 
00044   void setRedrawNeeded(bool redrawNeeded) {
00045     this->_redrawNeeded=redrawNeeded;
00046   }
00047 
00048   tlp::GlMainWidget *getGlMainWidget() {
00049     return glMainWidget;
00050   }
00051 
00052   bool eventFilter(QObject *, QEvent *evt);
00053 
00054 signals:
00055 
00056   void widgetPainted(bool redraw);
00057 
00058 protected :
00059   void keyPressEvent(QKeyEvent *event);
00060   void keyReleaseEvent(QKeyEvent *event);
00061   void wheelEvent(QGraphicsSceneWheelEvent *event);
00062   void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00063   void mousePressEvent(QGraphicsSceneMouseEvent *event);
00064   void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00065   void hoverMoveEvent(QGraphicsSceneHoverEvent * event);
00066   void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
00067   void contextMenuEvent(QGraphicsSceneContextMenuEvent * event);
00068   void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
00069   void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
00070   void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
00071   void dropEvent(QGraphicsSceneDragDropEvent *event);
00072 
00073 protected slots:
00074   void glMainWidgetDraw(GlMainWidget *,bool);
00075   void glMainWidgetRedraw(GlMainWidget *);
00076 
00077 private :
00078   tlp::GlMainWidget *glMainWidget;
00079   bool _redrawNeeded;
00080   bool _graphChanged;
00081   int width, height;
00082 };
00083 
00084 }
00085 
00086 #endif // GLMAINWIDGETGRAPHICSITEM_H
00087 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties