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