IGSTK
igstkFLTKWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkFLTKWidget.h,v $
5  Language: C++
6  Date: $Date: 2008-02-11 01:41:50 $
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 #ifndef __igstkFLTKWidget_h
18 #define __igstkFLTKWidget_h
19 
20 #ifdef _MSC_VER
21 #pragma warning ( disable : 4018 )
22 //Warning about: identifier was truncated to '255' characters in the debug
23 //information (MVC6.0 Debug)
24 #pragma warning( disable : 4284 )
25 #endif
26 
27 class vtkRenderer;
28 class vtkRenderWindowInteractor;
29 
30 // FLTK headers
31 #include <FL/Fl.H>
32 #include <FL/Fl_Gl_Window.H>
33 
34 // IGSTK headers
35 #include "igstkView.h"
36 #include "igstkViewProxy.h"
37 
38 namespace igstk {
56 class FLTKWidget : public Fl_Gl_Window
57 {
58 
59 public:
60 
61  typedef FLTKWidget Self;
62  typedef Fl_Gl_Window Superclass;
63 
64  typedef View ViewType;
65 
66  igstkTypeMacro( FLTKWidget, Fl_Gl_Window );
67 
70 
72  void Print( std::ostream& os, ::itk::Indent indent=0) const;
73 
76 
77 
78  void RequestSetView( const ViewType * view );
79 
82 
85 
87  vtkRenderWindowInteractor * GetRenderWindowInteractor() const;
88 
90 
91  friend class ViewProxy< FLTKWidget >;
92 
93  FLTKWidget( int x, int y, int w, int h, const char *l="");
94  virtual ~FLTKWidget( void );
95 
96 protected:
97 
98  // Fl_Gl_Window overrides
99  void flush(void);
100  void draw( void );
101  void hide( void );
102  void resize( int x, int y, int w, int h );
103  virtual int handle( int event );
104 
105 private:
106 
108  void ReportInvalidRequestProcessing();
109 
111  void ReportInvalidViewConnectedProcessing();
112 
114  void ConnectViewProcessing();
115 
117  void DisableInteractionsProcessing();
118 
120  void EnableInteractionsProcessing();
121 
124  void SetRenderer( vtkRenderer * renderer );
125 
128  void SetRenderWindowInteractor( vtkRenderWindowInteractor * interactor );
129 
131  void SetRenderWindowID();
132 
133 private:
134 
135  bool m_InteractionHandling;
136 
137  ViewType::Pointer m_View;
138 
139  ProxyType m_ProxyView;
140 
141  vtkRenderer * m_Renderer;
142 
143  bool m_RenderWindowIDSet;
144 
145  vtkRenderWindowInteractor * m_RenderWindowInteractor;
146 
148  igstkDeclareStateMacro( Idle );
149  igstkDeclareStateMacro( ViewConnected );
150 
152  igstkDeclareInputMacro( ValidView );
153  igstkDeclareInputMacro( InValidView );
154  igstkDeclareInputMacro( EnableInteractions );
155  igstkDeclareInputMacro( DisableInteractions );
156 
157 
158 };
159 
160 std::ostream& operator<<(std::ostream& os, const FLTKWidget& o);
161 
162 } // end namespace igstk
163 
164 #endif