Salome HOME
Profile object creation.
[modules/hydro.git] / src / HYDROCurveCreator / OCCViewer_ViewWidget.h
index c4d02797c1fc52b2c0d66698b8096cee6aa65230..cbfe37e7f5cb80e0694e3c2019f5c6193bbfea79 100644 (file)
@@ -1,31 +1,28 @@
-// File:        OCCViewer_ViewWidget.h
-// Created:     26 Jul 2012
-// Author:      Natalia ERMOLAEVA
-// Copyright:   CEA 2011
-
 #ifndef OCCVIEWER_VIEWWIDGET_H
 #define OCCVIEWER_VIEWWIDGET_H
 
 #include "CurveCreator_Macro.hxx"
+#include <Basics_OCCTVersion.hxx>
 
-#include <QCursor>
-#include <QFrame>
-#include <QColor>
-
+#include <OCCViewer_ViewWindow.h>
 #include <QtxAction.h>
 #include <QtxMultiAction.h>
 
-#include <OCCViewer_ViewWindow.h>
 #include <V3d_Viewer.hxx>
 #include <AIS_InteractiveContext.hxx>
 #include <AIS_Trihedron.hxx>
 #include <TopoDS_Shape.hxx>
 
+#include <QCursor>
+#include <QFrame>
+#include <QColor>
+
 class OCCViewer_ViewPort3d;
 class QPushButton;
 class QToolBar;
 
 class Handle(V3d_Viewer);
+class Handle(AIS_InteractiveContext);
 
 #ifdef WIN32
 #pragma warning ( disable:4251 )
@@ -37,16 +34,29 @@ class CURVECREATOR_EXPORT OCCViewer_ViewWidget : public QFrame
   Q_OBJECT
 
 public:
-  OCCViewer_ViewWidget(QWidget* parent);
+  typedef enum { FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId, TrihId,
+                 FrontId, BackId, TopId, BottomId, LeftId, RightId, None } ButtonsType;
+
+  OCCViewer_ViewWidget(QWidget* parent, const bool isUseMultiAction = true);
   ~OCCViewer_ViewWidget();
 
+  OCCViewer_ViewPort3d* getViewPort();
+  Handle(AIS_InteractiveContext) getAISContext() { return myAISContext; }
+
   bool      eventFilter(QObject* watched, QEvent* e);
 
   void      reset();
   void      Display(const TopoDS_Shape shape, const bool theShaded,
                     const QColor& shapeColor);
 
-private slots:
+  enum Mode2dType { No2dMode, XYPlane, XZPlane, YZPlane};
+
+  void       set2dMode( Mode2dType );
+  Mode2dType get2dMode() const { return my2dMode; }
+
+  QAction*   action( const ButtonsType& theId );
+
+public slots:
   void      onActivated();
   void      onTrihChanged();
   void      onFrontView();
@@ -56,6 +66,11 @@ private slots:
   void      onLeftView();
   void      onRightView();
 
+signals:
+  void      mouseMoving( QMouseEvent* theEvent );
+  void      mousePressed( QMouseEvent* theEvent );
+  void      mouseReleased( QMouseEvent* theEvent );
+
 private:
   enum OperationType{ NOTHING, FITALLVIEW, WINDOWFIT, ZOOMVIEW, PANVIEW, PANGLOBAL,
                       ROTATE };
@@ -80,8 +95,6 @@ private:
   bool setTransformRequested (OperationType op);
   void clearViewer(const bool theUpdate = true);
 
-  typedef enum { FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId, TrihId,
-                 FrontId, BackId, TopId, BottomId, LeftId, RightId, None } ButtonsType;
   typedef QMap<ButtonsType, QtxAction*> ActionsMap;
 
 private:
@@ -111,6 +124,9 @@ private:
   OCCViewer_ViewWindow::RotationPointType myCurrPointType;
   gp_Pnt                mySelectedPoint;
   bool                  myShowTrihedron;
+
+  Mode2dType            my2dMode;
+  bool                  myUseMultiAction;
 };
 
 #endif