IGSTK
igstkQTWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkQTWidget.h,v $
5  Language: C++
6  Date: $Date: 2008-02-11 01:41:51 $
7  Version: $Revision: 1.1 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __igstkQTWidget_h
19 #define __igstkQTWidget_h
20 
21 #ifdef _MSC_VER
22 #pragma warning ( disable : 4018 )
23 //Warning about: identifier was truncated to '255' characters in the debug
24 //information (MVC6.0 Debug)
25 #pragma warning( disable : 4284 )
26 #endif
27 
28 // QT dared to define macro called DEBUG!!
29 #define QT_NO_DEBUG 1
30 
31 // VTK declarations
32 class vtkRenderer;
33 class vtkRenderWindowInteractor;
34 
35 // ITK headers
36 #include "itkCommand.h"
37 #include "itkLogger.h"
38 
39 // IGSTK headers
40 #include "igstkMacros.h"
41 #include "igstkStateMachine.h"
42 #include "igstkView.h"
43 #include "igstkViewProxy.h"
44 
45 // VTK header
46 #include "QVTKWidget.h"
47 
48 namespace igstk {
49 
65 class QTWidget : public QVTKWidget
66 {
67 public:
68 
69  typedef QTWidget Self;
70  typedef QVTKWidget Superclass;
71  typedef View ViewType;
72 
73  igstkTypeMacro( QTWidget, QVTKWidget );
74 
77 
79  void Print( std::ostream& os, ::itk::Indent indent=0) const;
80 
83 
84 
85 #if QT_VERSION < 0x040000
86  QTWidget(QWidget* parent = NULL,
88  const char* name = NULL, Qt::WFlags f = 0);
89 #else
90  QTWidget(QWidget* parent = NULL, Qt::WFlags f = 0);
92 #endif
93 
95  virtual ~QTWidget( void );
96 
98  void RequestSetView( const ViewType * view );
99 
101 
102  friend class ViewProxy< QTWidget >;
103 
106 
109 
111  vtkRenderWindowInteractor * GetRenderWindowInteractor() const;
112 
113 protected:
114 
116  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
117 
120  void mouseReleaseEvent(QMouseEvent* e);
121 
124  void mouseMoveEvent(QMouseEvent* e);
125  void mousePressEvent(QMouseEvent* e);
126  void wheelEvent(QWheelEvent* e);
127 
128 
129 private:
131  void ReportInvalidRequestProcessing();
132 
134  void ReportInvalidViewConnectedProcessing();
135 
137  void ConnectViewProcessing();
138 
140  void DisableInteractionsProcessing();
141 
143  void EnableInteractionsProcessing();
144 
147  void SetRenderer( vtkRenderer * renderer );
148 
151  void SetRenderWindowInteractor( vtkRenderWindowInteractor * interactor );
152 
153 private:
154 
155  ViewType::Pointer m_View;
156  ProxyType m_ProxyView;
157  vtkRenderer * m_Renderer;
158  vtkRenderWindowInteractor * m_RenderWindowInteractor;
159  bool m_InteractionHandling;
160 
162  igstkDeclareStateMacro( Idle );
163  igstkDeclareStateMacro( ViewConnected );
164 
166  igstkDeclareInputMacro( ValidView );
167  igstkDeclareInputMacro( InValidView );
168  igstkDeclareInputMacro( EnableInteractions );
169  igstkDeclareInputMacro( DisableInteractions );
170 
171 };
172 
173 std::ostream& operator<<(std::ostream& os, const QTWidget& o);
174 
175 } // end namespace igstk
176 
177 #endif
#define igstkTypeMacro(thisClass, superclass)
Type Macro defines the GetNameOfClass() method for every class where it is invoked.
Definition: igstkMacros.h:128
#define igstkStateMachineMacro()
This is the StateMachine Macro to be used with non-templated classes.
Definition: igstkMacros.h:216
std::ostream & operator<<(std::ostream &os, const igstk::AffineTransform &o)
void mouseMoveEvent(QMouseEvent *e)
Override the mouse move event to send transform events when the mouse is moved while the left button ...
QVTKWidget Superclass
Definition: igstkQTWidget.h:70
void mouseReleaseEvent(QMouseEvent *e)
Override the method that manages mouse events in order to provide picker functionalities.
#define igstkDeclareInputMacro(inputname)
Convenience macro for declaring Inputs to the State Machine.
Definition: igstkMacros.h:223
defines standard system-wide macros, constants, and other common parameters in the IGSTK Library...
Display graphical representations of surgical scenes.
Definition: igstkView.h:73
::itk::SmartPointer< Self > Pointer
Definition: igstkObject.h:50
QTWidget(QWidget *parent=NULL, const char *name=NULL, Qt::WFlags f=0)
Constructor.
#define igstkDeclareStateMacro(inputname)
Convenience macro for declaring States of the State Machine.
Definition: igstkMacros.h:228
#define igstkLoggerMacro()
Macro that defines all the standard elements related to the Logger.
Definition: igstkMacros.h:143
void Print(std::ostream &os,::itk::Indent indent=0) const
Print the object information in a stream.
Display IGSTK graphical representation in a Qt Widget.
Definition: igstkQTWidget.h:65
vtkRenderWindowInteractor * GetRenderWindowInteractor() const
Get render window interactor.
void mousePressEvent(QMouseEvent *e)
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const
Print the object information in a stream.
void RequestDisableInteractions()
Disable user interactions with the window via mouse and keyboard.
void RequestEnableInteractions()
Enable user interactions with the window via mouse and keyboard.
virtual ~QTWidget(void)
Destructor.
ViewProxy< QTWidget > ProxyType
void wheelEvent(QWheelEvent *e)
void RequestSetView(const ViewType *view)
set the view