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 http://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 #ifndef QMITK_NUMBERPROPERTYVIEW_H_INCLUDED 00018 #define QMITK_NUMBERPROPERTYVIEW_H_INCLUDED 00019 00020 #include <mitkPropertyObserver.h> 00021 #include "QmitkExtExports.h" 00022 #include <mitkProperties.h> 00023 #include <QLabel> 00024 00026 class QmitkExt_EXPORT QmitkNumberPropertyView : public QLabel, public mitk::PropertyView 00027 { 00028 Q_OBJECT 00029 Q_PROPERTY( short decimalPlaces READ decimalPlaces WRITE setDecimalPlaces ) 00030 Q_PROPERTY( QString suffix READ suffix WRITE setSuffix ) 00031 Q_PROPERTY( bool showPercent READ showPercent WRITE setShowPercent ) 00032 00033 public: 00034 00035 //QmitkNumberPropertyView( const mitk::GenericProperty<short>*, QWidget* parent, const char* name = 0 ); 00036 QmitkNumberPropertyView( const mitk::IntProperty*, QWidget* parent ); 00037 QmitkNumberPropertyView( const mitk::FloatProperty*, QWidget* parent ); 00038 QmitkNumberPropertyView( const mitk::DoubleProperty*, QWidget* parent ); 00039 00040 virtual ~QmitkNumberPropertyView(); 00041 00042 short decimalPlaces() const; 00043 void setDecimalPlaces(short); 00044 00045 QString suffix() const; 00046 void setSuffix(const QString&); 00047 00048 bool showPercent() const; 00049 void setShowPercent(bool); 00050 00051 protected: 00052 00053 void initialize(); 00054 00055 virtual void PropertyChanged(); 00056 virtual void PropertyRemoved(); 00057 00058 void DisplayNumber(); 00059 00060 union { 00061 //const mitk::GenericProperty<short>* m_ShortProperty; 00062 const mitk::GenericProperty<int>* m_IntProperty; 00063 const mitk::GenericProperty<float>* m_FloatProperty; 00064 const mitk::GenericProperty<double>* m_DoubleProperty; 00065 }; 00066 00067 const int m_DataType; 00068 00069 short m_DecimalPlaces; 00070 QString m_Suffix; 00071 double m_DisplayFactor; 00072 00073 //QString m_FormatString; 00074 00075 private: 00076 00077 }; 00078 00079 #endif 00080