[!if RIBBON_TOOLBAR] // 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面 // (“Fluent UI”)。该示例仅供参考, // 用以补充《Microsoft 基础类参考》和 // MFC C++ 库软件随附的相关电子文档。 // 复制、使用或分发 Fluent UI 的许可条款是单独提供的。 // 若要了解有关 Fluent UI 许可计划的详细信息,请访问 // https://go.microsoft.com/fwlink/?LinkId=238214. // // 版权所有(C) Microsoft Corporation // 保留所有权利。 [!endif] // $viewheader$: $viewclass$ 类的接口 // #pragma once [!if CONTAINER || CONTAINER_SERVER] class $containeritemclass$; [!endif] [!if OLEDB_RECORD_VIEW || ODBC_RECORD_VIEW] class $rowsetclass$; [!endif] class $viewclass$ : public $viewbaseclass$ { protected: // 仅从序列化创建 $viewclass$() noexcept; DECLARE_DYNCREATE($viewclass$) [!if OLEDB_RECORD_VIEW || FORM_VIEW || ODBC_RECORD_VIEW] public: #ifdef AFX_DESIGN_TIME enum{ IDD = IDD_$uppercasesafeprojectidentifiername$_FORM }; #endif [!if OLEDB_RECORD_VIEW || ODBC_RECORD_VIEW] $rowsetclass$* m_pSet; [!endif] [!endif] // 特性 public: $docclass$* GetDocument() const; [!if CONTAINER || CONTAINER_SERVER] [!if !RICH_EDIT_VIEW] // m_pSelection 将所选内容保存在当前 $containeritemclass$ 中。 // 对于许多应用程序,这种成员变量不足以 // 表示某个选择,例如在不属于 // $containeritemclass$ 的对象中选定的一个或多个对象。提供这种选择 // 机制的目的只是帮助入门 // TODO: 用适合应用程序的选择机制替换此选择机制 $containeritemclass$* m_pSelection; [!endif] [!endif] // 操作 public: // 重写 public: [!if OLEDB_RECORD_VIEW] virtual CRowset<>* OnGetRowset(); [!endif] [!if ODBC_RECORD_VIEW] virtual CRecordset* OnGetRecordset(); [!endif] [!if !TREE_VIEW && !LIST_VIEW && !HTML_VIEW && !HTML_EDITVIEW && !RICH_EDIT_VIEW && !EDIT_VIEW && !FORM_VIEW && !OLEDB_RECORD_VIEW && !ODBC_RECORD_VIEW] virtual void OnDraw(CDC* pDC); // 重写以绘制该视图 [!endif] [!if PRINTING] [!if TREE_VIEW || LIST_VIEW] virtual void OnDraw(CDC* pDC); // 重写以绘制该视图 [!endif] [!endif] virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: [!if FORM_VIEW || OLEDB_RECORD_VIEW || ODBC_RECORD_VIEW] virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 [!endif] [!if SCROLL_VIEW || CONTAINER || CONTAINER_SERVER || OLEDB_RECORD_VIEW || TREE_VIEW || LIST_VIEW || FORM_VIEW || HTML_VIEW || ODBC_RECORD_VIEW] virtual void OnInitialUpdate(); // 构造后第一次调用 [!endif] [!if PRINTING] [!if !HTML_VIEW && !HTML_EDITVIEW] virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); [!endif] [!if !RICH_EDIT_VIEW && !HTML_VIEW && !HTML_EDITVIEW] virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); [!endif] [!if FORM_VIEW || ACTIVE_DOC_CONTAINER] virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo); [!endif] [!endif] [!if CONTAINER || CONTAINER_SERVER] [!if !RICH_EDIT_VIEW] virtual BOOL IsSelected(const CObject* pDocItem) const;// 容器支持 [!endif] [!endif] // 实现 public: virtual ~$viewclass$(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // 生成的消息映射函数 protected: [!if CONTAINER || CONTAINER_SERVER] afx_msg void OnDestroy(); [!if !RICH_EDIT_VIEW] afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnInsertObject(); afx_msg void OnCancelEditCntr(); afx_msg void OnFilePrint(); [!endif] [!endif] [!if MINI_SERVER || FULL_SERVER || CONTAINER_SERVER] afx_msg void OnCancelEditSrvr(); [!endif] [!if PROJECT_STYLE_EXPLORER] [!if LIST_VIEW] afx_msg void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct); [!endif] [!endif] [!if ACTIVE_DOC_CONTAINER || MENUBAR_TOOLBAR || RIBBON_TOOLBAR] afx_msg void OnFilePrintPreview(); [!if ACTIVE_DOC_CONTAINER && !RICH_EDIT_VIEW] afx_msg void OnFilePrintPreviewUIUpdate(CCmdUI* pCmdUI); [!endif] [!endif] [!if MENUBAR_TOOLBAR || RIBBON_TOOLBAR] afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); [!endif] [!if HTML_EDITVIEW] DECLARE_DHTMLEDITING_CMDMAP($viewclass$) [!endif] DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // $viewimpl$ 中的调试版本 inline $docclass$* $viewclass$::GetDocument() const { return reinterpret_cast<$docclass$*>(m_pDocument); } #endif