Salome HOME
a5b43311f473d097d9fa7d552fa1d14c0cae6e24
[modules/shaper.git] / src / XGUI / XGUI_Viewer.h
1 #ifndef XGUI_Viewer_H
2 #define XGUI_Viewer_H
3
4 #include "XGUI_Constants.h"
5
6 #include <QObject>
7 #include <QMap>
8
9 #include <V3d_Viewer.hxx>
10 #include <AIS_InteractiveContext.hxx>
11 #include <AIS_Trihedron.hxx>
12
13 class XGUI_MainWindow;
14 class QMdiSubWindow;
15
16 class XGUI_Viewer: public QObject
17 {
18 Q_OBJECT
19 public:
20   static QString backgroundData(QStringList&, QIntList&, QIntList&);
21
22   XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true);
23   ~XGUI_Viewer();
24
25   QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
26
27   XGUI_MainWindow* mainWindow() const
28   {
29     return myMainWindow;
30   }
31
32   Handle(V3d_Viewer) v3dViewer() const
33   {
34     return myV3dViewer;
35   }
36
37   Handle(AIS_InteractiveContext) AISContext() const
38   {
39     return myAISContext;
40   }
41
42   Handle(AIS_Trihedron) trihedron() const
43   {
44     return myTrihedron;
45   }
46
47   void toggleTrihedron();
48   bool isTrihedronVisible() const;
49   void setTrihedronShown(const bool on);
50   double trihedronSize() const;
51   void setTrihedronSize(const double sz, bool isRelative);
52   bool trihedronRelative() const
53   {
54     return myIsRelative;
55   }
56   void updateTrihedron();
57   bool computeTrihedronSize(double& theNewSize, double& theSize);
58
59   static void setHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
60                            Qt::KeyboardModifiers theState, Qt::MouseButtons theButton);
61   static void getHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
62                            Qt::KeyboardModifiers& theState, Qt::MouseButtons& theButton);
63
64   typedef QMap<XGUI::HotOperation, Qt::KeyboardModifiers> StatesMap;
65   typedef QMap<XGUI::HotOperation, Qt::MouseButtons> ButtonsMap;
66
67   typedef QMap<XGUI::InteractionStyle, StatesMap> InteractionStyle2StatesMap;
68   typedef QMap<XGUI::InteractionStyle, ButtonsMap> InteractionStyle2ButtonsMap;
69
70   static InteractionStyle2StatesMap myStateMap;
71   static InteractionStyle2ButtonsMap myButtonMap;
72
73 private slots:
74   void onViewClosed();
75   void onViewMapped();
76
77 private:
78   XGUI_MainWindow* myMainWindow;
79
80   Handle(V3d_Viewer) myV3dViewer;Handle(AIS_Trihedron) myTrihedron;Handle(AIS_InteractiveContext) myAISContext;
81
82   XGUI::InteractionStyle myInteractionStyle;
83
84   bool myPreselectionEnabled;
85   bool mySelectionEnabled;
86   bool myMultiSelectionEnabled;
87   bool myIsRelative;
88
89   double myTrihedronSize;
90 };
91
92 #endif