Slicer  4.10
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 #include <QVariant>
32 
33 // MRML includes
35 
36 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
37 
38 class QStandardItem;
39 class QAction;
40 class QColor;
42 
64 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyAbstractPlugin : public QObject
65 {
66  Q_OBJECT
67 
71  Q_PROPERTY(QString name READ name WRITE setName)
72 
73 public:
74  typedef QObject Superclass;
75  qSlicerSubjectHierarchyAbstractPlugin(QObject* parent = NULL);
77 
78 // Role-related virtual methods
79 // If the subclass plugin does not offer a role, these do not need to be overridden
80 public:
87  Q_INVOKABLE virtual double canOwnSubjectHierarchyItem(vtkIdType itemID)const;
88 
91  Q_INVOKABLE virtual const QString roleForPlugin()const;
92 
94  virtual const QString helpText()const;
95 
98  virtual QIcon icon(vtkIdType itemID);
99 
101  Q_INVOKABLE virtual QIcon visibilityIcon(int visible);
102 
104  Q_INVOKABLE virtual void editProperties(vtkIdType itemID);
105 
108  virtual QString displayedItemName(vtkIdType itemID)const;
109 
111  Q_INVOKABLE virtual QString tooltip(vtkIdType itemID)const;
112 
114  Q_INVOKABLE virtual void setDisplayVisibility(vtkIdType itemID, int visible);
115 
118  Q_INVOKABLE virtual int getDisplayVisibility(vtkIdType itemID)const;
119 
127  Q_INVOKABLE virtual void setDisplayColor(vtkIdType itemID, QColor color, QMap<int, QVariant> terminologyMetaData);
128 
135  Q_INVOKABLE virtual QColor getDisplayColor(vtkIdType itemID, QMap<int, QVariant> &terminologyMetaData)const;
136 
137  // Function related virtual methods
138 public:
141  Q_INVOKABLE virtual QList<QAction*> itemContextMenuActions()const;
142 
147  Q_INVOKABLE virtual QList<QAction*> sceneContextMenuActions()const;
148 
151  Q_INVOKABLE virtual void showContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
152 
155  Q_INVOKABLE virtual QList<QAction*> visibilityContextMenuActions()const;
156 
159  Q_INVOKABLE virtual void showVisibilityContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
160 
161 // Parenting related virtual methods with default implementation
162 public:
172  virtual double canAddNodeToSubjectHierarchy(
173  vtkMRMLNode* node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID )const;
174 
180  virtual bool addNodeToSubjectHierarchy(vtkMRMLNode* node, vtkIdType parentItemID);
181 
190  virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)const;
191 
194  virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID);
195 
196 // Utility functions
197 public:
199  Q_INVOKABLE bool isThisPluginOwnerOfItem(vtkIdType itemID)const;
200 
203  Q_INVOKABLE static qSlicerAbstractModuleWidget* switchToModule(QString moduleName);
204 
205 public:
207  virtual QString name()const;
208 
211  virtual void setName(QString name);
212 
213 signals:
215  void requestExpandItem(vtkIdType itemID);
216 
219  void requestInvalidateFilter()const;
220 
221 protected:
226  void hideAllContextMenuActions()const;
227 
228 protected:
230  QString m_Name;
231 
232 private:
234  void operator=(const qSlicerSubjectHierarchyAbstractPlugin&); // Not implemented
236 };
237 
238 #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:138
virtual Q_INVOKABLE void showVisibilityContextMenuActionsForItem(vtkIdType itemID)