Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerSubjectHierarchyAbstractPlugin.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
6  Queen's University, Kingston, ON, Canada. All Rights Reserved.
7 
8  See COPYRIGHT.txt
9  or http://www.slicer.org/copyright/copyright.txt for details.
10 
11  Unless required by applicable law or agreed to in writing, software
12  distributed under the License is distributed on an "AS IS" BASIS,
13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  See the License for the specific language governing permissions and
15  limitations under the License.
16 
17  This file was originally developed by Csaba Pinter, PerkLab, Queen's University
18  and was supported through the Applied Cancer Research Unit program of Cancer Care
19  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
20 
21 ==============================================================================*/
22 
23 #ifndef __qSlicerSubjectHierarchyAbstractPlugin_h
24 #define __qSlicerSubjectHierarchyAbstractPlugin_h
25 
26 // Qt includes
27 #include <QObject>
28 #include <QMap>
29 #include <QStringList>
30 #include <QIcon>
31 
32 // MRML includes
34 
35 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
36 
37 class QStandardItem;
38 class QAction;
40 
62 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyAbstractPlugin : public QObject
63 {
64  Q_OBJECT
65 
69  Q_PROPERTY(QString name READ name WRITE setName)
70 
71 public:
72  typedef QObject Superclass;
73  qSlicerSubjectHierarchyAbstractPlugin(QObject* parent = NULL);
75 
76 // Role-related virtual methods
77 // If the subclass plugin does not offer a role, these do not need to be overridden
78 public:
85  Q_INVOKABLE virtual double canOwnSubjectHierarchyItem(vtkIdType itemID)const;
86 
89  Q_INVOKABLE virtual const QString roleForPlugin()const;
90 
92  virtual const QString helpText()const;
93 
96  virtual QIcon icon(vtkIdType itemID);
97 
99  Q_INVOKABLE virtual QIcon visibilityIcon(int visible);
100 
102  Q_INVOKABLE virtual void editProperties(vtkIdType itemID);
103 
106  virtual QString displayedItemName(vtkIdType itemID)const;
107 
109  Q_INVOKABLE virtual QString tooltip(vtkIdType itemID)const;
110 
112  Q_INVOKABLE virtual void setDisplayVisibility(vtkIdType itemID, int visible);
113 
116  Q_INVOKABLE virtual int getDisplayVisibility(vtkIdType itemID)const;
117 
118 // Function related virtual methods
119 public:
122  Q_INVOKABLE virtual QList<QAction*> itemContextMenuActions()const;
123 
128  Q_INVOKABLE virtual QList<QAction*> sceneContextMenuActions()const;
129 
132  Q_INVOKABLE virtual void showContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
133 
136  Q_INVOKABLE virtual QList<QAction*> visibilityContextMenuActions()const;
137 
140  Q_INVOKABLE virtual void showVisibilityContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
141 
142 // Parenting related virtual methods with default implementation
143 public:
153  virtual double canAddNodeToSubjectHierarchy(
154  vtkMRMLNode* node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID )const;
155 
161  virtual bool addNodeToSubjectHierarchy(vtkMRMLNode* node, vtkIdType parentItemID);
162 
171  virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)const;
172 
175  virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID);
176 
177 // Utility functions
178 public:
180  Q_INVOKABLE bool isThisPluginOwnerOfItem(vtkIdType itemID)const;
181 
184  Q_INVOKABLE static qSlicerAbstractModuleWidget* switchToModule(QString moduleName);
185 
186 public:
188  virtual QString name()const;
189 
192  virtual void setName(QString name);
193 
194 signals:
196  void requestExpandItem(vtkIdType itemID);
197 
200  void requestInvalidateFilter()const;
201 
202 protected:
207  void hideAllContextMenuActions()const;
208 
209 protected:
211  QString m_Name;
212 
213 private:
215  void operator=(const qSlicerSubjectHierarchyAbstractPlugin&); // Not implemented
217 };
218 
219 #endif
Abstract plugin for handling Subject Hierarchy items.
virtual Q_INVOKABLE void showContextMenuActionsForItem(vtkIdType itemID)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
virtual Q_INVOKABLE void showVisibilityContextMenuActionsForItem(vtkIdType itemID)