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