home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / general / ctrltest / paredit.h < prev    next >
C/C++ Source or Header  |  1998-03-26  |  2KB  |  67 lines

  1. // paredit.h: C++ derived edit control for numbers/letters etc
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CParsedEdit is a specialized CEdit control that only allows characters
  16. //  of a given type.
  17. // This class is used in 3 different ways in the samples
  18.  
  19. class CParsedEdit : public CEdit
  20. {
  21. protected:
  22.     WORD    m_wParseStyle;      // C++ member data
  23. public:
  24. // Construction
  25.     CParsedEdit();
  26.  
  27.     // explicit construction (see DERTEST.CPP)
  28.     BOOL Create(DWORD dwStyle /* includes PES_ style*/, const RECT& rect,
  29.         CWnd* pParentWnd, UINT nID);
  30.  
  31.     // subclassed construction (see SUBTEST.CPP)
  32.     BOOL SubclassEdit(UINT nID, CWnd* pParent, WORD wParseStyle);
  33.  
  34.     // for WNDCLASS Registered window
  35.     static BOOL RegisterControlClass();
  36.  
  37. // Overridables
  38.     virtual void OnBadInput();
  39.  
  40. // Implementation
  41. protected:
  42.     //{{AFX_MSG(CParsedEdit)
  43.     afx_msg void OnChar(UINT, UINT, UINT); // for character validation
  44.     afx_msg void OnVScroll(UINT, UINT, CScrollBar*); // for spin buttons
  45.     //}}AFX_MSG
  46.  
  47.     DECLARE_MESSAGE_MAP()
  48. };
  49.  
  50. /////////////////////////////////
  51. // Parsed edit control sub-styles
  52.  
  53. #define PES_NUMBERS         0x0001
  54. #define PES_LETTERS         0x0002
  55. #define PES_OTHERCHARS      0x0004
  56. #define PES_ALL             0xFFFF
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59. // Extra control notifications
  60.  
  61. // above the range for normal EN_ messages
  62. #define PEN_ILLEGALCHAR     0x8000
  63.             // sent to parent when illegal character hit
  64.             // return 0 if you want parsed edit to beep
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67.