-
#ifndef XGUI_Viewer_H
#define XGUI_Viewer_H
+#include "XGUI_Constants.h"
+
#include <QObject>
+#include <QMap>
+#include <QList>
+
#include <V3d_Viewer.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Trihedron.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:
- enum {
- HorizontalGradient, VerticalGradient,
- Diagonal1Gradient, Diagonal2Gradient,
- Corner1Gradient, Corner2Gradient,
- Corner3Gradient, Corner4Gradient,
- LastGradient = Corner4Gradient
- };
+ 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);
- XGUI_Viewer(XGUI_MainWindow* theParent);
- ~XGUI_Viewer();
+ 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);
- QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
+ typedef QMap<XGUI::HotOperation, Qt::KeyboardModifiers> StatesMap;
+ typedef QMap<XGUI::HotOperation, Qt::MouseButtons> ButtonsMap;
- XGUI_MainWindow* mainWindow() const { return myMainWindow; }
+ typedef QMap<XGUI::InteractionStyle, StatesMap> InteractionStyle2StatesMap;
+ typedef QMap<XGUI::InteractionStyle, ButtonsMap> InteractionStyle2ButtonsMap;
- Handle(V3d_Viewer) v3dViewer() const { return myV3dViewer; }
+ 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*);
+
+private:
+ void addView(QMdiSubWindow* theView);
+
+ /*! Removes the View from internal Views list.*/
+ void removeView(QMdiSubWindow* theView);
private:
- XGUI_MainWindow* myMainWindow;
+ XGUI_MainWindow* myMainWindow;
+
+ Handle(V3d_Viewer) myV3dViewer;Handle(AIS_Trihedron) myTrihedron;Handle(AIS_InteractiveContext) myAISContext;
+
+ XGUI::InteractionStyle myInteractionStyle;
+
+ bool myPreselectionEnabled;
+ bool mySelectionEnabled;
+ bool myMultiSelectionEnabled;
+ bool myIsRelative;
+
+ double myTrihedronSize;
+
+ QList<QMdiSubWindow*> myViews;
- Handle(V3d_Viewer) myV3dViewer;
- Handle(AIS_Trihedron) myTrihedron;
- Handle(AIS_InteractiveContext) myAISContext;
+ QMdiSubWindow* myActiveView;
};
-#endif
\ No newline at end of file
+#endif