00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _RM_MFC_UTILITIES_NUMERIC_EDIT_H_
00014 #define _RM_MFC_UTILITIES_NUMERIC_EDIT_H_
00015
00016 #include <MFCUtilities/RmMFCTypes.h>
00017
00018
00019 #define MIN_INT -32767
00020 #define MAX_INT 32767
00021 #define FLT_DEFAULT_MIN 1.175494351e-38f
00022 #define FLT_DEFAULT_MAX 3.402823466e+38f
00023
00024
00025 #define CTRL_DEFAULT_PRECISION 5
00026
00027
00028
00029
00030
00031 class RMMFCUTIL_API CRmNumericEdit: public CEdit
00032 {
00033
00034 public:
00035
00036
00037 CRmNumericEdit();
00038 virtual ~CRmNumericEdit() {};
00039
00040
00041
00042
00043 virtual void Init( float fValue = 0.00, int nPrecision = 2, bool bSigned = true );
00044
00045 void SetData( float fValue, int nPrecision, bool bSigned );
00046
00047 float GetNumericValue();
00048 void SetNumericValue( float fValue );
00049
00050
00051 void UpdateText();
00052
00053
00054 void UpdateValue();
00055
00056 void SetScientificDisplay( bool bSciDisplay )
00057 {
00058 m_bSciFormat = bSciDisplay;
00059 }
00060
00061 void SetNumericDisplayType( bool bInteger )
00062 {
00063 m_bInteger = bInteger;
00064 }
00065
00066 protected:
00067
00068 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00069 afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00070 afx_msg void OnSetFocus();
00071
00072 afx_msg void OnKillFocus(CWnd* pNewWnd);
00073
00074 DECLARE_MESSAGE_MAP()
00075
00076 protected:
00077
00078
00079 bool IsValidChar( UINT nChar );
00080
00081
00082 float TextToNumber( const RM_TCHAR *strText );
00083 RmStringT NumberToText( float fValue );
00084
00085
00086 protected:
00087
00088 float m_fValue;
00089 int m_nPrecision;
00090 bool m_bSigned;
00091 RmStringT m_strText;
00092
00093 bool m_bSciFormat;
00094 bool m_bInteger;
00095
00096 };
00097
00098
00099 #endif