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_ItemContext_H
17 #define VInspector_ItemContext_H
19 #include <Standard.hxx>
20 #include <inspector/VInspector_ItemBase.hxx>
22 class VInspector_ItemContext;
23 typedef QExplicitlySharedDataPointer<VInspector_ItemContext> VInspector_ItemContextPtr;
25 //! \class VInspector_ItemContext
26 //! Parent item, that corresponds to AIS_InteractiveContext
27 //! Children of the item are:
28 //! - "Property" item to show context attributes such as selection filters and drawer properties
29 //! - presentation items to show all interactive elements displayed/erased in the context
30 class VInspector_ItemContext : public VInspector_ItemBase
34 //! Creates an item wrapped by a shared pointer
35 static VInspector_ItemContextPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
36 { return VInspector_ItemContextPtr (new VInspector_ItemContext (theParent, theRow, theColumn)); }
39 virtual ~VInspector_ItemContext() {}
41 //! Returns data object of the item.
43 virtual const Handle(Standard_Transient)& Object() const { initItem(); return myContext; }
45 //! Returns number of displayed presentations
46 //! \return rows count
47 Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
49 //! Returns item information for the given role. Fills internal container if it was not filled yet
50 //! \param theItemRole a value role
52 Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
54 //! Inits the item, fills internal containers
55 Standard_EXPORT virtual void Init() Standard_OVERRIDE;
57 //! Resets cached values
58 Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
62 //! Initializes the current item. It creates a backup of the specific item information
63 //! Does nothing as context has been already set into item
64 virtual void initItem() const Standard_OVERRIDE;
66 //! Returns stream value of the item to fulfill property panel.
67 //! \return stream value or dummy
68 Standard_EXPORT virtual void initStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
72 //! Creates a child item in the given position.
73 //! \param theRow the child row position
74 //! \param theColumn the child column position
75 //! \return the created item
76 virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
81 //! \param theParent a parent item
82 //! \param theRow the item row position in the parent item
83 //! \param theColumn the item column position in the parent item
84 VInspector_ItemContext(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
85 : VInspector_ItemBase(theParent, theRow, theColumn) {}