0029674: Improvements in Inspector tool
[occt.git] / tools / VInspector / VInspector_ItemSelectMgrFilter.hxx
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_ItemSelectMgrFilter_H
17 #define VInspector_ItemSelectMgrFilter_H
18
19 #include <Standard.hxx>
20 #include <inspector/VInspector_ItemBase.hxx>
21
22 #include <SelectMgr_Filter.hxx>
23
24 class QItemSelectionModel;
25
26 class VInspector_ItemSelectMgrFilter;
27 typedef QExplicitlySharedDataPointer<VInspector_ItemSelectMgrFilter> VInspector_ItemSelectMgrFilterPtr;
28
29 //! \class VInspector_ItemSelectMgrFilter
30 //! Item presents information about SelectMgr_Filter.
31 //! Parent is item folder, children are sub filter if the filter is a composition filter.
32 class VInspector_ItemSelectMgrFilter : public VInspector_ItemBase
33 {
34
35 public:
36
37   //! Creates an item wrapped by a shared pointer
38   static VInspector_ItemSelectMgrFilterPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
39   { return VInspector_ItemSelectMgrFilterPtr (new VInspector_ItemSelectMgrFilter (theParent, theRow, theColumn)); }
40   //! Destructor
41   virtual ~VInspector_ItemSelectMgrFilter() Standard_OVERRIDE {};
42
43   //! Returns the current filter, init item if it was not initialized yet
44   //! \return filter object
45   Standard_EXPORT Handle(SelectMgr_Filter) GetFilter() const;
46
47   //! Inits the item, fills internal containers
48   Standard_EXPORT virtual void Init() Standard_OVERRIDE;
49
50   //! Resets cached values
51   Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
52
53 protected:
54
55   //! Initialize the current item. It is empty because Reset() is also empty.
56   virtual void initItem() const Standard_OVERRIDE;
57
58   //! Returns number of item selected
59   //! \return rows count
60   virtual int initRowCount() const Standard_OVERRIDE;
61
62   //! Returns item information for the given role. Fills internal container if it was not filled yet
63   //! \param theItemRole a value role
64   //! \return the value
65   virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
66
67   //! Creates a child item in the given position.
68   //! \param theRow the child row position
69   //! \param theColumn the child column position
70   //! \return the created item
71   virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
72
73 private:
74
75   //! Set filter into the current item
76   //! \param theFilter a filter
77   void setFilter (Handle(SelectMgr_Filter) theFilter) { myFilter = theFilter; }
78
79 private:
80
81   //! Constructor
82   //! param theParent a parent item
83   VInspector_ItemSelectMgrFilter (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
84   : VInspector_ItemBase (theParent, theRow, theColumn) {}
85
86 protected:
87
88   Handle(SelectMgr_Filter) myFilter; //!< the current filter
89 };
90
91 #endif