14bbbdcb |
1 | // Created on: 2017-06-16 |
2 | // Created by: Natalia ERMOLAEVA |
3 | // Copyright (c) 2017 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef View_Window_H |
17 | #define View_Window_H |
18 | |
19 | #include <AIS_InteractiveContext.hxx> |
0cb512c0 |
20 | #include <inspector/View_ContextType.hxx> |
14bbbdcb |
21 | |
130eb114 |
22 | #include <Standard_WarningsDisable.hxx> |
14bbbdcb |
23 | #include <QWidget> |
130eb114 |
24 | #include <Standard_WarningsRestore.hxx> |
14bbbdcb |
25 | |
26 | class View_Displayer; |
27 | class View_ToolBar; |
28 | class View_Widget; |
29 | |
30 | class QToolBar; |
31 | |
32 | //! \class View_Window |
33 | //! \brief It is a widget where in grid layout View widget and tool bars are placed. There are two tool bars. |
34 | //! The first, view actions, tool bar is placed on Vertical, the window tool bar is placed Horizontally. |
35 | //! The second tool bar contains actions of View_ToolBar. |
36 | class View_Window : public QWidget |
37 | { |
38 | Q_OBJECT |
39 | |
40 | public: |
41 | |
42 | //! Constructor |
6822a3be |
43 | Standard_EXPORT View_Window (QWidget* theParent, const bool isUseKeepView = true, const bool isFitAllActive = true); |
14bbbdcb |
44 | |
45 | //! Destructor |
46 | virtual ~View_Window() {} |
47 | |
48 | //! Returns view displayer |
49 | View_Displayer* GetDisplayer() const { return myDisplayer; } |
50 | |
51 | //! Returns view widget |
52 | View_Widget* GetView() const { return myView; } |
53 | |
54 | //! Returns actions tool bar |
55 | QToolBar* GetActionsToolBar() const { return myActionsToolBar; } |
56 | |
57 | //! Returns window tool bar |
58 | View_ToolBar* GetViewToolBar() const { return myViewToolBar; } |
59 | |
60 | //! Sets a new context for context type |
61 | //! \param theType a type of context, will be selected in the tool bar combo box |
62 | //! \param theContext an AIS context |
63 | Standard_EXPORT void SetContext (View_ContextType theType, const Handle(AIS_InteractiveContext)& theContext); |
64 | |
6822a3be |
65 | signals: |
66 | //! Signals about calling erasing all presentations in context |
67 | void eraseAllPerformed(); |
68 | |
14bbbdcb |
69 | protected slots: |
70 | |
71 | //! Processing context change: |
72 | //! - set an active context in the displayer, |
73 | //! - erase all displayed presentations from the previous context, |
74 | //! - sets the current view enabled only if a current context type is View_ContextType_Own |
75 | void onViewSelectorActivated(); |
76 | |
6822a3be |
77 | //! Processing widget action checked state changed: for Fit All action, if checked, displayer do FitAll automatically |
78 | //! \param theActionId a clicked action |
79 | //! \param theState a result checked state |
80 | void onCheckedStateChanged (int theActionId, bool theState); |
81 | |
14bbbdcb |
82 | //! Processing window tool bar actions |
83 | void onToolBarActionClicked (const int theActionId); |
84 | |
6822a3be |
85 | //! Shows context menu for view. It contains set view orientation actions. |
86 | //! \param thePosition a clicked point |
87 | void onViewContextMenuRequested (const QPoint& thePosition); |
88 | |
89 | //! Sets the view scene orientation by the text of selected action |
90 | void onSetOrientation(); |
91 | |
14bbbdcb |
92 | //! Sets selected display mode in the current context |
93 | void onDisplayModeChanged(); |
94 | |
95 | private: |
96 | |
97 | View_Displayer* myDisplayer; //!< displayer |
98 | View_Widget* myView; //!< view widget |
99 | QToolBar* myActionsToolBar; //!< actions tool bar |
100 | View_ToolBar* myViewToolBar; //!< window tool bar |
101 | }; |
102 | |
103 | #endif |