]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/BaseWidget.cxx
faebdcea696cd6850d0e6214afb929d0268eb7d7
[cpPlugins.git] / lib / cpPlugins / BaseWidget.cxx
1 #include <cpPlugins/BaseWidget.h>
2
3 // -------------------------------------------------------------------------
4 const cpPlugins::BaseWidget::TMPRWidget* cpPlugins::BaseWidget::
5 GetMPRViewer( ) const
6 {
7   return( this->m_MPRViewer );
8 }
9
10 // -------------------------------------------------------------------------
11 const vtkRenderWindowInteractor* cpPlugins::BaseWidget::
12 GetSingleInteractor( ) const
13 {
14   return( this->m_SingleInteractor );
15 }
16
17 // -------------------------------------------------------------------------
18 void cpPlugins::BaseWidget::
19 SetMPRViewer( cpPlugins::BaseWidget::TMPRWidget* v )
20 {
21   if( this->m_MPRViewer != v )
22   {
23     this->m_MPRViewer = v;
24     this->Modified( );
25
26   } // fi
27 }
28
29 // -------------------------------------------------------------------------
30 void cpPlugins::BaseWidget::
31 SetSingleInteractor( vtkRenderWindowInteractor* i )
32 {
33   if( this->m_SingleInteractor != i )
34   {
35     this->m_SingleInteractor = i;
36     this->Modified( );
37
38   } // fi
39 }
40
41 // -------------------------------------------------------------------------
42 bool cpPlugins::BaseWidget::
43 IsInteractive( )
44 {
45   return( true );
46 }
47
48 // -------------------------------------------------------------------------
49 void cpPlugins::BaseWidget::
50 SetInteractionObjects( const std::vector< void* >& objs )
51 {
52   if( objs.size( ) > 0 )
53   {
54     vtkRenderWindowInteractor* rwi =
55       reinterpret_cast< vtkRenderWindowInteractor* >( objs[ 0 ] );
56     this->SetSingleInteractor( rwi );
57   }
58   if( objs.size( ) > 1 )
59   {
60     TMPRWidget* wdg = reinterpret_cast< TMPRWidget* >( objs[ 1 ] );
61     this->SetMPRViewer( wdg );
62
63   } // fi
64 }
65
66 // -------------------------------------------------------------------------
67 cpPlugins::BaseWidget::
68 BaseWidget( )
69   : Superclass( ),
70     m_MPRViewer( NULL ),
71     m_SingleInteractor( NULL )
72 {
73 }
74
75 // -------------------------------------------------------------------------
76 cpPlugins::BaseWidget::
77 ~BaseWidget( )
78 {
79   // Warning: Qt's smartpointers require this to avoid segfaults
80   this->m_MPRViewer = NULL;
81   this->m_SingleInteractor = NULL;
82 }
83
84 // eof - $RCSfile$