ExtPopupRichEditCtrl.h
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:5k
源码类别:

界面编程

开发平台:

Visual C++

  1. #if !defined(AFX_EXTPOPUPRICHEDITCTRL_H__B8A07E35_D826_4976_8BD0_088A56DA42D1__INCLUDED_)
  2. #define AFX_EXTPOPUPRICHEDITCTRL_H__B8A07E35_D826_4976_8BD0_088A56DA42D1__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // ExtPopupRichEditCtrl.h : header file
  7. //
  8. #include <afxrich.h>
  9. class CExtDynamicRichEditView;
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CExtDynamicRichEditDoc
  12. class CExtDynamicRichEditDoc : public CRichEditDoc
  13. {
  14. friend class CExtDynamicRichEditView;
  15. protected:
  16. class CExtDynamicRichEditCntrItem : public CRichEditCntrItem
  17. {
  18. public:
  19. CExtDynamicRichEditCntrItem(
  20. REOBJECT * preo = NULL,
  21. CExtDynamicRichEditDoc * pContainer = NULL
  22. );
  23. ~CExtDynamicRichEditCntrItem();
  24. CExtDynamicRichEditDoc * GetDocument()
  25. {
  26. ASSERT_VALID( this );
  27. return
  28. ( (CExtDynamicRichEditDoc*) CRichEditCntrItem::GetDocument() );
  29. }
  30. CExtDynamicRichEditView * GetActiveView()
  31. {
  32. ASSERT_VALID( this );
  33. return
  34. ( (CExtDynamicRichEditView*) CRichEditCntrItem::GetActiveView() );
  35. }
  36. };
  37. public:
  38. DECLARE_DYNCREATE( CExtDynamicRichEditDoc );
  39. CExtDynamicRichEditDoc();
  40. // Attributes
  41. public:
  42. // Operations
  43. public:
  44. // Overrides
  45. //{{AFX_VIRTUAL(CExtDynamicRichEditDoc)
  46. public:
  47. virtual BOOL OnNewDocument();
  48. virtual BOOL CanCloseFrame(CFrameWnd* pFrame);
  49. protected:
  50. virtual BOOL SaveModified();
  51. //}}AFX_VIRTUAL
  52. virtual void OnIdle();
  53. virtual CRichEditCntrItem * CreateClientItem(
  54. REOBJECT * preo
  55. ) const;
  56. // Implementation
  57. public:
  58. virtual ~CExtDynamicRichEditDoc();
  59. protected:
  60. // Generated message map functions
  61. protected:
  62. //{{AFX_MSG(CExtDynamicRichEditDoc)
  63. //}}AFX_MSG
  64. DECLARE_MESSAGE_MAP()
  65. };
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CExtDynamicRichEditView window
  68. class CExtDynamicRichEditView : public CRichEditView
  69. {
  70. friend class CExtDynamicRichEditDoc;
  71. public:
  72. DECLARE_DYNCREATE( CExtDynamicRichEditView );
  73. CExtDynamicRichEditView();
  74. // Attributes
  75. public:
  76. CExtDynamicRichEditDoc * GetDocument();
  77. protected:
  78. CSingleDocTemplate * m_pDocTemplate;
  79. // Operations
  80. public:
  81. // Overrides
  82. //{{AFX_VIRTUAL(CExtDynamicRichEditView)
  83. public:
  84. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  85. protected:
  86. virtual void PostNcDestroy();
  87. //}}AFX_VIRTUAL
  88. // Implementation
  89. public:
  90. virtual ~CExtDynamicRichEditView();
  91. protected:
  92. // Generated message map functions
  93. protected:
  94. //{{AFX_MSG(CExtDynamicRichEditView)
  95. afx_msg void OnDestroy();
  96. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  97. //}}AFX_MSG
  98. DECLARE_MESSAGE_MAP()
  99. private:
  100. void _DoDestroyWindow(void);
  101. };
  102. /////////////////////////////////////////////////////////////////////////////
  103. // CExtPopupRichEditView window
  104. class CExtPopupRichEditView : public CExtDynamicRichEditView
  105. {
  106. // Construction
  107. public:
  108. DECLARE_DYNCREATE( CExtPopupRichEditView );
  109. CExtPopupRichEditView();
  110. // Attributes
  111. public:
  112. COLORREF m_clrBackground, m_clrBorderLT, m_clrBorderRB;
  113. enum eShadowType_t
  114. {
  115. __EST_NONE = 0,
  116. __EST_POPUP = 1,
  117. __EST_WINHELP = 2,
  118. };
  119. eShadowType_t m_eST;
  120. // Operations
  121. public:
  122. // Overrides
  123. // ClassWizard generated virtual function overrides
  124. //{{AFX_VIRTUAL(CExtPopupRichEditView)
  125. public:
  126. virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
  127. protected:
  128. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  129. //}}AFX_VIRTUAL
  130. // Implementation
  131. public:
  132. virtual ~CExtPopupRichEditView();
  133. bool Activate(
  134. CExtResourceManager::CExtResourceMemoryBuffer & buffer,
  135. const RECT & rcItem,
  136. HWND hWndNotify,
  137. UINT nAlignType,
  138. int nAlignDistance = 30
  139. );
  140. void Deactivate();
  141. private:
  142. HWND m_hWndNotify;
  143. CSize m_sizeLayout;
  144. void LayoutWnd();
  145. void SetupRTForPlain(
  146. CExtResourceManager::CExtResourceMemoryBuffer & buffer
  147. );
  148. static DWORD CALLBACK stat_StreamUploadCallback(
  149.    DWORD dwCookie,
  150.    LPBYTE bBuff,
  151.    LONG nCountIn,
  152.    LONG * p_nCountOut
  153.    );
  154. protected:
  155. virtual int OnQueryShadowSize() const;
  156. virtual CRect OnQueryBorderSizes() const;
  157. virtual void OnPaintNcAreaParts(
  158. CDC & dc,
  159. CRect rcWnd,
  160. CRect rcClient,
  161. CRect rcBorders
  162. ) const;
  163. // Generated message map functions
  164. protected:
  165. //{{AFX_MSG(CExtPopupRichEditView)
  166. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
  167. afx_msg void OnNcPaint();
  168. afx_msg void OnCancelMode();
  169. #if _MFC_VER < 0x700
  170. afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
  171. #else
  172. afx_msg void OnActivateApp(BOOL bActive, DWORD hTask);
  173. #endif
  174. afx_msg void OnSettingChange(UINT uFlags, __EXT_MFC_SAFE_LPCTSTR lpszSection);
  175. afx_msg void OnSysColorChange();
  176. afx_msg LRESULT OnDisplayChange( WPARAM wParam, LPARAM lParam );
  177. afx_msg LRESULT OnThemeChanged( WPARAM wParam, LPARAM lParam );
  178. //}}AFX_MSG
  179. DECLARE_MESSAGE_MAP()
  180. };
  181. /////////////////////////////////////////////////////////////////////////////
  182. //{{AFX_INSERT_LOCATION}}
  183. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  184. #endif // !defined(AFX_EXTPOPUPRICHEDITCTRL_H__B8A07E35_D826_4976_8BD0_088A56DA42D1__INCLUDED_)