00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include <mitkSlicesCoordinator.h> 00019 00020 #include <mitkApplicationCursor.h> 00021 00022 00023 namespace mitk { 00024 00025 00026 SlicesCoordinator::SlicesCoordinator(const char* machine) 00027 : StateMachine(machine), 00028 m_LinkPlanes( true ), 00029 m_MouseCursorSet( false ) 00030 { 00031 } 00032 00033 SlicesCoordinator::~SlicesCoordinator() 00034 { 00035 } 00036 00037 void SlicesCoordinator::AddSliceController(SliceNavigationController* snc) 00038 { 00039 if (!snc) return; 00040 00041 m_SliceNavigationControllers.push_back(snc); 00042 00043 OnSliceControllerAdded(snc); // notify 00044 } 00045 00046 void SlicesCoordinator::RemoveSliceController(SliceNavigationController* snc) 00047 { 00048 if (!snc) return; 00049 00050 // see, whether snc is in our list 00051 SNCVector::iterator iter; 00052 for (iter = m_SliceNavigationControllers.begin(); iter != m_SliceNavigationControllers.end(); ++iter) 00053 if (*iter == snc) break; 00054 00055 // if found, remove from list 00056 if ( iter != m_SliceNavigationControllers.end() ) 00057 { 00058 m_SliceNavigationControllers.erase( iter ); 00059 00060 OnSliceControllerRemoved(snc); 00061 } 00062 } 00063 00064 void SlicesCoordinator::ResetMouseCursor() 00065 { 00066 if ( m_MouseCursorSet ) 00067 { 00068 ApplicationCursor::GetInstance()->PopCursor(); 00069 m_MouseCursorSet = false; 00070 } 00071 } 00072 00073 void SlicesCoordinator::SetMouseCursor( const char *xpm[], int hotspotX, int hotspotY ) 00074 { 00075 // Remove previously set mouse cursor 00076 if ( m_MouseCursorSet ) 00077 { 00078 ApplicationCursor::GetInstance()->PopCursor(); 00079 } 00080 00081 ApplicationCursor::GetInstance()->PushCursor( xpm, hotspotX, hotspotY ); 00082 m_MouseCursorSet = true; 00083 } 00084 00085 00086 void SlicesCoordinator::OnSliceControllerAdded(SliceNavigationController*) 00087 { 00088 // implement in subclasses 00089 } 00090 00091 void SlicesCoordinator::OnSliceControllerRemoved(SliceNavigationController*) 00092 { 00093 // implement in subclasses 00094 } 00095 00096 bool SlicesCoordinator::ExecuteAction(Action*, StateEvent const*) 00097 { 00098 // implement in subclasses 00099 return false; 00100 } 00101 00102 } // namespace 00103