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