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 VInspector_ItemBase_H |
17 | #define VInspector_ItemBase_H |
18 | |
19 | #include <AIS_InteractiveContext.hxx> |
20 | #include <Standard.hxx> |
0cb512c0 |
21 | #include <inspector/TreeModel_ItemBase.hxx> |
14bbbdcb |
22 | |
23 | class VInspector_ItemBase; |
24 | typedef QExplicitlySharedDataPointer<VInspector_ItemBase> VInspector_ItemBasePtr; |
25 | |
26 | //! \class VInspector_ItemBase |
27 | //! Parent item for all ShapeView items |
28 | class VInspector_ItemBase : public TreeModel_ItemBase |
29 | { |
30 | public: |
31 | //! Resets cached values |
32 | virtual void Reset() Standard_OVERRIDE { TreeModel_ItemBase::Reset(); } |
33 | |
34 | //! Sets the context |
35 | //! \param theLabel an object where the child items structure is found |
36 | void SetContext (const Handle(AIS_InteractiveContext)& theContext) { myContext = theContext; } |
37 | |
38 | //! Returns true if the current context is not null |
39 | //! \return a boolean value |
40 | bool HasContext() const { return !GetContext().IsNull(); } |
41 | |
42 | //! Returns the current contex. It iterates up by list of parents to found context item and return context |
43 | //! \return a context |
44 | Standard_EXPORT const Handle(AIS_InteractiveContext)& GetContext() const; |
45 | |
46 | protected: |
47 | |
48 | //! Initialize the current item. It creates a backup of the specific item information |
49 | virtual void initItem() const {};// = 0; |
50 | |
51 | protected: |
52 | |
53 | //! Constructor |
54 | //! param theParent a parent item |
55 | //! \param theRow the item row positition in the parent item |
56 | //! \param theColumn the item column positition in the parent item |
57 | VInspector_ItemBase (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) |
58 | : TreeModel_ItemBase (theParent, theRow, theColumn), myContext (0) {} |
59 | |
60 | protected: |
61 | |
62 | Handle(AIS_InteractiveContext) myContext; //!< the current context |
63 | }; |
64 | |
65 | #endif |