Salome HOME
updated copyright message
[modules/gui.git] / src / GLViewer / GLViewer_Viewer.h
index b862e3710acff1e160710fb8415acbce45586a39..84df202d396c6c4acb3b08c8052217a16fda3efb 100644 (file)
@@ -1,38 +1,62 @@
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  Author : OPEN CASCADE
 // File:      GLViewer_Viewer.h
 // Created:   November, 2004
-// Author:    OCC team
-// Copyright (C) CEA 2004
-
-/***************************************************************************
-**  Class:   GLViewer_Viewer
-**  Descr:   Viewer for QAD-based application
-**  Module:  QAD
-**  Created: UI team, 05.09.00
-****************************************************************************/
+//
 #ifndef GLVIEWER_VIEWER_H
 #define GLVIEWER_VIEWER_H
 
+#include "GLViewer.h"
 #include "GLViewer_Defs.h"
-#include "GLViewer_ViewFrame.h"
 #include <SUIT_ViewModel.h>
 
-#include <qlist.h>
-#include <qcursor.h>
-#include <qobject.h>
-#include <qpixmap.h>
+#include <QCursor>
+#include <QObject>
+
+class QMouseEvent;
+class QKeyEvent;
+class QWheelEvent;
+class QRect;
+class QRubberBand;
 
 class GLViewer_Selector;
 class GLViewer_ViewSketcher;
 class GLViewer_ViewTransformer;
+class GLViewer_ViewFrame;
 
-class SUIT_Desktop;
+//class SUIT_Desktop;
 class SUIT_ViewWindow;
 
-#ifdef WNT
+#ifdef WIN32
 #pragma warning( disable:4251 )
 #endif
 
-class GLVIEWER_EXPORT GLViewer_Viewer: public SUIT_ViewModel
+/*! 
+  \class GLViewer_Object
+  Base Viewer for GLViewer
+*/
+class GLVIEWER_API GLViewer_Viewer: public SUIT_ViewModel
 {
     Q_OBJECT
 
@@ -51,6 +75,8 @@ public:
     virtual QString              getType() const { return Type(); }
     static QString               Type() { return "GLViewer_ViewModel";  }
 
+    virtual void                 contextMenuPopup( QMenu* );
+
 public:
     void                         setSelectionMode( SelectionMode );
     SelectionMode                getSelectionMode() const;
@@ -94,6 +120,8 @@ protected slots:
     virtual void                 onSelectionCancel();
     virtual void                 onSelectionDone( bool add, SelectionChangeStatus status );
 
+    virtual void                 onChangeBgColor();
+
 private:
     void                         handleMouseMove( QMouseEvent* );
     void                         handleMousePress( QMouseEvent* );
@@ -107,11 +135,7 @@ protected:
     GLViewer_ViewTransformer*    myTransformer;     /* transform manipulator */
 };
 
-/****************************************************************
-**  Class: GLViewer_ViewTransformer
-**
-*****************************************************************/
-class GLVIEWER_EXPORT GLViewer_ViewTransformer : public QObject
+class GLVIEWER_API GLViewer_ViewTransformer : public QObject
 {
 public:
     GLViewer_ViewTransformer( GLViewer_Viewer*, int type );
@@ -149,6 +173,9 @@ protected:
     virtual void                 onTransform( TransformState );
     void                         initTransform( bool );
 
+    void                         drawRect(const QRect& theRect);
+    void                         endDrawRect();
+
 protected:
     static int                   panBtn;
     static int                   zoomBtn;
@@ -163,15 +190,12 @@ protected:
     bool                         mySavedMouseTrack;
     QPoint                       myStart, myCurr;
     int                          myButtonState;
-    QRect                        myDrawRect;
     int                          myMajorBtn;
+
+    QRubberBand*                 myRectBand; //!< selection rectangle rubber band
 };
 
-/****************************************************************
-**  Class: GLViewer_ViewSketcher
-**
-*****************************************************************/
-class GLVIEWER_EXPORT GLViewer_ViewSketcher : public QObject
+class GLVIEWER_API GLViewer_ViewSketcher : public QObject
 {
 public:
     GLViewer_ViewSketcher( GLViewer_Viewer*, int type );
@@ -197,6 +221,9 @@ protected:
     enum SketchState { Debut, EnTrain, Fin };
     virtual void                 onSketch( SketchState );
 
+    void                         drawRect(const QRect& theRect);
+    void                         endDrawRect();
+
 protected:
     static int                   sketchBtn;
     GLViewer_Viewer*             myViewer;
@@ -205,9 +232,11 @@ protected:
     QCursor                      mySavedCursor;
     QPoint                       myStart, myCurr;
     int                          myButtonState;
+
+    QRubberBand*                 myRectBand; //!< selection rectangle rubber band
 };
 
-#ifdef WNT
+#ifdef WIN32
 #pragma warning ( default:4251 )
 #endif