Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
QmitkFunctionality.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef QMITKFUNCTIONALITY_H_
18 #define QMITKFUNCTIONALITY_H_
19 
20 #ifdef __MINGW32__
21 // We need to inlclude winbase.h here in order to declare
22 // atomic intrinsics like InterlockedIncrement correctly.
23 // Otherwhise, they would be declared wrong within qatomic_windows.h .
24 #include <windows.h>
25 #endif
26 
27 //# blueberry stuff
28 #include <berryQtViewPart.h>
31 
32 #include <berryIPreferences.h>
33 
34 //# mitk stuff
36 #include "mitkDataNodeSelection.h"
37 #include <mitkDataStorage.h>
40 #include <QmitkStdMultiWidget.h>
41 
42 // CTK Includes
43 #include <ctkServiceTracker.h>
44 
45 
46 //# forward declarations
47 
48 namespace mitk {
49  class DataNode;
50  struct IDataStorageService;
51 }
52 
53 namespace berry {
54  struct IBerryPreferences;
55 }
56 
57 class QmitkFunctionalitySelectionProvider;
58 
82 {
83 
84 //# public virtual methods which can be overwritten
85 public:
98  virtual ~QmitkFunctionality();
104  virtual void ClosePart();
108  virtual void OnSelectionChanged(std::vector<mitk::DataNode*> /*nodes*/);
113  virtual void OnPreferencesChanged(const berry::IBerryPreferences*);
119  void SetHandleMultipleDataStorages(bool multiple);
123  bool HandlesMultipleDataStorages() const;
128  virtual void StdMultiWidgetAvailable(QmitkStdMultiWidget& stdMultiWidget);
133  virtual void StdMultiWidgetClosed(QmitkStdMultiWidget& stdMultiWidget);
138  virtual void StdMultiWidgetNotAvailable();
143  virtual void Activated();
147  bool IsActivated() const;
152  virtual void Deactivated();
180  virtual bool IsExclusiveFunctionality() const;
184  void FireNodeSelected(mitk::DataNode* node);
188  void FireNodesSelected(std::vector<mitk::DataNode*> nodes);
192  virtual void Visible();
196  bool IsVisible() const;
200  virtual void Hidden();
201 //# protected virtual methods which can be overwritten
202 protected:
207  virtual void NodeAdded(const mitk::DataNode* node);
212  virtual void NodeChanged(const mitk::DataNode* /*node*/);
217  virtual void NodeRemoved(const mitk::DataNode* node);
222  virtual void DataStorageChanged();
227  std::vector<mitk::DataNode*> GetCurrentSelection() const;
232  std::vector<mitk::DataNode*> GetDataManagerSelection() const;
238  berry::IPreferences::Pointer GetPreferences() const;
249  mitk::DataStorage::Pointer GetDefaultDataStorage() const;
250 
251  mitk::IDataStorageReference::Pointer GetDataStorageReference() const;
252 
259  QmitkStdMultiWidget* GetActiveStdMultiWidget( bool reCreateWidget = true);
267  void HandleException( std::exception& e, QWidget* parent = NULL, bool showDialog = true ) const;
272  void HandleException( const char* str, QWidget* parent = NULL, bool showDialog = true ) const;
276  void WaitCursorOn();
280  void WaitCursorOff();
284  void BusyCursorOn();
288  void BusyCursorOff();
292  void RestoreOverrideCursor();
293 
294 //# other public methods which should not be overwritten
295 public:
299  void CreatePartControl(QWidget* parent) override;
304  void SetFocus() override;
310  void NodeAddedProxy(const mitk::DataNode* node);
316  void NodeRemovedProxy(const mitk::DataNode* node);
322  void NodeChangedProxy(const mitk::DataNode* node);
326  void SetVisible(bool visible);
330  void SetActivated(bool activated);
337  void ClosePartProxy();
338 
339 //# other protected methods which should not be overwritten (or which are deprecated)
340 protected:
345  void AfterCreateQtPartControl();
349  void ActivateLastVisibleFunctionality();
353  void BlueBerrySelectionChanged(const berry::IWorkbenchPart::Pointer& sourcepart, const berry::ISelection::ConstPointer& selection);
357  std::vector<mitk::DataNode*> DataNodeSelectionToVector(mitk::DataNodeSelection::ConstPointer currentSelection) const;
358  //# protected fields
359 protected:
368  QWidget* m_Parent;
372  bool m_Active;
376  bool m_Visible;
377 
378  //# private fields:
379 
380 private:
384  QmitkFunctionalitySelectionProvider* m_SelectionProvider;
388  QScopedPointer<berry::ISelectionListener> m_BlueBerrySelectionListener;
389 
390  ctkServiceTracker<mitk::IDataStorageService*> m_DataStorageServiceTracker;
391 
392 
396  bool m_HandlesMultipleDataStorages;
400  bool m_InDataStorageChanged;
404  std::set<std::string> m_VisibleFunctionalities;
405 };
406 
407 #endif /*QMITKFUNCTIONALITY_H_*/
virtual void SetFocus() override=0
DataCollection - Class to facilitate loading/accessing structured data.
static mitk::DataStorage::Pointer GetDataStorage()
The base class of all MITK related blueberry views (~ in the old version of MITK, this was called "Fu...
berryObjectMacro(QtViewPart) void CreatePartControl(QWidget *parent) override
virtual void CreatePartControl(QWidget *parent) override=0
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66