home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK11 / MFC / SAMPLES / CTRLTEST / PAREDIT.H$ / paredit
Encoding:
Text File  |  1992-03-16  |  2.1 KB  |  71 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 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 Microsoft
  9. // QuickHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #ifndef RC_INVOKED
  14. #ifndef __AFXWIN_H__
  15. #include <afxwin.h>
  16. #endif
  17. #endif
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CParsedEdit is a specialized CEdit control that only allows characters
  21. //  of a given type.
  22. // This class is used in 3 different ways in the samples
  23.  
  24. // Parsed edit control sub-styles
  25. #define PES_NUMBERS         0x0001
  26. #define PES_LETTERS         0x0002
  27. #define PES_OTHERCHARS      0x0004
  28. #define PES_ALL             0xFFFF
  29.  
  30. class CParsedEdit : public CEdit
  31. {
  32. protected:
  33.     WORD    m_wParseStyle;      // C++ member data
  34. public:
  35. // Construction
  36.     CParsedEdit();
  37.  
  38.     // explicit construction (see DERTEST.CPP)
  39.     BOOL Create(DWORD dwStyle /* includes PES_ style*/, const RECT& rect,
  40.         CWnd* pParentWnd, UINT nID);
  41.  
  42.     // subclassed construction (see SUBTEST.CPP)
  43.     BOOL SubclassEdit(UINT nID, CWnd* pParent, WORD wParseStyle);
  44.  
  45.     // for WNDCLASS Registered window
  46.     static BOOL RegisterControlClass();
  47.  
  48. // Overridables
  49.     virtual void OnBadInput();
  50.  
  51. // Implementation
  52. protected:
  53.     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  54.                     // for character validation
  55.     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  56.                     // for associated spin buttons
  57.  
  58.     DECLARE_MESSAGE_MAP()
  59. };
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62. // Extra control notifications
  63.  
  64. // above the range for normal EN_ messages
  65. #define PEN_ILLEGALCHAR     0x8000
  66.             // sent to parent when illegal character hit
  67.             // return 0 if you want parsed edit to beep
  68.  
  69. /////////////////////////////////////////////////////////////////////////////
  70.  
  71.