48b0deba687c64c99dd6a468c721fd7ddf76b6e9
[occt.git] / tools / DFBrowserPane / DFBrowserPane_TNamingUsedShapes.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 DFBrowserPane_TNamingUsedShapes_H
17 #define DFBrowserPane_TNamingUsedShapes_H
18
19 #include <inspector/DFBrowserPane_AttributePane.hxx>
20
21 #include <NCollection_DataMap.hxx>
22 #include <Standard.hxx>
23 #include <TCollection_AsciiString.hxx>
24
25 class QWidget;
26
27 //! \class DFBrowserPane_TNamingUsedShapes
28 //! \brief The class to manipulate of TNaming_UsedShapes attribute
29 class DFBrowserPane_TNamingUsedShapes : public DFBrowserPane_AttributePane
30 {
31 public:
32
33   //! Constructor
34   Standard_EXPORT DFBrowserPane_TNamingUsedShapes();
35
36   //! Destructor
37   virtual ~DFBrowserPane_TNamingUsedShapes() {}
38
39   //! Sets cache of sorted references. If it exists, table view values are obtained not from the attibute
40   //! \param theAttributeRefs container of references
41   void SetSortedReferences (NCollection_DataMap<Handle(TDF_Attribute), std::list<TCollection_AsciiString> >& theAttributeRefs)
42   { myAttributeRefs = theAttributeRefs; }
43
44   //! Clears cache container of sorted references
45   void ClearSortedReferences() { myAttributeRefs.Clear(); }
46
47   //! Returns values to fill the table view model
48   //! \param theAttribute a current attribute
49   //! \param theValues a container of values
50   Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
51                                           QList<QVariant>& theValues) Standard_OVERRIDE;
52
53   //! Returns brief attribute information. In general case, it returns GetValues() result.
54   //! \param theAttribute a current attribute
55   //! \param theValues a result list of values
56   Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
57                                                       QList<QVariant>& theValues) Standard_OVERRIDE;
58
59   //! Returns information for the given attribute
60   //! \param theAttribute a current attribute
61   //! \param theRole a role of information, used by tree model (e.g. DisplayRole, icon, background and so on)
62   //! \param theColumnId a tree model column
63   //! \return value, interpreted by tree model depending on the role
64   Standard_EXPORT virtual QVariant GetAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
65                                                      int theRole, int theColumnId) Standard_OVERRIDE;
66
67   //! Returns container of Attribute references to the attribute
68   //! \param theAttribute a current attribute
69   //! \param theRefAttributes a container of attribute references, to be selected in tree view
70   //! \param theRefPresentation handle of presentation for the references, to be visualized
71   Standard_EXPORT virtual void GetAttributeReferences (const Handle(TDF_Attribute)& theAttribute,
72                                       NCollection_List<Handle(TDF_Attribute)>& theRefAttributes,
73                                       Handle(Standard_Transient)& theRefPresentation) Standard_OVERRIDE;
74
75 protected:
76   //! Defines widths of table columns
77   //! \return container of widths
78   Standard_EXPORT virtual QMap<int, int> getTableColumnWidths() const;
79
80 private:
81
82   NCollection_DataMap<Handle(TDF_Attribute), std::list<TCollection_AsciiString> > myAttributeRefs;
83 };
84
85 #endif