1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef DFBrowser_AttributePaneStack_H
17 #define DFBrowser_AttributePaneStack_H
19 #include <inspector/DFBrowser_AttributePaneType.hxx>
20 #include <inspector/TreeModel_ItemBase.hxx>
22 #include <Standard.hxx>
24 #include <Standard_WarningsDisable.hxx>
26 #include <QItemSelection>
27 #include <QStackedWidget>
29 #include <Standard_WarningsRestore.hxx>
31 class DFBrowserPane_AttributePaneAPI;
32 class DFBrowserPane_AttributePaneSelector;
33 class DFBrowser_Module;
34 class DFBrowser_SearchView;
35 class DFBrowser_TreeLevelView;
40 //! \class DFBrowser_AttributePaneStack
41 //! \brief Provides work to stacked widget where the current attribute pane is shown.
42 class DFBrowser_AttributePaneStack : public QObject
47 Standard_EXPORT DFBrowser_AttributePaneStack (QObject* theParent);
50 virtual ~DFBrowser_AttributePaneStack() {}
52 //! Creates a stacked widget
53 //! \param theParent a parent widget
54 Standard_EXPORT virtual void CreateWidget (QWidget* theParent);
56 //! \return the stacked widget
57 QWidget* GetWidget() const { return myAttributesStack; }
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; }
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);
67 //! \return an attribute pane, which corresponds the current widget of the stacked widget control
68 DFBrowserPane_AttributePaneAPI* GetCurrentPane() const { return myCurrentPane; }
70 //! \return tree level view
71 DFBrowser_TreeLevelView* GetTreeLevelView() const { return myTreeLevelView; }
73 //! \return the search view
74 DFBrowser_SearchView* GetSearchView() const { return mySearchView; }
76 //! \return the pane selector
77 DFBrowserPane_AttributePaneSelector* GetPaneSelector() const { return myPaneSelector; }
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);
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