1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef VInspector_ItemPresentableObject_H
17 #define VInspector_ItemPresentableObject_H
19 #include <Standard.hxx>
20 #include <VInspector_ItemBase.hxx>
22 #include <AIS_InteractiveObject.hxx>
23 #include <NCollection_List.hxx>
25 class QItemSelectionModel;
27 class VInspector_ItemPresentableObject;
28 typedef QExplicitlySharedDataPointer<VInspector_ItemPresentableObject> VInspector_ItemPresentableObjectPtr;
30 //! \class VInspector_ItemPresentableObject
31 //! Item presents information about AIS_InteractiveObject.
32 //! Parent is item context, children are item selections.
33 class VInspector_ItemPresentableObject : public VInspector_ItemBase
38 //! Creates an item wrapped by a shared pointer
39 static VInspector_ItemPresentableObjectPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
40 { return VInspector_ItemPresentableObjectPtr (new VInspector_ItemPresentableObject (theParent, theRow, theColumn)); }
42 virtual ~VInspector_ItemPresentableObject() Standard_OVERRIDE {};
44 //! Returns the current interactive object, init item if it was not initialized yet
45 //! \return interactive object
46 Standard_EXPORT Handle(AIS_InteractiveObject) GetInteractiveObject() const;
48 //! Returns pointer information for the current interactive object, init item if it was not initialized yet
49 //! \return string value
50 Standard_EXPORT QString PointerInfo() const;
52 //! Inits the item, fills internal containers
53 Standard_EXPORT virtual void Init() Standard_OVERRIDE;
55 //! Resets cached values
56 Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
58 //! Returns presentations, which items are selected in tree view
59 //! \param theSelectionModel a selection model
60 //! \return container of presentations
61 Standard_EXPORT static NCollection_List<Handle(AIS_InteractiveObject)> GetSelectedPresentations
62 (QItemSelectionModel* theSelectionModel);
66 //! Initialize the current item. It is empty because Reset() is also empty.
67 virtual void initItem() const Standard_OVERRIDE;
69 //! Returns number of item selected
70 //! \return rows count
71 virtual int initRowCount() const Standard_OVERRIDE;
73 //! Returns item information for the given role. Fills internal container if it was not filled yet
74 //! \param theItemRole a value role
76 virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
78 //! Creates a child item in the given position.
79 //! \param theRow the child row position
80 //! \param theColumn the child column position
81 //! \return the created item
82 virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
86 //! Set interactive object into the current field
87 //! \param theIO a presentation
88 void setInteractiveObject (Handle(AIS_InteractiveObject) theIO) { myIO = theIO; }
93 //! param theParent a parent item
94 VInspector_ItemPresentableObject(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
95 : VInspector_ItemBase(theParent, theRow, theColumn) {}
99 Handle(AIS_InteractiveObject) myIO; //!< the current interactive context