home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c031 / 10.ddi / MFC / INCLUDE / AFXPEN.H$ / afxpen
Encoding:
Text File  |  1992-03-19  |  4.8 KB  |  152 lines

  1. // Microsoft Foundation Classes C++ library. 
  2. // Copyright (C) 1992 Microsoft Corporation, 
  3. // All rights reserved. 
  4.  
  5. // This source code is only intended as a supplement to the 
  6. // Microsoft Foundation Classes Reference and Microsoft 
  7. // QuickHelp documentation provided with the library. 
  8. // See these sources for detailed information regarding the 
  9. // Microsoft Foundation Classes product. 
  10.  
  11.  
  12. #ifndef __AFXPEN_H__
  13. #define __AFXPEN_H__
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // Classes declared in this file
  17.  
  18.     //CEdit
  19.         class CHEdit;           // Handwriting Edit control
  20.             class CBEdit;       // Boxed Handwriting Edit control
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // Make sure 'afxwin.h' is included first
  24.  
  25. #ifndef __AFXWIN_H__
  26. #include "afxwin.h"
  27. #endif
  28.  
  29. #include "penwin.h"
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CHEdit - Handwriting Edit control
  33.  
  34. class CHEdit : public CEdit
  35. {
  36.     DECLARE_DYNAMIC(CHEdit)
  37.  
  38. // Constructors
  39. public:
  40.     CHEdit();
  41.     BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  42.  
  43. // Attributes
  44.     // inflation between client area and writing window
  45.     BOOL GetInflate(LPRECTOFS lpRectOfs);
  46.     BOOL SetInflate(LPRECTOFS lpRectOfs);
  47.  
  48.     // Recognition context (lots of options here)
  49.     BOOL GetRC(LPRC lpRC);
  50.     BOOL SetRC(LPRC lpRC);
  51.  
  52.     // Underline mode (HEdit only)
  53.     BOOL GetUnderline();
  54.     BOOL SetUnderline(BOOL bUnderline = TRUE);
  55.  
  56. // Operations
  57.     HANDLE GetInkHandle();
  58.     BOOL SetInkMode(HPENDATA hPenDataInitial = NULL);       // start inking
  59.     BOOL StopInkMode(UINT hep);
  60.  
  61. // Implementation
  62. protected:
  63.     virtual WNDPROC* GetSuperWndProcAddr();
  64. };
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CBEdit - Boxed Handwriting Edit control
  68.  
  69. class CBEdit : public CHEdit
  70. {
  71.     DECLARE_DYNAMIC(CBEdit)
  72.  
  73. // Constructors
  74. public:
  75.     CBEdit();
  76.     BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  77.  
  78. // Attributes
  79.     // converting from logical to byte positions
  80.     DWORD CharOffset(UINT nCharPosition);       // logical -> byte
  81.     DWORD CharPosition(UINT nCharOffset);       // byte -> logical
  82.  
  83.     // BOXLAYOUT info
  84.     void GetBoxLayout(LPBOXLAYOUT lpBoxLayout);
  85.     BOOL SetBoxLayout(LPBOXLAYOUT lpBoxLayout);
  86.     
  87. // Operations
  88.     void DefaultFont(BOOL bRepaint);            // set default font
  89.  
  90. // Implementation
  91. private:
  92.     BOOL GetUnderline();            // disabled in HBEdit
  93.     BOOL SetUnderline(BOOL bUnderline); // disabled in HBEdit
  94. protected:
  95.     virtual WNDPROC* GetSuperWndProcAddr();
  96. };
  97.  
  98. /////////////////////////////////////////////////////////////////////////////
  99. // Inlines
  100.  
  101. inline CHEdit::CHEdit()
  102.     { }
  103. inline BOOL CHEdit::GetInflate(LPRECTOFS lpRectOfs)
  104.     { return (BOOL)::SendMessage(m_hWnd, WM_HEDITCTL,
  105.         HE_GETINFLATE, (LPARAM)lpRectOfs); }
  106. inline HANDLE CHEdit::GetInkHandle()
  107.     { return (HANDLE)::SendMessage(m_hWnd, WM_HEDITCTL, 
  108.         HE_GETINKHANDLE, 0); }
  109. inline BOOL CHEdit::GetRC(LPRC lpRC)
  110.     { return (BOOL)::SendMessage(m_hWnd, WM_HEDITCTL,
  111.         HE_GETRC, (LPARAM)lpRC); }
  112. inline BOOL CHEdit::GetUnderline()
  113.     { return (BOOL)::SendMessage(m_hWnd, WM_HEDITCTL,
  114.         HE_GETUNDERLINE, 0); }
  115. inline BOOL CHEdit::SetInflate(LPRECTOFS lpRectOfs)
  116.     { return (BOOL)::SendMessage(m_hWnd, WM_HEDITCTL,
  117.         HE_SETINFLATE, (LPARAM)lpRectOfs); }
  118. inline BOOL CHEdit::SetInkMode(HPENDATA hPenDataInitial)
  119.     { return (BOOL)::SendMessage(m_hWnd, WM_HEDITCTL,
  120.         HE_SETINKMODE, MAKELONG(hPenDataInitial, 0)); }
  121. inline BOOL CHEdit::SetRC(LPRC lpRC)
  122.     { return (BOOL)::SendMessage(m_hWnd, WM_HEDITCTL,
  123.         HE_SETRC, (LPARAM)lpRC); }
  124. inline BOOL CHEdit::SetUnderline(BOOL bUnderline)
  125.     { return (BOOL)::SendMessage(m_hWnd, WM_HEDITCTL,
  126.         HE_SETUNDERLINE, MAKELONG(bUnderline, 0)); }
  127. inline BOOL CHEdit::StopInkMode(UINT hep)
  128.     { return (BOOL)::SendMessage(m_hWnd, WM_HEDITCTL,
  129.         HE_STOPINKMODE, MAKELONG(hep, 0)); }
  130.  
  131. inline CBEdit::CBEdit()
  132.     { }
  133. inline DWORD CBEdit::CharOffset(UINT nCharPosition)
  134.     { return (DWORD)::SendMessage(m_hWnd, WM_HEDITCTL,
  135.         HE_CHAROFFSET, MAKELONG(nCharPosition, 0)); }
  136. inline DWORD CBEdit::CharPosition(UINT nCharOffset)
  137.     { return (DWORD)::SendMessage(m_hWnd, WM_HEDITCTL,
  138.         HE_CHARPOSITION, MAKELONG(nCharOffset, 0)); }
  139. inline void CBEdit::GetBoxLayout(LPBOXLAYOUT lpBoxLayout)
  140.     { ::SendMessage(m_hWnd, WM_HEDITCTL,
  141.         HE_GETBOXLAYOUT, (LPARAM)lpBoxLayout); }
  142. inline void CBEdit::DefaultFont(BOOL bRepaint)
  143.     { ::SendMessage(m_hWnd, WM_HEDITCTL,
  144.         HE_DEFAULTFONT, MAKELONG(bRepaint, 0)); }
  145. inline BOOL CBEdit::SetBoxLayout(LPBOXLAYOUT lpBoxLayout)
  146.     { return (BOOL)::SendMessage(m_hWnd, WM_HEDITCTL,
  147.         HE_SETBOXLAYOUT, (LPARAM)lpBoxLayout); }
  148.  
  149. //////////////////////////////////////////////////////////////////////////////
  150.  
  151. #endif //__AFXPEN_H__
  152.