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 #ifndef QMITKSLIDERLEVELWINDOW_WIDGET 00019 #define QMITKSLIDERLEVELWINDOW_WIDGET 00020 00021 #include <QWidget> 00022 #include <mitkLevelWindowManager.h> 00023 00024 class QmitkLevelWindowWidgetContextMenu; 00025 00068 class QMITK_EXPORT QmitkSliderLevelWindowWidget : public QWidget { 00069 00070 Q_OBJECT 00071 00072 public: 00073 00075 QmitkSliderLevelWindowWidget( QWidget * parent=0, Qt::WindowFlags f = 0 ); 00076 00078 ~QmitkSliderLevelWindowWidget(); 00079 00084 mitk::LevelWindow m_LevelWindow; 00085 00087 mitk::LevelWindowManager::Pointer m_Manager; 00088 00090 void setLevelWindowManager(mitk::LevelWindowManager* levelWindowManager); 00091 00093 void setDataStorage(mitk::DataStorage* ds); 00094 00096 mitk::LevelWindowManager* GetManager(); 00097 00098 private: 00099 00101 void contextMenuEvent ( QContextMenuEvent * ); 00102 00104 void OnPropertyModified(const itk::EventObject& e); 00105 00106 protected: 00108 virtual void update( ); 00109 00113 QRect m_Rect; 00114 00118 QPoint m_StartPos; 00119 00120 bool m_Resize; 00121 bool m_Bottom; 00122 bool m_MouseDown; 00123 bool m_Leftbutton; 00124 bool m_CtrlPressed; 00125 int m_MoveHeight; 00126 bool m_ScaleVisible; 00127 QRect m_LowerBound; 00128 QRect m_UpperBound; 00129 unsigned long m_ObserverTag; 00130 bool m_IsObserverTagSet; 00131 00132 QFont m_Font; 00133 00137 QmitkLevelWindowWidgetContextMenu* m_Contextmenu; 00138 00142 void paintEvent( QPaintEvent* e ); 00143 00151 void mouseMoveEvent( QMouseEvent* mouseEvent ); 00152 00153 void enterEvent ( QEvent * event ); 00154 00162 void mousePressEvent( QMouseEvent* mouseEvent ); 00163 00167 void mouseReleaseEvent( QMouseEvent* mouseEvent ); 00168 00172 void virtual resizeEvent ( QResizeEvent * event ); 00173 00174 protected slots: 00175 00177 void hideScale(); 00178 00180 void showScale(); 00181 }; 00182 #endif //QMITKSLIDERLEVELWINDOW_WIDGET