1 // Created on: 2020-01-25
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2020 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 TreeModel_ItemStream_H
17 #define TreeModel_ItemStream_H
19 #include <Standard.hxx>
20 #include <NCollection_IndexedDataMap.hxx>
21 #include <TCollection_AsciiString.hxx>
23 #include <inspector/TreeModel_ItemBase.hxx>
25 class TreeModel_ItemProperties;
26 class TreeModel_ItemStream;
28 typedef QExplicitlySharedDataPointer<TreeModel_ItemStream> TreeModel_ItemStreamPtr;
30 //! \class TreeModel_ItemStream
31 //! Parent item, that corresponds to AIS_InteractiveContext
32 //! Children of the item are:
33 //! - "Property" item to show context attributes such as selection filters and drawer properties
34 //! - presentation items to show all interactive elements displayed/erased in the context
35 class TreeModel_ItemStream : public TreeModel_ItemBase
39 //! Creates an item wrapped by a shared pointer
40 static TreeModel_ItemStreamPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
41 { return TreeModel_ItemStreamPtr (new TreeModel_ItemStream (theParent, theRow, theColumn)); }
44 virtual ~TreeModel_ItemStream() {}
46 //! Sets the item internal initialized state to the true. If the item has internal values,
47 //! there should be initialized here.
48 Standard_EXPORT virtual void Init() Standard_OVERRIDE;
50 //! Resets the item and the child items content. Sets the initialized state to false.
51 //! If the item has internal values, there should be reseted here.
52 Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
54 //! Returns number of displayed presentations
55 //! \return rows count
56 virtual int initRowCount() const Standard_OVERRIDE { initItem(); return 0; }
58 //! Returns item information for the given role. Fills internal container if it was not filled yet
59 //! \param theItemRole a value role
61 Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
64 //! Returns stream value of the item to fulfill property panel.
65 //! \return stream value or dummy
66 Standard_EXPORT virtual void initStream (Standard_OStream& theOStream) const;
68 //! Initializes the current item. It creates a backup of the specific item information
69 //! Does nothing as context has been already set into item
70 Standard_EXPORT virtual void initItem() const Standard_OVERRIDE;
74 //! Creates a child item in the given position.
75 //! \param theRow the child row position
76 //! \param theColumn the child column position
77 //! \return the created item
78 Standard_EXPORT virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
83 //! \param theParent a parent item
84 //! \param theRow the item row position in the parent item
85 //! \param theColumn the item column position in the parent item
86 Standard_EXPORT TreeModel_ItemStream(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn);