ctkVTKObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 #ifndef __ctkVTKObject_h
00022 #define __ctkVTKObject_h
00023 
00025 #include "ctkVTKObjectEventsObserver.h"
00026 
00027 //-----------------------------------------------------------------------------
00028 #define QVTK_OBJECT_ADD_CONNECTION_METHOD                               \
00029 QString qvtkConnect(vtkObject* vtk_obj, unsigned long vtk_event,        \
00030                     const QObject* qt_obj, const char* qt_slot,         \
00031                     float priority = 0.0)                               \
00032 {                                                                       \
00033   return MyQVTK.addConnection(vtk_obj, vtk_event,                       \
00034                               qt_obj, qt_slot, priority);               \
00035 }
00036 
00037 //-----------------------------------------------------------------------------
00038 #define QVTK_OBJECT_RECONNECT_METHOD                                    \
00039 QString qvtkReconnect(vtkObject* old_vtk_obj, vtkObject* vtk_obj,       \
00040                       unsigned long vtk_event, const QObject* qt_obj,   \
00041                       const char* qt_slot, float priority = 0.0)        \
00042 {                                                                       \
00043   return MyQVTK.addConnection(old_vtk_obj, vtk_obj, vtk_event,          \
00044                               qt_obj, qt_slot, priority);               \
00045 }
00046 
00047 //-----------------------------------------------------------------------------
00048 #define QVTK_OBJECT_RECONNECT_METHOD_2                                  \
00049 QString qvtkReconnect(vtkObject* vtk_obj,                               \
00050                       unsigned long vtk_event, const QObject* qt_obj,   \
00051                       const char* qt_slot, float priority = 0.0)        \
00052 {                                                                       \
00053   return MyQVTK.reconnection(vtk_obj, vtk_event,                        \
00054                              qt_obj, qt_slot, priority);                \
00055 }
00056 
00057 //-----------------------------------------------------------------------------
00058 #define QVTK_OBJECT_REMOVE_CONNECTION_METHOD                            \
00059 int qvtkDisconnect(vtkObject* vtk_obj, unsigned long vtk_event,         \
00060   const QObject* qt_obj, const char* qt_slot)                           \
00061 {                                                                       \
00062   return MyQVTK.removeConnection(vtk_obj, vtk_event,                    \
00063     qt_obj, qt_slot);                                                   \
00064 }
00065 
00066 //-----------------------------------------------------------------------------
00067 #define QVTK_OBJECT_REMOVEALL_CONNECTION_METHOD                         \
00068 int qvtkDisconnectAll()                                                 \
00069 {                                                                       \
00070   return MyQVTK.removeAllConnections();                                 \
00071 }
00072 
00073 //-----------------------------------------------------------------------------
00074 #define QVTK_OBJECT_BLOCK_CONNECTION_METHOD                              \
00075 void qvtkBlock(vtkObject* vtk_obj, unsigned long vtk_event,              \
00076   const QObject* qt_obj)                                                 \
00077 {                                                                        \
00078   MyQVTK.blockConnection(true, vtk_obj, vtk_event, qt_obj);              \
00079 }
00080 
00081 //-----------------------------------------------------------------------------
00082 #define QVTK_OBJECT_BLOCK_CONNECTION_METHOD2                             \
00083 void qvtkBlock(const QString& id, bool blocked)                          \
00084 {                                                                        \
00085   MyQVTK.blockConnection(id, blocked);                                   \
00086 }
00087 
00088 //-----------------------------------------------------------------------------
00089 #define QVTK_OBJECT_BLOCKALL_CONNECTION_METHOD                          \
00090 void qvtkBlockAll()                                                     \
00091 {                                                                       \
00092   MyQVTK.blockAllConnections(true);                                     \
00093 }
00094 
00095 //-----------------------------------------------------------------------------
00096 #define QVTK_OBJECT_UNBLOCK_CONNECTION_METHOD                             \
00097 void qvtkUnblock(vtkObject* vtk_obj, unsigned long vtk_event,             \
00098   const QObject* qt_obj)                                                  \
00099 {                                                                         \
00100   MyQVTK.blockConnection(false, vtk_obj, vtk_event, qt_obj);              \
00101 }
00102 
00103 //-----------------------------------------------------------------------------
00104 #define QVTK_OBJECT_UNBLOCKALL_CONNECTION_METHOD                        \
00105 void qvtkUnblockAll()                                                   \
00106 {                                                                       \
00107   MyQVTK.blockAllConnections(false);                                    \
00108 }
00109 
00110 //-----------------------------------------------------------------------------
00111 #define QVTK_OBJECT                                \
00112 protected:                                         \
00113   QVTK_OBJECT_ADD_CONNECTION_METHOD                \
00114   QVTK_OBJECT_RECONNECT_METHOD                     \
00115   QVTK_OBJECT_RECONNECT_METHOD_2                   \
00116   QVTK_OBJECT_REMOVE_CONNECTION_METHOD             \
00117   QVTK_OBJECT_REMOVEALL_CONNECTION_METHOD          \
00118   QVTK_OBJECT_BLOCK_CONNECTION_METHOD              \
00119   QVTK_OBJECT_BLOCK_CONNECTION_METHOD2             \
00120   QVTK_OBJECT_UNBLOCK_CONNECTION_METHOD            \
00121   QVTK_OBJECT_BLOCKALL_CONNECTION_METHOD           \
00122   QVTK_OBJECT_UNBLOCKALL_CONNECTION_METHOD         \
00123 private:                                           \
00124   ctkVTKObjectEventsObserver MyQVTK;
00125 
00126 
00127 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 21 May 2010 for CTK by  doxygen 1.6.1