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 00019 #include "mitkEvent.h" 00020 00021 mitk::Event::Event(mitk::BaseRenderer* sender, int type, int button, 00022 int buttonState, int key) 00023 : m_Sender( sender ), m_Type( type ), m_Button( button ), m_ButtonState( buttonState ), 00024 m_Key( key ) 00025 { 00026 } 00027 00028 mitk::Event::~Event() 00029 { 00030 } 00031 00032 mitk::BaseRenderer* mitk::Event::GetSender() const 00033 { 00034 return m_Sender; 00035 } 00036 00037 int mitk::Event::GetType() const 00038 { 00039 return m_Type; 00040 } 00041 00042 int mitk::Event::GetButtonState() const 00043 { 00044 return m_ButtonState; 00045 } 00046 00047 int mitk::Event::GetButton() const 00048 { 00049 return m_Button; 00050 } 00051 00052 00053 int mitk::Event::GetKey() const 00054 { 00055 return m_Key; 00056 } 00057 00058 bool mitk::Event::operator==(const Event& event) const 00059 { 00060 const mitk::Event *input = dynamic_cast<const mitk::Event*>(&event); 00061 if(input==NULL) return false; 00062 00063 if ( (m_Type == event.GetType()) 00064 && (m_Button == event.GetButton()) 00065 && (m_ButtonState == event.GetButtonState()) 00066 && (m_Key == event.GetKey()) ) 00067 { 00068 return true; 00069 } 00070 else 00071 { 00072 return false; 00073 } 00074 }