0031939: Coding - correction of spelling errors in comments [part 2]
[occt.git] / tools / View / View_Window.hxx
CommitLineData
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
26class View_Displayer;
27class View_ToolBar;
28class View_Widget;
29
30class 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.
36class View_Window : public QWidget
37{
38 Q_OBJECT
39
40public:
41
42 //! Constructor
7e1c1e48 43 Standard_EXPORT View_Window (QWidget* theParent,
44 const Handle(AIS_InteractiveContext)& theContext = Handle(AIS_InteractiveContext)(),
45 const bool isUseKeepView = true, const bool isFitAllActive = true);
14bbbdcb 46
47 //! Destructor
48 virtual ~View_Window() {}
49
50 //! Returns view displayer
7e1c1e48 51 View_Displayer* Displayer() const { return myDisplayer; }
14bbbdcb 52
53 //! Returns view widget
7e1c1e48 54 View_Widget* ViewWidget() const { return myView; }
14bbbdcb 55
56 //! Returns actions tool bar
7e1c1e48 57 QToolBar* ActionsToolBar() const { return myActionsToolBar; }
14bbbdcb 58
59 //! Returns window tool bar
7e1c1e48 60 View_ToolBar* ViewToolBar() const { return myViewToolBar; }
14bbbdcb 61
62 //! Sets a new context for context type
63 //! \param theType a type of context, will be selected in the tool bar combo box
64 //! \param theContext an AIS context
65 Standard_EXPORT void SetContext (View_ContextType theType, const Handle(AIS_InteractiveContext)& theContext);
66
ed753e10 67 //! Sets default size that is used in sizeHint when the widget is firstly show
68 Standard_EXPORT void SetPredefinedSize (int theDefaultWidth, int theDefaultHeight);
69
70 //! Sets initial camera position
71 //! \param theVx direction on Ox
72 //! \param theVy direction on Oy
73 //! \param theVz direction on Oz
74 Standard_EXPORT void SetInitProj (const Standard_Real theVx, const Standard_Real theVy, const Standard_Real theVz);
75
76 //! Returns an active view
77 Standard_EXPORT Handle(V3d_View) View() const;
78
7e1c1e48 79 //! Saves state of view window in a container in form: key, value. It saves:
80 //! - visibility of columns,
81 //! - columns width
82 //! \param theTreeView a view instance
83 //! \param theItems [out] properties
a110c4a3 84 //! \param thePrefix preference item prefix
7e1c1e48 85 Standard_EXPORT static void SaveState (View_Window* theView, QMap<QString, QString>& theItems,
86 const QString& thePrefix = QString());
87
88 //! Restores state of view window by a container
89 //! \param theTreeView a view instance
90 //! \param theKey property key
91 //! \param theValue property value
a110c4a3 92 //! \param thePrefix preference item prefix
7e1c1e48 93 //! \return boolean value whether the property is applied to the tree view
94 Standard_EXPORT static bool RestoreState (View_Window* theView, const QString& theKey, const QString& theValue,
95 const QString& thePrefix = QString());
96
6822a3be 97signals:
98 //! Signals about calling erasing all presentations in context
99 void eraseAllPerformed();
100
14bbbdcb 101protected slots:
102
103 //! Processing context change:
104 //! - set an active context in the displayer,
105 //! - erase all displayed presentations from the previous context,
106 //! - sets the current view enabled only if a current context type is View_ContextType_Own
107 void onViewSelectorActivated();
108
6822a3be 109 //! Processing widget action checked state changed: for Fit All action, if checked, displayer do FitAll automatically
110 //! \param theActionId a clicked action
111 //! \param theState a result checked state
112 void onCheckedStateChanged (int theActionId, bool theState);
113
14bbbdcb 114 //! Processing window tool bar actions
115 void onToolBarActionClicked (const int theActionId);
116
6822a3be 117 //! Shows context menu for view. It contains set view orientation actions.
118 //! \param thePosition a clicked point
119 void onViewContextMenuRequested (const QPoint& thePosition);
120
121 //! Sets the view scene orientation by the text of selected action
122 void onSetOrientation();
123
14bbbdcb 124 //! Sets selected display mode in the current context
125 void onDisplayModeChanged();
126
127private:
128
129 View_Displayer* myDisplayer; //!< displayer
130 View_Widget* myView; //!< view widget
131 QToolBar* myActionsToolBar; //!< actions tool bar
132 View_ToolBar* myViewToolBar; //!< window tool bar
133};
134
135#endif