00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CFL_CONTROLREALEDIT_H
00016 #define CFL_CONTROLREALEDIT_H
00017
00018 #if _MSC_VER > 1000
00019 #pragma once
00020 #endif // _MSC_VER > 1000
00021
00022 #include <cfl/ControlFilterEdit.h>
00023
00024
00025
00026
00027
00028
00029
00030
00031 DECLARE_CLASS( CRealEdit );
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 class CRealEdit : public CFilterEdit
00044 {
00045 DECLARE_DYNAMIC( CRealEdit )
00046
00047 typedef CRealEdit self;
00048
00049 public:
00050 typedef double real;
00051
00052
00053
00054
00055
00056 virtual ~CRealEdit();
00057 CRealEdit ( bool bSigned = true );
00058
00059
00060
00061
00062
00063 operator real () const;
00064
00065 self& operator= ( real value );
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 real GetValue() const;
00076
00077
00078
00079
00080
00081 void SetValue ( real value );
00082
00083 void SetSigned( bool bSigned = true );
00084 void SetFormat( const char* fmt = "%g" );
00085
00086
00087
00088 protected:
00089 virtual bool Check( const CString &csText ) ;
00090 virtual bool Match( const CString &csText ) ;
00091
00092 private:
00093 bool m_bSigned;
00094 CString m_csFormat;
00095 };
00096
00097
00098
00099
00100
00101
00102
00103 inline CRealEdit::~CRealEdit()
00104 {
00105 ;
00106 }
00107
00108
00109
00110
00111
00112 inline CRealEdit::CRealEdit ( bool bSigned ) :
00113 CFilterEdit(), m_bSigned( bSigned ), m_csFormat( "%g" )
00114 {
00115 ;
00116 }
00117
00118
00119
00120
00121
00122 inline CRealEdit::operator CRealEdit::real() const
00123 {
00124 return GetValue();
00125 }
00126
00127
00128
00129
00130
00131 inline CRealEdit::self& CRealEdit::operator= ( real value )
00132 {
00133 SetValue( value );
00134 return *this;
00135 }
00136
00137
00138
00139
00140
00141 inline CRealEdit::real CRealEdit::GetValue() const
00142 {
00143 return _tcstod( c_str_ptr( *this ), NULL );
00144 }
00145
00146
00147
00148
00149
00150 inline void CRealEdit::SetValue( real value )
00151 {
00152 CString txt;
00153 txt.Format( m_csFormat, value );
00154 SetWindowText ( txt );
00155 }
00156
00157
00158
00159
00160
00161 inline void CRealEdit::SetSigned ( bool bSigned )
00162 {
00163 m_bSigned = bSigned;
00164 }
00165
00166
00167
00168
00169
00170 inline void CRealEdit::SetFormat( const char* format )
00171 {
00172 m_csFormat = format;
00173 }
00174
00175 #endif // CFL_CONTROLREALEDIT_H
00176
00177
00178
00179