Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.3 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. // OpView.h : interface of the COpView class
  8. //
  9. /////////////////////////////////////////////////////////////////////////////
  10. #if !defined(AFX_OPVIEW_H__4419F1AE_692B_11D3_BD30_0080C8E60955__INCLUDED_)
  11. #define AFX_OPVIEW_H__4419F1AE_692B_11D3_BD30_0080C8E60955__INCLUDED_
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif // _MSC_VER > 1000
  15. #include "OpWrap.h"
  16. #define WM_OBJ_INDICATE (WM_USER + 101)
  17. #define WM_OP_STATUS (WM_USER + 102)
  18. class CWMITestDoc;
  19. class COpView : public CTreeView
  20. {
  21. protected: // create from serialization only
  22. COpView();
  23. DECLARE_DYNCREATE(COpView)
  24. // Attributes
  25. public:
  26. CWMITestDoc* GetDocument();
  27. CTreeCtrl *m_pTree;
  28. HTREEITEM m_hitemRoot;
  29. // Operations
  30. public:
  31. void AddOpItem(WMI_OP_TYPE type, LPCTSTR szText, BOOL bOption = FALSE);
  32. void AddOpItem(COpWrap *pWrap);
  33. void AddOpItemChild(
  34. CObjInfo* pInfo,
  35. HTREEITEM hParent,
  36. int iImage,
  37. LPCTSTR szText);
  38. void RefreshItem(HTREEITEM hitem);
  39. void RefreshItem(COpWrap *pWrap);
  40. void RefreshItems();
  41. void RefreshObject(CObjInfo *pInfo);
  42. void FlushItems();
  43. void RemoveItemFromTree(HTREEITEM item, BOOL bNoWMIRemove);
  44. void UpdateRootText();
  45. BOOL IsRoot(HTREEITEM hitem) { return hitem == m_hitemRoot; }
  46. BOOL IsOp(HTREEITEM hitem) { return IsRoot(m_pTree->GetParentItem(hitem)); }
  47. BOOL IsObj(HTREEITEM hitem);
  48. BOOL IsObjDeleteable(HTREEITEM hitem);
  49. void RemoveChildrenFromTree(HTREEITEM item, BOOL bDoRemove);
  50. COpWrap *GetCurrentOp();
  51. CObjInfo *GetCurrentObj();
  52. void DoContextMenuForItem(HTREEITEM hItem);
  53. int GetOpCount();
  54. CObjInfo *GetObjInfo(HTREEITEM hItem);
  55. void UpdateCurrentObject(BOOL bReloadProps = FALSE);
  56. void UpdateItem(HTREEITEM hitem);
  57. void UpdateCurrentItem();
  58. void UpdateStatusText();
  59. BOOL GetSelectedObjPath(CString &strPath);
  60. BOOL GetSelectedClass(CString &strClass);
  61. void DoPopupMenu(UINT nMenuID);
  62. void UpdateObject(CObjInfo *pInfo);
  63. void EditObj(CObjInfo *pInfo);
  64. void ExportItemToFile(LPCTSTR szFilename, HTREEITEM hitem,
  65. BOOL bShowSystem, BOOL bTranslate);
  66. //void SerializeForClipboard(CArchive &arcNative, CArchive &arcText,
  67. // CLIPFORMAT *pFormat);
  68. //void SerializeTreeItem(HTREEITEM item, CArchive &arcNative, CArchive &arcText);
  69. void DoCopy(COpList &list);
  70. void BuildSelectedOpList(COpList &list);
  71. BOOL CanCopy();
  72. static DWORD WINAPI CopyThreadProc(COpView *pThis);
  73. void DoThreadedCopy();
  74. void CopyToClipboard();
  75. // Overrides
  76. // ClassWizard generated virtual function overrides
  77. //{{AFX_VIRTUAL(COpView)
  78. public:
  79. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  80. protected:
  81. virtual void OnInitialUpdate(); // called first time after construct
  82. //}}AFX_VIRTUAL
  83. // Implementation
  84. public:
  85. virtual ~COpView();
  86. #ifdef _DEBUG
  87. virtual void AssertValid() const;
  88. virtual void Dump(CDumpContext& dc) const;
  89. #endif
  90. protected:
  91. int GetChildCount(HTREEITEM hitem);
  92. // Generated message map functions
  93. protected:
  94. void RemoveNonOpObjectFromTree(HTREEITEM item);
  95. void ExportItem(CStdioFile *pFile, HTREEITEM item, BOOL bShowSystem,
  96. BOOL bTranslate);
  97. //{{AFX_MSG(COpView)
  98. afx_msg void OnSize(UINT nType, int cx, int cy);
  99. afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
  100. afx_msg void OnSelChanged(NMHDR* pNMHDR, LRESULT* pResult);
  101. afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
  102. afx_msg void OnDelete();
  103. afx_msg void OnUpdateDelete(CCmdUI* pCmdUI);
  104. afx_msg void OnModify();
  105. afx_msg void OnUpdateModify(CCmdUI* pCmdUI);
  106. afx_msg void OnEditCopy();
  107. afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
  108. //}}AFX_MSG
  109. DECLARE_MESSAGE_MAP()
  110. afx_msg LRESULT OnObjIndicate(WPARAM wParam, LPARAM lParam);
  111. afx_msg LRESULT OnOpStatus(WPARAM wParam, LPARAM lParam);
  112. };
  113. extern COpView *g_pOpView;
  114. #ifndef _DEBUG // debug version in OpView.cpp
  115. inline CWMITestDoc* COpView::GetDocument()
  116. { return (CWMITestDoc*)m_pDocument; }
  117. #endif
  118. /////////////////////////////////////////////////////////////////////////////
  119. //{{AFX_INSERT_LOCATION}}
  120. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  121. #endif // !defined(AFX_OPVIEW_H__4419F1AE_692B_11D3_BD30_0080C8E60955__INCLUDED_)