6822a3be |
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 VInspector_ItemFolderObject_H |
17 | #define VInspector_ItemFolderObject_H |
18 | |
19 | #include <Standard.hxx> |
20 | #include <inspector/VInspector_ItemBase.hxx> |
21 | |
22 | #include <AIS_InteractiveObject.hxx> |
23 | #include <NCollection_List.hxx> |
24 | #include <TCollection_AsciiString.hxx> |
25 | |
26 | class QItemSelectionModel; |
27 | |
28 | class VInspector_ItemFolderObject; |
29 | typedef QExplicitlySharedDataPointer<VInspector_ItemFolderObject> VInspector_ItemFolderObjectPtr; |
30 | |
31 | //! \class VInspector_ItemFolderObject |
32 | //! Item presents additional level of information in the tree model. |
33 | //! Parent is item context, children are either folder item or Selection filter item. |
34 | class VInspector_ItemFolderObject : public VInspector_ItemBase |
35 | { |
36 | |
37 | public: |
38 | |
39 | //! Creates an item wrapped by a shared pointer |
40 | static VInspector_ItemFolderObjectPtr CreateItem (TreeModel_ItemBasePtr theParent, |
41 | const int theRow, const int theColumn) |
42 | { return VInspector_ItemFolderObjectPtr (new VInspector_ItemFolderObject (theParent, theRow, theColumn)); } |
43 | //! Destructor |
44 | virtual ~VInspector_ItemFolderObject() Standard_OVERRIDE {}; |
45 | |
46 | //! Inits the item, fills internal containers |
47 | Standard_EXPORT virtual void Init() Standard_OVERRIDE; |
48 | |
49 | //! Resets cached values |
50 | Standard_EXPORT virtual void Reset() Standard_OVERRIDE; |
51 | |
52 | protected: |
53 | |
54 | //! Initialize the current item. It is empty because Reset() is also empty. |
55 | virtual void initItem() const Standard_OVERRIDE; |
56 | |
57 | //! Returns number of item selected |
58 | //! \return rows count |
59 | virtual int initRowCount() const Standard_OVERRIDE; |
60 | |
61 | //! Returns item information for the given role. Fills internal container if it was not filled yet |
62 | //! \param theItemRole a value role |
63 | //! \return the value |
64 | virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE; |
65 | |
66 | //! Creates a child item in the given position. |
67 | //! \param theRow the child row position |
68 | //! \param theColumn the child column position |
69 | //! \return the created item |
70 | virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE; |
71 | |
72 | private: |
73 | //! Returns whether the parent item is context item |
74 | //! \returns bolean value |
75 | bool parentItemIsContext() const; |
76 | |
77 | private: |
78 | |
79 | //! Constructor |
80 | //! param theParent a parent item |
81 | VInspector_ItemFolderObject (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) |
82 | : VInspector_ItemBase (theParent, theRow, theColumn) {} |
83 | |
84 | }; |
85 | |
86 | #endif |