00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __igstkFLTKWidget_h
00018 #define __igstkFLTKWidget_h
00019
00020 #ifdef _MSC_VER
00021 #pragma warning ( disable : 4018 )
00022
00023
00024 #pragma warning( disable : 4284 )
00025 #endif
00026
00027 class vtkRenderer;
00028 class vtkRenderWindowInteractor;
00029
00030
00031 #include <FL/Fl.H>
00032 #include <FL/Fl_Gl_Window.H>
00033
00034
00035 #include "igstkView.h"
00036 #include "igstkViewProxy.h"
00037
00038 namespace igstk {
00056 class FLTKWidget : public Fl_Gl_Window
00057 {
00058
00059 public:
00060
00061 typedef FLTKWidget Self;
00062 typedef Fl_Gl_Window Superclass;
00063
00064 typedef View ViewType;
00065
00066 igstkTypeMacro( FLTKWidget, Fl_Gl_Window );
00067
00069 igstkStateMachineMacro();
00070
00072 void Print( std::ostream& os, ::itk::Indent indent=0) const;
00073
00075 igstkLoggerMacro()
00076
00077
00078 void RequestSetView( const ViewType * view );
00079
00081 void RequestDisableInteractions();
00082
00084 void RequestEnableInteractions();
00085
00087 vtkRenderWindowInteractor * GetRenderWindowInteractor() const;
00088
00089 typedef ViewProxy< FLTKWidget > ProxyType;
00090
00091 friend class ViewProxy< FLTKWidget >;
00092
00093 FLTKWidget( int x, int y, int w, int h, const char *l="");
00094 virtual ~FLTKWidget( void );
00095
00096 protected:
00097
00098
00099 void flush(void);
00100 void draw( void );
00101 void hide( void );
00102 void resize( int x, int y, int w, int h );
00103 virtual int handle( int event );
00104
00105 private:
00106
00108 void ReportInvalidRequestProcessing();
00109
00111 void ReportInvalidViewConnectedProcessing();
00112
00114 void ConnectViewProcessing();
00115
00117 void DisableInteractionsProcessing();
00118
00120 void EnableInteractionsProcessing();
00121
00124 void SetRenderer( vtkRenderer * renderer );
00125
00128 void SetRenderWindowInteractor( vtkRenderWindowInteractor * interactor );
00129
00131 void SetRenderWindowID();
00132
00133 private:
00134
00135 bool m_InteractionHandling;
00136
00137 ViewType::Pointer m_View;
00138
00139 ProxyType m_ProxyView;
00140
00141 vtkRenderer * m_Renderer;
00142
00143 bool m_RenderWindowIDSet;
00144
00145 vtkRenderWindowInteractor * m_RenderWindowInteractor;
00146
00148 igstkDeclareStateMacro( Idle );
00149 igstkDeclareStateMacro( ViewConnected );
00150
00152 igstkDeclareInputMacro( ValidView );
00153 igstkDeclareInputMacro( InValidView );
00154 igstkDeclareInputMacro( EnableInteractions );
00155 igstkDeclareInputMacro( DisableInteractions );
00156
00157
00158 };
00159
00160 std::ostream& operator<<(std::ostream& os, const FLTKWidget& o);
00161
00162 }
00163
00164 #endif