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 DFBrowserPane_AttributePaneAPI_H |
17 | #define DFBrowserPane_AttributePaneAPI_H |
18 | |
19 | #include <TDF_Attribute.hxx> |
20 | #include <NCollection_List.hxx> |
21 | #include <TDF_Label.hxx> |
22 | #include <TDF_LabelList.hxx> |
23 | #include <Standard.hxx> |
24 | #include <Standard_Transient.hxx> |
25 | |
26 | #include <list> |
27 | |
28 | class QWidget; |
29 | class QItemSelectionModel; |
30 | |
31 | //! \class DFBrowserPane_AttributePane |
32 | //! \brief This is a base class for attribute pane. It defines methods that should be redefined in chindren. |
33 | //! The kinds of information provided by the methods: |
34 | //! - widget, a control that should be shown for this kind of attribute |
35 | //! - Init method to fill control by the attribute context |
36 | //! - selection models that are active, the application can connect to the models to react to selection change |
37 | //! - presentation/references/attribute references of attribute custom information about this attribute |
38 | class DFBrowserPane_AttributePaneAPI |
39 | { |
40 | public: |
41 | |
42 | //! Constructor |
43 | DFBrowserPane_AttributePaneAPI() {} |
44 | |
45 | //! Destructor |
46 | virtual ~DFBrowserPane_AttributePaneAPI() {} |
47 | |
48 | //! Creates widget to visualize values of this kind of attribute |
49 | //! \param theParent a parent for the widget |
50 | //! \param isToCreate flag whether the widget should be created |
51 | virtual QWidget* GetWidget (QWidget* theParent, const bool isToCreate) |
52 | { (void)theParent; (void)isToCreate; return 0; } |
53 | |
54 | //! Initializes the content of the pane by the parameter attribute |
55 | //! \param theAttribute an OCAF attribute |
56 | virtual void Init (const Handle(TDF_Attribute)& theAttribute) { (void)theAttribute; }; |
57 | |
58 | //! Returns selections models of the pane, if the selection is possible in the pane controls |
59 | virtual std::list<QItemSelectionModel*> GetSelectionModels() { return std::list<QItemSelectionModel*>(); } |
60 | |
61 | //! Returns selection kind for the model, it may be General selection or Additional selection for example |
62 | //! \param theModel one of selection models provided by this pane |
63 | //! \return selection kind |
64 | virtual int GetSelectionKind (QItemSelectionModel* theModel) { (void)theModel; return -1; } |
65 | |
66 | //! Returns selection parameters, that may be useful for communicate between tools |
67 | //! \param theModel one of selection models provided by this pane |
68 | //! \theParameters a container of parameters, might be extended depending on the pane state(e.g. selection) |
6822a3be |
69 | //! \theItemNames names to be selected for each selection parameter |
14bbbdcb |
70 | virtual void GetSelectionParameters (QItemSelectionModel* theModel, |
6822a3be |
71 | NCollection_List<Handle(Standard_Transient)>& theParameters, |
72 | NCollection_List<TCollection_AsciiString>& theItemNames) |
73 | { (void)theModel; (void)theParameters; (void)theItemNames; } |
14bbbdcb |
74 | |
75 | //! Returns presentation of the attribute to be visualized in the view |
76 | //! \param theAttribute a current attribute |
77 | //! \return handle of presentation if the attribute has, to be visualized |
78 | virtual Handle(Standard_Transient) GetPresentation (const Handle(TDF_Attribute)& theAttribute) |
79 | { (void)theAttribute; return Handle(Standard_Transient)(); } |
80 | |
81 | //! Returns container of Label references to the attribute |
82 | //! \param theAttribute a current attribute |
83 | //! \param theRefLabels a container of label references, to be selected in tree view |
84 | //! \param theRefPresentation handle of presentation for the references, to be visualized |
85 | virtual void GetReferences (const Handle(TDF_Attribute)& theAttribute, |
86 | NCollection_List<TDF_Label>& theRefLabels, |
87 | Handle(Standard_Transient)& theRefPresentation) |
88 | { (void)theAttribute; (void)theRefLabels; (void)theRefPresentation; } |
89 | |
90 | //! Returns container of Attribute references to the attribute |
91 | //! \param theAttribute a current attribute |
92 | //! \param theRefAttributes a container of attribute references, to be selected in tree view |
93 | //! \param theRefPresentation handle of presentation for the references, to be visualized |
94 | virtual void GetAttributeReferences (const Handle(TDF_Attribute)& theAttribute, |
95 | NCollection_List<Handle(TDF_Attribute)>& theRefAttributes, |
96 | Handle(Standard_Transient)& theRefPresentation) |
97 | { (void)theAttribute; (void)theRefAttributes; (void)theRefPresentation; } |
98 | }; |
99 | |
100 | #endif |