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