• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/GUISupport/Qt/vtkQtConnection.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Copyright 2004 Sandia Corporation.
00004   Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00005   license for use of this work by or on behalf of the
00006   U.S. Government. Redistribution and use in source and binary forms, with
00007   or without modification, are permitted provided that this Notice and any
00008   statement of authorship are reproduced on all copies.
00009 
00010 =========================================================================*/
00011 
00012 /*========================================================================
00013  For general information about using VTK and Qt, see:
00014  http://www.trolltech.com/products/3rdparty/vtksupport.html
00015 =========================================================================*/
00016 
00017 /*========================================================================
00018  !!! WARNING for those who want to contribute code to this file.
00019  !!! If you use a commercial edition of Qt, you can modify this code.
00020  !!! If you use an open source version of Qt, you are free to modify
00021  !!! and use this code within the guidelines of the GPL license.
00022  !!! Unfortunately, you cannot contribute the changes back into this
00023  !!! file.  Doing so creates a conflict between the GPL and BSD-like VTK
00024  !!! license.
00025 =========================================================================*/
00026 
00027 // .SECTION Description
00028 // vtkQtConnection is an internal class.
00029 
00030 
00031 #ifndef VTK_QT_CONNECTION
00032 #define VTK_QT_CONNECTION
00033 
00034 #include "vtkObject.h"
00035 #include "vtkCommand.h"  // for event defines
00036 #include "qobject.h"
00037 
00038 class QObject;
00039 class vtkCallbackCommand;
00040 class vtkEventQtSlotConnect;
00041 
00042 // class for managing a single VTK/Qt connection
00043 // not to be included in other projects
00044 // only here for moc to process for vtkEventQtSlotConnect
00045 class vtkQtConnection : public QObject
00046 {
00047   Q_OBJECT
00048   
00049   public:
00050 
00051     // constructor
00052     vtkQtConnection(vtkEventQtSlotConnect* owner);
00053 
00054     // destructor, disconnect if necessary
00055     ~vtkQtConnection();
00056    
00057     // print function
00058     void PrintSelf(ostream& os, vtkIndent indent);
00059     
00060     // callback from VTK to emit signal
00061     void Execute(vtkObject* caller, unsigned long event, void* client_data);
00062     
00063     // set the connection
00064     void SetConnection(vtkObject* vtk_obj, unsigned long event,
00065                        const QObject* qt_obj, const char* slot, 
00066                        void* client_data, float priority=0.0
00067 #if QT_VERSION >= 0x040000
00068                          ,Qt::ConnectionType type = Qt::AutoConnection);
00069 #else
00070                          );
00071 #endif
00072     
00073     // check if a connection matches input parameters
00074     bool IsConnection(vtkObject* vtk_obj, unsigned long event,
00075                       const QObject* qt_obj, const char* slot,
00076                       void* client_data);
00077 
00078     static void DoCallback(vtkObject* vtk_obj, unsigned long event,
00079                            void* client_data, void* call_data);
00080     
00081   signals:
00082     // the qt signal for moc to take care of
00083     void EmitExecute(vtkObject*, unsigned long, void* client_data, void* call_data, vtkCommand*);
00084 
00085   protected slots:
00086     void deleteConnection();
00087 
00088   protected:
00089     
00090     // the connection information
00091     vtkObject* VTKObject;
00092     vtkCallbackCommand* Callback;
00093     const QObject* QtObject;
00094     void* ClientData;
00095     unsigned long VTKEvent;
00096     QString QtSlot;
00097     vtkEventQtSlotConnect* Owner;
00098 
00099   private:
00100     vtkQtConnection(const vtkQtConnection&);
00101     void operator=(const vtkQtConnection&);
00102 
00103 };
00104 
00105 #endif
00106 

Generated by  doxygen 1.7.1