Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / XGUI / XGUI_Viewer.h
index 363a2c14021afcd3652e7c814accb5d1d267ce4f..654221a595bd99b13f7b0c5c8bff3e3f1ee13e9d 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifndef XGUI_Viewer_H
 #define XGUI_Viewer_H
 
@@ -6,6 +5,7 @@
 
 #include <QObject>
 #include <QMap>
+#include <QList>
 
 #include <V3d_Viewer.hxx>
 #include <AIS_InteractiveContext.hxx>
 
 class XGUI_MainWindow;
 class QMdiSubWindow;
+class XGUI_ViewWindow;
+class QMouseEvent;
+class QKeyEvent;
 
-class XGUI_Viewer : public QObject
+class XGUI_Viewer: public QObject
 {
-    Q_OBJECT
+Q_OBJECT
 public:
-    XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true);
-    ~XGUI_Viewer();
-
-    QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
-
-    XGUI_MainWindow* mainWindow() const { return myMainWindow; }
-
-    Handle(V3d_Viewer) v3dViewer() const { return myV3dViewer; }
-
-    Handle(AIS_InteractiveContext) AISContext() const { return myAISContext; }
-
-    Handle(AIS_Trihedron) trihedron() const { return myTrihedron; }
-
-    void toggleTrihedron();
-    bool isTrihedronVisible() const;
-    void setTrihedronShown( const bool on );
-    double trihedronSize() const;
-    void setTrihedronSize( const double sz, bool isRelative );
-    bool trihedronRelative() const { return myIsRelative; }
-    void updateTrihedron();
-    bool computeTrihedronSize( double& theNewSize, double& theSize );
-
+  static QString backgroundData(QStringList&, QIntList&, QIntList&);
+
+  XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true);
+  ~XGUI_Viewer();
+
+  QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
+
+  XGUI_MainWindow* mainWindow() const
+  {
+    return myMainWindow;
+  }
+
+  Handle(V3d_Viewer) v3dViewer() const
+  {
+    return myV3dViewer;
+  }
+
+  Handle(AIS_InteractiveContext) AISContext() const
+  {
+    return myAISContext;
+  }
+
+  Handle(AIS_Trihedron) trihedron() const
+  {
+    return myTrihedron;
+  }
+
+  void toggleTrihedron();
+  bool isTrihedronVisible() const;
+  void setTrihedronShown(const bool on);
+  double trihedronSize() const;
+  void setTrihedronSize(const double sz, bool isRelative);
+  bool trihedronRelative() const
+  {
+    return myIsRelative;
+  }
+  void updateTrihedron();
+  bool computeTrihedronSize(double& theNewSize, double& theSize);
+
+  static void setHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
+                           Qt::KeyboardModifiers theState, Qt::MouseButtons theButton);
+  static void getHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
+                           Qt::KeyboardModifiers& theState, Qt::MouseButtons& theButton);
+
+  typedef QMap<XGUI::HotOperation, Qt::KeyboardModifiers> StatesMap;
+  typedef QMap<XGUI::HotOperation, Qt::MouseButtons> ButtonsMap;
+
+  typedef QMap<XGUI::InteractionStyle, StatesMap> InteractionStyle2StatesMap;
+  typedef QMap<XGUI::InteractionStyle, ButtonsMap> InteractionStyle2ButtonsMap;
+
+  static InteractionStyle2StatesMap myStateMap;
+  static InteractionStyle2ButtonsMap myButtonMap;
+
+signals:
+    void lastViewClosed();
+    void tryCloseView(XGUI_ViewWindow* theWindow);
+    void deleteView(XGUI_ViewWindow* theWindow);
+    void viewCreated(XGUI_ViewWindow* theWindow);
+    void mousePress(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+    void mouseRelease(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+    void mouseDoubleClick(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+    void mouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+    void keyPress(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
+    void keyRelease(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
+    void activated(XGUI_ViewWindow* theWindow);
 
+private slots:
+    void onViewClosed(QMdiSubWindow*);
+    //void onViewMapped();
+    void onWindowActivated(QMdiSubWindow*);
 
-    static void setHotButton( XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
-                                  Qt::KeyboardModifiers theState, Qt::MouseButtons theButton );
-    static void getHotButton( XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
-                                  Qt::KeyboardModifiers& theState, Qt::MouseButtons& theButton );
+private:
+    void addView(QMdiSubWindow* theView);
 
-    typedef QMap<XGUI::HotOperation, Qt::KeyboardModifiers> StatesMap;
-    typedef QMap<XGUI::HotOperation, Qt::MouseButtons>      ButtonsMap;
+    /*! Removes the View from internal Views list.*/
+    void removeView(QMdiSubWindow* theView);
 
-    typedef QMap<XGUI::InteractionStyle, StatesMap>  InteractionStyle2StatesMap;
-    typedef QMap<XGUI::InteractionStyle, ButtonsMap> InteractionStyle2ButtonsMap;
+private:
+  XGUI_MainWindow* myMainWindow;
 
-    static InteractionStyle2StatesMap  myStateMap;
-    static InteractionStyle2ButtonsMap myButtonMap;
+  Handle(V3d_Viewer) myV3dViewer;Handle(AIS_Trihedron) myTrihedron;Handle(AIS_InteractiveContext) myAISContext;
 
-private slots:
-    void onViewClosed();
-    void onViewMapped();
+  XGUI::InteractionStyle myInteractionStyle;
 
-private:
-    XGUI_MainWindow* myMainWindow;
+  bool myPreselectionEnabled;
+  bool mySelectionEnabled;
+  bool myMultiSelectionEnabled;
+  bool myIsRelative;
 
-    Handle(V3d_Viewer)              myV3dViewer;
-    Handle(AIS_Trihedron)           myTrihedron;
-    Handle(AIS_InteractiveContext)  myAISContext;
-    
-    XGUI::InteractionStyle myInteractionStyle;
+  double myTrihedronSize;
   
-    bool myPreselectionEnabled;
-    bool mySelectionEnabled;
-    bool myMultiSelectionEnabled;
-    bool myIsRelative;
+    QList<QMdiSubWindow*> myViews;
 
-    double myTrihedronSize;
+    QMdiSubWindow* myActiveView;
 };
 
-#endif
\ No newline at end of file
+#endif