24d5f73599bca96abbb94d0cccb7b0d80bc3ce30
[occt.git] / tools / DFBrowser / DFBrowser_AttributePaneStack.hxx
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 DFBrowser_AttributePaneStack_H
17 #define DFBrowser_AttributePaneStack_H
18
19 #include <inspector/DFBrowser_AttributePaneType.hxx>
20 #include <inspector/TreeModel_ItemBase.hxx>
21
22 #include <Standard.hxx>
23
24 #include <Standard_WarningsDisable.hxx>
25 #include <QMap>
26 #include <QItemSelection>
27 #include <QStackedWidget>
28 #include <QWidget>
29 #include <Standard_WarningsRestore.hxx>
30
31 class DFBrowserPane_AttributePaneAPI;
32 class DFBrowserPane_AttributePaneSelector;
33 class DFBrowser_Module;
34 class DFBrowser_SearchView;
35 class DFBrowser_TreeLevelView;
36
37 class QStackedWidget;
38 class QWidget;
39
40 //! \class DFBrowser_AttributePaneStack
41 //! \brief Provides work to stacked widget where the current attribute pane is shown.
42 class DFBrowser_AttributePaneStack : public QObject
43 {
44 public:
45
46   //! Constructor
47   Standard_EXPORT DFBrowser_AttributePaneStack (QObject* theParent);
48
49   //! Destructor
50   virtual ~DFBrowser_AttributePaneStack() {}
51
52   //! Creates a stacked widget
53   //! \param theParent a parent widget
54   Standard_EXPORT virtual void CreateWidget (QWidget* theParent);
55
56   //! \return the stacked widget
57   QWidget* GetWidget() const { return myAttributesStack; }
58
59   //! Fills stackk with the information
60   //! \param theAttributeTypes a map of attribute type name to information pane
61   void SetModule (DFBrowser_Module* theModule) { myModule = theModule; }
62
63   //! Sets the current widget in the stacked control either attribute pane or search view
64   //! \param theMode an active mode
65   Standard_EXPORT void SetPaneMode (const DFBrowser_AttributePaneType& theMode);
66
67   //! \return an attribute pane, which corresponds the current widget of the stacked widget control
68   DFBrowserPane_AttributePaneAPI* GetCurrentPane() const { return myCurrentPane; }
69
70   //! \return tree level view
71   DFBrowser_TreeLevelView* GetTreeLevelView() const { return myTreeLevelView; }
72
73   //! \return the search view
74   DFBrowser_SearchView* GetSearchView() const { return mySearchView; }
75
76   //! \return the pane selector
77   DFBrowserPane_AttributePaneSelector* GetPaneSelector() const { return myPaneSelector; }
78
79   //! Sets an active widget of attribute pane if the pane mode is item view mode.
80   //! Gets selection models of this pane and set the models into pane selector
81   Standard_EXPORT void SetCurrentItem (const QModelIndex& theIndex);
82
83 protected:
84
85   DFBrowserPane_AttributePaneAPI* myCurrentPane; //!< active pane if mode is item view mode
86   DFBrowserPane_AttributePaneSelector* myPaneSelector; //!< pane selector filled by the active pane
87   QStackedWidget* myAttributesStack; //!< container of already created panes
88   DFBrowser_Module* myModule; //!< the current module
89   DFBrowser_TreeLevelView* myTreeLevelView; //!< view of objects from one level of tree view
90   DFBrowser_SearchView* mySearchView; //!< view of search control
91   QWidget* myEmptyWidget; //!< an empty widget when nothing is selected in tree view
92   DFBrowser_AttributePaneType myPaneMode; //!< the current pane mode, either item view or search view
93 };
94
95 #endif