]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_Viewer.h
Salome HOME
78cfe55a55774c691e18f1e8ea1dcace83dd4df7
[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     static QString backgroundData( QStringList&, QIntList&, QIntList& );
22     
23     XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true);
24     ~XGUI_Viewer();
25
26     QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
27
28     XGUI_MainWindow* mainWindow() const { return myMainWindow; }
29
30     Handle(V3d_Viewer) v3dViewer() const { return myV3dViewer; }
31
32     Handle(AIS_InteractiveContext) AISContext() const { return myAISContext; }
33
34     Handle(AIS_Trihedron) trihedron() const { return myTrihedron; }
35
36     void toggleTrihedron();
37     bool isTrihedronVisible() const;
38     void setTrihedronShown( const bool on );
39     double trihedronSize() const;
40     void setTrihedronSize( const double sz, bool isRelative );
41     bool trihedronRelative() const { return myIsRelative; }
42     void updateTrihedron();
43     bool computeTrihedronSize( double& theNewSize, double& theSize );
44
45
46
47     static void setHotButton( XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
48                                   Qt::KeyboardModifiers theState, Qt::MouseButtons theButton );
49     static void getHotButton( XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
50                                   Qt::KeyboardModifiers& theState, Qt::MouseButtons& theButton );
51
52     typedef QMap<XGUI::HotOperation, Qt::KeyboardModifiers> StatesMap;
53     typedef QMap<XGUI::HotOperation, Qt::MouseButtons>      ButtonsMap;
54
55     typedef QMap<XGUI::InteractionStyle, StatesMap>  InteractionStyle2StatesMap;
56     typedef QMap<XGUI::InteractionStyle, ButtonsMap> InteractionStyle2ButtonsMap;
57
58     static InteractionStyle2StatesMap  myStateMap;
59     static InteractionStyle2ButtonsMap myButtonMap;
60
61 private slots:
62     void onViewClosed();
63     void onViewMapped();
64
65 private:
66     XGUI_MainWindow* myMainWindow;
67
68     Handle(V3d_Viewer)              myV3dViewer;
69     Handle(AIS_Trihedron)           myTrihedron;
70     Handle(AIS_InteractiveContext)  myAISContext;
71     
72     XGUI::InteractionStyle myInteractionStyle;
73   
74     bool myPreselectionEnabled;
75     bool mySelectionEnabled;
76     bool myMultiSelectionEnabled;
77     bool myIsRelative;
78
79     double myTrihedronSize;
80 };
81
82 #endif