Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
vtkQtConnection.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 // original copyright below
18 
19 /*=========================================================================
20 
21  Copyright 2004 Sandia Corporation.
22  Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
23  license for use of this work by or on behalf of the
24  U.S. Government. Redistribution and use in source and binary forms, with
25  or without modification, are permitted provided that this Notice and any
26  statement of authorship are reproduced on all copies.
27 
28 =========================================================================*/
29 
30 /*========================================================================
31  For general information about using VTK and Qt, see:
32  http://www.trolltech.com/products/3rdparty/vtksupport.html
33 =========================================================================*/
34 
35 /*========================================================================
36  !!! WARNING for those who want to contribute code to this file.
37  !!! If you use a commercial edition of Qt, you can modify this code.
38  !!! If you use an open source version of Qt, you are free to modify
39  !!! and use this code within the guidelines of the GPL license.
40  !!! Unfortunately, you cannot contribute the changes back into this
41  !!! file. Doing so creates a conflict between the GPL and BSD-like VTK
42  !!! license.
43 =========================================================================*/
44 
45 // .SECTION Description
46 // vtkQtConnection is an internal class.
47 
48 
49 #ifndef VTK_QT_CONNECTION
50 #define VTK_QT_CONNECTION
51 
52 #include "vtkObject.h"
53 #include "vtkCommand.h" // for event defines
54 #include "qobject.h"
55 
57 
58 class QObject;
59 class vtkCallbackCommand;
60 class vtkEventQtSlotConnect;
61 
62 // class for managing a single VTK/Qt connection
63 // not to be included in other projects
64 // only here for moc to process for vtkEventQtSlotConnect
66 {
67  Q_OBJECT
68 
69  public:
70 
71  // constructor
72  vtkQtConnection(vtkEventQtSlotConnect* owner);
73 
74  // destructor, disconnect if necessary
75  ~vtkQtConnection();
76 
77  // print function
78  void PrintSelf(ostream& os, vtkIndent indent);
79 
80  // callback from VTK to emit signal
81  void Execute(vtkObject* caller, unsigned long event, void* client_data);
82 
83  // set the connection
84  void SetConnection(vtkObject* vtk_obj, unsigned long event,
85  const QObject* qt_obj, const char* slot,
86  void* client_data, float priority=0.0
87  ,Qt::ConnectionType type = Qt::AutoConnection);
88 
89  // check if a connection matches input parameters
90  bool IsConnection(vtkObject* vtk_obj, unsigned long event,
91  const QObject* qt_obj, const char* slot,
92  void* client_data);
93 
94  static void DoCallback(vtkObject* vtk_obj, unsigned long event,
95  void* client_data, void* call_data);
96 
97  signals:
98  // the qt signal for moc to take care of
99  void EmitExecute(vtkObject*, unsigned long, void* client_data, void* call_data, vtkCommand*);
100 
101  protected slots:
102  void deleteConnection();
103 
104  protected:
105 
106  // the connection information
107  vtkObject* VTKObject;
108  vtkCallbackCommand* Callback;
109  const QObject* QtObject;
110  void* ClientData;
111  unsigned long VTKEvent;
112  QString QtSlot;
113  vtkEventQtSlotConnect* Owner;
114 
115  private:
117  void operator=(const vtkQtConnection&);
118 
119 };
120 
121 #endif
vtkCallbackCommand * Callback
unsigned long VTKEvent
const QObject * QtObject
#define MITKOPENVIEWCORE_EXPORT
vtkEventQtSlotConnect * Owner
vtkObject * VTKObject