1 // Created on: 2020-02-10 2 // Created by: Natalia ERMOLAEVA 3 // Copyright (c) 2020 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_ItemSelectMgrViewerSelector_H 17 #define VInspector_ItemSelectMgrViewerSelector_H 18 19 #include <Standard.hxx> 20 #include <inspector/VInspector_ItemBase.hxx> 21 22 #include <SelectMgr_ViewerSelector.hxx> 23 24 class VInspector_ItemSelectMgrViewerSelector; 25 typedef QExplicitlySharedDataPointer<VInspector_ItemSelectMgrViewerSelector> VInspector_ItemSelectMgrViewerSelectorPtr; 26 27 //! \class VInspector_ItemSelectMgrViewerSelector 28 //! Parent item is context properties, that corresponds to SelectMgr_ViewerSelector 29 class VInspector_ItemSelectMgrViewerSelector : public VInspector_ItemBase 30 { 31 public: 32 33 //! Creates an item wrapped by a shared pointer CreateItem(TreeModel_ItemBasePtr theParent,const int theRow,const int theColumn)34 static VInspector_ItemSelectMgrViewerSelectorPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) 35 { return VInspector_ItemSelectMgrViewerSelectorPtr (new VInspector_ItemSelectMgrViewerSelector (theParent, theRow, theColumn)); } 36 37 //! Destructor ~VInspector_ItemSelectMgrViewerSelector()38 virtual ~VInspector_ItemSelectMgrViewerSelector() Standard_OVERRIDE {}; 39 40 //! Inits the item, fills internal containers 41 Standard_EXPORT virtual void Init() Standard_OVERRIDE; 42 43 //! Resets cached values 44 Standard_EXPORT virtual void Reset() Standard_OVERRIDE; 45 46 //! Returns data object of the item. 47 //! \return object Handle(Standard_Transient)48 virtual const Handle(Standard_Transient)& Object() const Standard_OVERRIDE { initItem(); return myViewerSelector; } 49 50 //! Returns the current viewer, init item if it was not initialized yet 51 //! \return interactive object GetViewerSelector() const52 Handle(SelectMgr_ViewerSelector) GetViewerSelector() const { return Handle(SelectMgr_ViewerSelector)::DownCast (Object()); } 53 54 protected: 55 //! Initializes the current item. It is empty because Reset() is also empty. 56 virtual void initItem() const Standard_OVERRIDE; 57 58 //! Returns number of displayed presentations 59 //! \return rows count 60 Standard_EXPORT 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 Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE; 66 67 //! Returns stream value of the item to fulfill property panel. 68 //! \return stream value or dummy 69 Standard_EXPORT virtual void initStream (Standard_OStream& theOStream) const Standard_OVERRIDE; 70 71 private: 72 73 //! Constructor 74 //! param theParent a parent item 75 //! \param theRow the item row positition in the parent item 76 //! \param theColumn the item column positition in the parent item VInspector_ItemSelectMgrViewerSelector(TreeModel_ItemBasePtr theParent,const int theRow,const int theColumn)77 VInspector_ItemSelectMgrViewerSelector (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) 78 : VInspector_ItemBase(theParent, theRow, theColumn) {} 79 80 protected: 81 82 Handle(SelectMgr_ViewerSelector) myViewerSelector; //!< the current viewer selector 83 }; 84 85 #endif 86