1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 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_VisibilityState_H
17 #define TreeModel_VisibilityState_H
19 #include <inspector/TreeModel_ModelBase.hxx>
20 #include <inspector/TreeModel_ColumnType.hxx>
22 #include <Standard.hxx>
23 #include <Standard_Macro.hxx>
25 //! \class TreeModel_VisibilityState
26 //! \brief Interface that provides connection between model and visualization control to:
27 //! - know whether the model item is visible
28 //! - change visibility of the model item
29 class TreeModel_VisibilityState
33 TreeModel_VisibilityState (TreeModel_ModelBase* theModel) : myModel (theModel) {}
36 ~TreeModel_VisibilityState() {}
38 //! Returns true if visibility of the item can be changed
39 //! \param theIndex tree model index
40 //! \return boolean value
41 virtual bool CanBeVisible (const QModelIndex& theIndex) const = 0;
43 //! Sets visibility state
44 //! \param theIndex tree model index
45 //! \param theState visibility state
46 //! \param toEmitDataChanged boolean flag whether emit of the model should be done immediately
47 //! \return true if state is changed
48 virtual bool SetVisible (const QModelIndex& theIndex, const bool theState, const bool toEmitDataChanged = true) = 0;
50 //! Returns visibility state value
51 //! \param theIndex tree model index
52 //! \return boolean value
53 virtual bool IsVisible (const QModelIndex& theIndex) const = 0;
56 //! Processes the mouse clicked on the index.
57 //! It changes the item visibility if model allows to change it.
58 //! \theIndex tree model index
59 //! \return true if click is processed
60 Standard_EXPORT bool processClicked (const QModelIndex& theIndex);
64 TreeModel_ModelBase* getModel() const { return myModel; }
67 TreeModel_ModelBase* myModel; //!< tree view model