0030268: Inspectors - improvements in VInspector plugin
[occt.git] / tools / DFBrowserPaneXDE / DFBrowserPaneXDE_AttributeCommonPane.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 DFBrowserPaneXDE_AttributeCommonPane_H
17 #define DFBrowserPaneXDE_AttributeCommonPane_H
18
19 #include <inspector/DFBrowserPane_AttributePane.hxx>
20
21 #include <Standard.hxx>
22 #include <TopoDS_Shape.hxx>
23
24 #include <Standard_WarningsDisable.hxx>
25 #include <QVariant>
26 #include <Standard_WarningsRestore.hxx>
27
28 class QWidget;
29 class QItemSelectionModel;
30
31 //! \class DFBrowserPaneXDE_AttributeCommonPane
32 //! \brief It covers standard attribute panes. The purpose is to return XDE specific short information for
33 //! several kinds of attributes. The other functionality is the same as for standard panes, it just sends
34 //! it to the panes.
35 class DFBrowserPaneXDE_AttributeCommonPane : public DFBrowserPane_AttributePane
36 {
37 public:
38
39   //! Constructor
40   Standard_EXPORT DFBrowserPaneXDE_AttributeCommonPane (DFBrowserPane_AttributePaneAPI* theStandardPane);
41
42   //! Destructor
43   virtual ~DFBrowserPaneXDE_AttributeCommonPane() {}
44
45   //! Returns true if this type can be processed by this pane. It contains standard attributes that
46   //! have difference in presentation (TDataStd_TreeNode, TDF_Reference, TNaming_NamedShape and TDataStd_UAttribute).
47   //! Also it contains XCAFDoc attributes (should be implemented in this package or pane will be empty)
48   //! \param theAttributeType an attribute type
49   Standard_EXPORT static bool ProcessAttribute (Standard_CString theAttributeType);
50
51   //! Creates table view and call create widget of array table helper
52   //! \param theParent a parent widget
53   //! \return a new widget
54   Standard_EXPORT virtual QWidget* CreateWidget (QWidget* theParent) Standard_OVERRIDE;
55
56   //! Initializes the content of the pane by the parameter attribute
57   //! \param theAttribute an OCAF attribute
58   Standard_EXPORT void Init (const Handle(TDF_Attribute)& theAttribute);
59
60   //! Returns list of selection models. In default implementation it contains a selection model for the table view
61   //! \returns container of models
62   Standard_EXPORT virtual std::list<QItemSelectionModel*> GetSelectionModels() Standard_OVERRIDE;
63
64   //! Returns information for the given attribute
65   //! \param theAttribute a current attribute
66   //! \param theRole a role of information, used by tree model (e.g. DisplayRole, icon, background and so on)
67   //! \param theColumnId a tree model column
68   //! \return value, interpreted by tree model depending on the role
69   Standard_EXPORT virtual QVariant GetAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
70                                                      int theRole, int theColumnId) Standard_OVERRIDE;
71
72   //! Returns brief attribute information. In general case, it returns GetValues() result.
73   //! \param theAttribute a current attribute
74   //! \param theValues a result list of values
75   Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
76                                                       QList<QVariant>& theValues) Standard_OVERRIDE;
77
78   //! Returns selection kind for the model, it may be General selection or Additional selection for example
79   //! \param theModel one of selection models provided by this pane
80   //! \return selection kind
81   Standard_EXPORT virtual int GetSelectionKind (QItemSelectionModel* theModel) Standard_OVERRIDE;
82
83   //! Returns selection parameters, that may be useful for communicate between tools
84   //! \param theModel one of selection models provided by this pane
85   //! \theParameters a container of parameters, might be extended depending on the pane state(e.g. selection)
86   //! \theItemNames names to be selected for each selection parameter
87   Standard_EXPORT virtual void GetSelectionParameters (QItemSelectionModel* theModel,
88                                        NCollection_List<Handle(Standard_Transient)>& theParameters,
89                                        NCollection_List<TCollection_AsciiString>& theItemNames) Standard_OVERRIDE;
90
91   //! Returns presentation of the attribute to be visualized in the view
92   //! \param theAttribute a current attribute
93   //! \return handle of presentation if the attribute has, to be visualized
94   Standard_EXPORT virtual Handle(Standard_Transient) GetPresentation
95     (const Handle (TDF_Attribute)& theAttribute) Standard_OVERRIDE;
96
97   //! Returns container of Label references to the attribute
98   //! \param theAttribute a current attribute
99   //! \param theRefLabels a container of label references, to be selected in tree view
100   //! \param theRefPresentation handle of presentation for the references, to be visualized
101   Standard_EXPORT virtual void GetReferences (const Handle(TDF_Attribute)& theAttribute,
102                                               NCollection_List<TDF_Label>& theRefLabels,
103                                               Handle(Standard_Transient)& theRefPresentation) Standard_OVERRIDE;
104
105   //! Returns container of Attribute references to the attribute
106   //! \param theAttribute a current attribute
107   //! \param theRefAttributes a container of attribute references, to be selected in tree view
108   //! \param theRefPresentation handle of presentation for the references, to be visualized
109   Standard_EXPORT virtual void GetAttributeReferences (const Handle(TDF_Attribute)& theAttribute,
110                                        NCollection_List<Handle(TDF_Attribute)>& theRefAttributes,
111                                        Handle(Standard_Transient)& theRefPresentation) Standard_OVERRIDE;
112
113   //! Returns values to fill the table view model
114   //! \param theAttribute a current attribute
115   //! \param theValues a container of values
116   Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
117                                           QList<QVariant>& theValues) Standard_OVERRIDE;
118
119 private:
120
121   DFBrowserPane_AttributePane* myStandardPane; //!< pane, that corresponds to the current type of attribute
122 };
123
124 #endif