X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ViewWindow.h;h=bd2aef20eacc7f510421e0608527ba68bb89d541;hb=ed165fd07e71c11885fdc5f475a8522a5914e00d;hp=be28c95a0aba45dd6c337c1349379fa580c8572b;hpb=275e39f8c9408e23882702f27f0d561193caeeb3;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ViewWindow.h b/src/XGUI/XGUI_ViewWindow.h index be28c95a0..bd2aef20e 100644 --- a/src/XGUI/XGUI_ViewWindow.h +++ b/src/XGUI/XGUI_ViewWindow.h @@ -1,8 +1,10 @@ #ifndef XGUI_ViewWindow_H #define XGUI_ViewWindow_H +#include "XGUI.h" #include "XGUI_Constants.h" -#include "XGUI_ViewBackground.h" + +#include #include #include @@ -21,16 +23,16 @@ class XGUI_RectRubberBand; class QMdiSubWindow; /*! - \class XGUI_ViewWindow - \ingroup GUI - \brief Implements a one view window of 3d viewer object. - It contains a view port object (drawing area) and toolbars for view camera and window management. - Also it managements events in view port -*/ -class XGUI_ViewWindow: public QFrame + \class XGUI_ViewWindow + \ingroup GUI + \brief Implements a one view window of 3d viewer object. + It contains a view port object (drawing area) and toolbars for view camera and window management. + Also it managements events in view port + */ +class XGUI_EXPORT XGUI_ViewWindow : public QFrame { Q_OBJECT -public: + public: //! Types of viewer operations enum OperationType { @@ -75,16 +77,37 @@ public: bool transformEnabled(const OperationType) const; //! Returns View background object - XGUI_ViewBackground background() const; + Qtx::BackgroundData background() const; //! Sets View background object - void setBackground(const XGUI_ViewBackground& theBackground); + void setBackground(const Qtx::BackgroundData& theBackground); //! Returns true if the current view window can be closed - bool closable() const { return myClosable; } + bool closable() const + { + return myClosable; + } //! Sets the current view window closable or not - void setClosable( const bool isClosable ) { myClosable = isClosable; } + void setClosable(const bool isClosable) + { + myClosable = isClosable; + } + + //! Enable/Disable drawing of ribbon line + void enableDrawMode(bool toEnable) + { + myEnableDrawMode = toEnable; + } + + //! Returns true if ribbon line drawing enabled + bool isDrawModeEnabled() const + { + return myEnableDrawMode; + } + + //! Updates drawing mode in the view window + void updateEnabledDrawMode(); signals: //! Emited whien view transformation operation is started @@ -102,7 +125,7 @@ signals: void tryClosing(XGUI_ViewWindow*); //! Emited when window is closing - void closed( QMdiSubWindow* ); + void closed(QMdiSubWindow*); //! Emited on mouse press in view port void mousePressed(XGUI_ViewWindow*, QMouseEvent*); @@ -115,20 +138,20 @@ signals: //! Emited on mouse moving in view port void mouseMoving(XGUI_ViewWindow*, QMouseEvent*); - + //! Emited on key press in view port void keyPressed(XGUI_ViewWindow*, QKeyEvent*); - + //! Emited on key release in view port void keyReleased(XGUI_ViewWindow*, QKeyEvent*); - + //! Emited on context menu request in view port void contextMenuRequested(QContextMenuEvent *e); //void viewModified(XGUI_ViewWindow*); - void viewCloned( QMdiSubWindow* theView ); + void viewCloned(QMdiSubWindow* theView); -public slots: + public slots: //! Start zooming operation void activateZoom(); @@ -174,18 +197,20 @@ public slots: //! Reset point of view void reset(); + void windowActivated(); -protected: - virtual void resizeEvent(QResizeEvent* theEvent); + void windowDeactivated(); + protected: virtual void changeEvent(QEvent* theEvent); - virtual void enterEvent(QEvent* theEvent); - virtual void leaveEvent(QEvent* theEvent); - virtual bool eventFilter(QObject *theObj, QEvent *theEvent); -private slots: + virtual void showEvent(QShowEvent* theEvent); + + virtual void contextMenuEvent(QContextMenuEvent* theEvent); + + private slots: void onClose(); void onMinimize(); void onMaximize(); @@ -193,10 +218,12 @@ private slots: void updateToolBar(); // void repaintToolBar(); -private: + private: enum WindowState { - MinimizedState, MaximizedState, NormalState + MinimizedState, + MaximizedState, + WindowNormalState }; bool processWindowControls(QObject *theObj, QEvent *theEvent); @@ -225,7 +252,7 @@ private: myEventStarted = bOn; } -private: + private: XGUI_Viewer* myViewer; QLabel* myPicture; @@ -263,6 +290,7 @@ private: bool myIsKeyFree; bool myEventStarted; // set when transformation is in process bool myClosable; + bool myIsActive; QCursor myCursor; @@ -271,7 +299,7 @@ private: gp_Pnt mySelectedPoint; - XGUI_RectRubberBand* myRectBand; //!< selection rectangle rubber band + XGUI_RectRubberBand* myRectBand; //!< selection rectangle rubber band typedef QMap MapOfTransformStatus; MapOfTransformStatus myStatus; @@ -281,54 +309,54 @@ private: //****************************************************** /*! - \class ViewerToolbar - \ingroup GUI - \brief Provides a toolbar widget with treansparent background over OCCT View window -*/ -class ViewerToolbar: public QToolBar + \class ViewerToolbar + \ingroup GUI + \brief Provides a toolbar widget with treansparent background over OCCT View window + */ +class ViewerToolbar : public QToolBar { Q_OBJECT -public: - ViewerToolbar(QWidget* theParent, XGUI_ViewPort* thePort) - : QToolBar(theParent), myVPort(thePort) + public: + ViewerToolbar(QWidget* theParent, XGUI_ViewPort* thePort); + + protected slots: + void onViewPortResized() { - setBackgroundRole(QPalette::NoRole); - setAttribute(Qt::WA_NoSystemBackground); - setAttribute(Qt::WA_PaintOnScreen); + myResize = true; } - void repaintBackground(); - -protected: + protected: virtual void paintEvent(QPaintEvent* theEvent); -private: + private: XGUI_ViewPort* myVPort; + bool myResize; }; //****************************************************** /*! - \class ViewerToolbar - \ingroup GUI - \brief Provides a Label widget with treansparent background over OCCT View window -*/ -class ViewerLabel: public QLabel + \class ViewerToolbar + \ingroup GUI + \brief Provides a Label widget with treansparent background over OCCT View window + */ +class ViewerLabel : public QLabel { Q_OBJECT -public: - ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort) - : QLabel(theParent), myVPort(thePort) + public: + ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort); + + protected slots: + void onViewPortResized() { - setAttribute(Qt::WA_NoSystemBackground); + myResize = true; } - void repaintBackground(); - -protected: + protected: virtual void paintEvent(QPaintEvent* theEvent); -private: + private: XGUI_ViewPort* myVPort; + bool myResize; }; #endif