acuiEdit.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef _acuiEdit_h
  11. #define _acuiEdit_h
  12. #pragma pack (push, 8)
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16. /////////////////////////////////////////////////////////////////////////////
  17. // data styles
  18. #define AC_ES_STRING 0x01
  19. #define AC_ES_SYMBOL 0x02
  20. #define AC_ES_NUMERIC 0x04
  21. #define AC_ES_ANGLE 0x08
  22. // behavior styles
  23. #define AC_ES_VAL_ONKILLFOCUS 0x10
  24. #define AC_ES_CONV_ONKILLFOCUS 0x20
  25. #define AC_ES_SHOW_ERRMSG 0x40
  26. #define AC_ES_ERRMSG_ALLOWIGNORE 0x80
  27. // validation styles
  28. #define AC_ES_NOZERO 0x100
  29. #define AC_ES_NOBLANK 0x200
  30. #define AC_ES_NONEGATIVE 0x400
  31. #define AC_ES_INRANGE 0x800
  32. typedef enum {
  33. kAcUiError_None, // No error; OK.
  34. kAcUiError_Blank, // Data is blank
  35. kAcUiError_Symbol, // Detected illegal symbol syntax
  36. kAcUiError_Numeric, // Detected non-numeric data
  37. kAcUiError_Angle, // Data does not represent an angle
  38. kAcUiError_Zero, // Data is zero
  39. kAcUiError_Negative, // Data is negative
  40. kAcUiError_Range // Data is out of range
  41. } ACUI_ERROR_CODE;
  42. ////////////////////////////////////////////////////////////////////////////
  43. // CAcUiEdit window
  44. class ACUI_PORT CAcUiEdit : public CAdUiEdit {
  45. DECLARE_DYNAMIC(CAcUiEdit)
  46. public:
  47. CAcUiEdit ();
  48. virtual ~CAcUiEdit ();
  49. private:
  50. BOOL m_bWantsFocus;
  51. BOOL m_bWasValid;
  52. protected:
  53. virtual ADUI_REPLY DoAdUiMessage (
  54. ADUI_NOTIFY notifyCode, UINT controlId, LPARAM lParam
  55. );
  56. // Validation style
  57. public:
  58. virtual void SetStyleMask (DWORD mask);
  59. // Validation
  60. private:
  61. void DisplayError (UINT); // display error dialog box
  62. public:
  63. BOOL m_bChanged; // value changed flag
  64. double m_dMinValue; // min value for range checking
  65. double m_dMaxValue; // max value for range checking
  66. CString m_csMsg; // generic message string
  67. BOOL m_bTouch; // flag to detect changes in text
  68. void Convert (); // data style conversion
  69. BOOL ConvertData (CString& x);
  70. BOOL HasChanged (); // detect user changes
  71. void SetDirty ();
  72. void SetRange (double vMin, double vMax);
  73. BOOL Validate (); // data validation
  74. ACUI_ERROR_CODE ValidateData (CString& x);
  75. // ClassWizard-controlled
  76. public:
  77. //{{AFX_VIRTUAL(CAcUiEdit)
  78. //}}AFX_VIRTUAL
  79. protected:
  80. //{{AFX_MSG(CAcUiEdit)
  81. afx_msg BOOL OnChange();
  82. afx_msg void OnErrSpace();
  83. afx_msg void OnKillFocus(CWnd* pNewWnd);
  84. //}}AFX_MSG
  85. DECLARE_MESSAGE_MAP()
  86. };
  87. /////////////////////////////////////////////////////////////////////////////
  88. // CAcUiAngleEdit class
  89. class ACUI_PORT CAcUiAngleEdit : public CAcUiEdit {
  90. DECLARE_DYNAMIC(CAcUiAngleEdit)
  91. public:
  92. CAcUiAngleEdit ();
  93. virtual ~CAcUiAngleEdit ();
  94. // Validation style
  95. public:
  96. virtual void SetStyleMask (DWORD mask);
  97. // ClassWizard-controlled
  98. public:
  99. //{{AFX_VIRTUAL(CAcUiAngleEdit)
  100. //}}AFX_VIRTUAL
  101. protected:
  102. //{{AFX_MSG(CAcUiAngleEdit)
  103. //}}AFX_MSG
  104. DECLARE_MESSAGE_MAP()
  105. };
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CAcUiNumericEdit class
  108. class ACUI_PORT CAcUiNumericEdit : public CAcUiEdit {
  109. DECLARE_DYNAMIC(CAcUiNumericEdit)
  110. public:
  111. CAcUiNumericEdit ();
  112. virtual ~CAcUiNumericEdit ();
  113. // Validation style
  114. public:
  115. virtual void SetStyleMask (DWORD mask);
  116. // ClassWizard-controlled
  117. public:
  118. //{{AFX_VIRTUAL(CAcUiNumericEdit)
  119. //}}AFX_VIRTUAL
  120. protected:
  121. //{{AFX_MSG(CAcUiNumericEdit)
  122. //}}AFX_MSG
  123. DECLARE_MESSAGE_MAP()
  124. };
  125. /////////////////////////////////////////////////////////////////////////////
  126. // CAcUiStringEdit class
  127. class ACUI_PORT CAcUiStringEdit : public CAcUiEdit {
  128. DECLARE_DYNAMIC(CAcUiStringEdit)
  129. public:
  130. CAcUiStringEdit ();
  131. virtual ~CAcUiStringEdit ();
  132. // Validation style
  133. public:
  134. virtual void SetStyleMask (DWORD mask);
  135. // ClassWizard-controlled
  136. public:
  137. //{{AFX_VIRTUAL(CAcUiStringEdit)
  138. //}}AFX_VIRTUAL
  139. protected:
  140. //{{AFX_MSG(CAcUiStringEdit)
  141. //}}AFX_MSG
  142. DECLARE_MESSAGE_MAP()
  143. };
  144. /////////////////////////////////////////////////////////////////////////////
  145. // CAcUiSymbolEdit class
  146. class ACUI_PORT CAcUiSymbolEdit : public CAcUiEdit {
  147. DECLARE_DYNAMIC(CAcUiSymbolEdit)
  148. public:
  149. CAcUiSymbolEdit ();
  150. virtual ~CAcUiSymbolEdit ();
  151. // Validation style
  152. public:
  153. virtual void SetStyleMask (DWORD mask);
  154. // ClassWizard-controlled
  155. public:
  156. //{{AFX_VIRTUAL(CAcUiSymbolEdit)
  157. //}}AFX_VIRTUAL
  158. protected:
  159. //{{AFX_MSG(CAcUiSymbolEdit)
  160. //}}AFX_MSG
  161. DECLARE_MESSAGE_MAP()
  162. };
  163. /////////////////////////////////////////////////////////////////////////////
  164. //{{AFX_INSERT_LOCATION}}
  165. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  166. #pragma pack (pop)
  167. #endif
  168. /////////////////////////////////////////////////////////////////////////////