VTK
dox/GUISupport/Qt/vtkEventQtSlotConnect.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 
00047 #ifndef VTK_EVENT_QT_SLOT_CONNECT
00048 #define VTK_EVENT_QT_SLOT_CONNECT
00049 
00050 #include "vtkObject.h"
00051 #include "vtkCommand.h"  // for event defines
00052 #include "QVTKWin32Header.h"  // for export define
00053 #include <QtCore/QObject>          // for version info
00054 
00055 class QObject;
00056 class vtkQtConnections;
00057 class vtkQtConnection;
00058 
00059 // manage connections between VTK object events and Qt slots
00060 class QVTK_EXPORT vtkEventQtSlotConnect : public vtkObject
00061 {
00062   public:
00063     static vtkEventQtSlotConnect* New();
00064     vtkTypeMacro(vtkEventQtSlotConnect, vtkObject)
00065     
00066     
00067     void PrintSelf(ostream& os, vtkIndent indent);
00068     
00070 
00073     virtual void Connect(vtkObject* vtk_obj, unsigned long event, 
00074                          const QObject* qt_obj, const char* slot, 
00075                          void* client_data=NULL, float priority=0.0
00076                          ,Qt::ConnectionType type = Qt::AutoConnection);
00078     
00080 
00085     virtual void Disconnect(
00086       vtkObject* vtk_obj=NULL, unsigned long event=vtkCommand::NoEvent, 
00087       const QObject* qt_obj=NULL, const char* slot = 0, void* client_data=NULL);
00089 
00092     virtual int GetNumberOfConnections() const;
00093 
00094   protected:
00095     vtkQtConnections* Connections;
00096     friend class vtkQtConnection;
00097     void RemoveConnection(vtkQtConnection*);
00098   
00099     vtkEventQtSlotConnect();
00100     ~vtkEventQtSlotConnect();
00101 
00102   private:
00103     // unimplemented
00104     vtkEventQtSlotConnect(const vtkEventQtSlotConnect&);
00105     void operator=(const vtkEventQtSlotConnect&);
00106 };
00107 
00108 #endif
00109