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.hxx>
20 #include <inspector/TreeModel_ModelBase.hxx>
21 #include <inspector/TreeModel_ColumnType.hxx>
23 #include <Standard.hxx>
24 #include <Standard_Macro.hxx>
26 #include <Standard_WarningsDisable.hxx>
29 #include <Standard_WarningsRestore.hxx>
31 //! \class TreeModel_VisibilityState
32 //! \brief Interface that provides connection between model and visualization control to:
33 //! - know whether the model item is visible
34 //! - change visibility of the model item
35 class TREEMODEL_EXPORT TreeModel_VisibilityState : public QObject
40 TreeModel_VisibilityState (TreeModel_ModelBase* theModel) : myModel (theModel) {}
43 ~TreeModel_VisibilityState() {}
45 //! Returns true if visibility of the item can be changed
46 //! \param theIndex tree model index
47 //! \return boolean value
48 virtual bool CanBeVisible (const QModelIndex& theIndex) const = 0;
50 //! Sets visibility state
51 //! \param theIndex tree model index
52 //! \param theState visibility state
53 //! \param toEmitDataChanged boolean flag whether emit of the model should be done immediatelly
54 //! \return true if state is changed
55 virtual bool SetVisible (const QModelIndex& theIndex, const bool theState, const bool toEmitDataChanged = true) = 0;
57 //! Returns visibility state value
58 //! \param theIndex tree model index
59 //! \return boolean value
60 virtual bool IsVisible (const QModelIndex& theIndex) const = 0;
63 //! Processes the mouse clicked on the index.
64 //! It changes the item visibility if model allows to change it.
65 //! \theIndex tree model index
66 void OnClicked (const QModelIndex& theIndex);
69 //! Signal after OnClicked is performed
70 //! \theIndex tree model index
71 void itemClicked (const QModelIndex& theIndex);
75 TreeModel_ModelBase* getModel() const { return myModel; }
78 TreeModel_ModelBase* myModel; //! tree view model