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
3.2 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. // PropUtil.h: interface for the CPropUtil class.
  8. //
  9. //////////////////////////////////////////////////////////////////////
  10. #if !defined(AFX_PROPUTIL_H__6F2C145F_F170_480E_B56B_C80A0039E388__INCLUDED_)
  11. #define AFX_PROPUTIL_H__6F2C145F_F170_480E_B56B_C80A0039E388__INCLUDED_
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif // _MSC_VER > 1000
  15. #include "OpWrap.h"
  16. void ValuemapValuesToCombo(HWND hwnd, CPropInfo *pProp, LPCTSTR szDefault);
  17. void BitmaskValuesToCheckListbox(CCheckListBox &ctlListbox, CPropInfo *pProp,
  18. DWORD dwDefValue);
  19. void CheckListboxToBitmaskValue(CCheckListBox &ctlListBox, DWORD *pdwValue);
  20. class CSinglePropUtil
  21. {
  22. public:
  23. BOOL m_bNewProperty;
  24. CPropInfo m_prop;
  25. VARIANT *m_pVar;
  26. BOOL m_bTranslate;
  27. CSinglePropUtil() :
  28. m_bControlsInited(FALSE)
  29. {
  30. }
  31. void Init(CWnd *pWnd) { m_pWnd = pWnd; }
  32. void SetType(CIMTYPE type);
  33. void ShowControls(BOOL bShow);
  34. void EnableControls(BOOL bEnable);
  35. void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  36. // Fake message handlers.
  37. void OnEditEmbedded();
  38. void OnClearEmbedded();
  39. BOOL OnInitDialog();
  40. static void EditObj(IUnknown *pUnk);
  41. static BOOL GetNewObj(IUnknown **ppUnk);
  42. protected:
  43. CCheckListBox m_ctlBitmaskValues;
  44. CComboBox m_ctlListValues;
  45. CEdit m_ctlScalar,
  46. m_ctlText;
  47. IUnknownPtr m_pObjValue;
  48. BOOL m_bControlsInited;
  49. CRect m_rectScalar,
  50. m_rectText;
  51. enum VALUE_TYPE
  52. {
  53. TYPE_EDIT_TEXT,
  54. TYPE_EDIT_SCALAR,
  55. TYPE_CHECKLISTBOX,
  56. TYPE_DROPDOWN,
  57. TYPE_DROPDOWNLIST,
  58. TYPE_EDIT_OBJ,
  59. };
  60. CWnd *m_pWnd;
  61. VALUE_TYPE m_type;
  62. DWORD m_dwScalarID;
  63. void InitTypeCombo();
  64. CIMTYPE GetCurrentType();
  65. void InitControls();
  66. };
  67. class CPropUtil
  68. {
  69. public:
  70. CComboBox m_ctlTypes;
  71. BOOL m_bNewProperty,
  72. m_bIsQualifier;
  73. CPropInfo m_prop;
  74. VARIANT *m_pVar;
  75. BOOL m_bTranslate;
  76. // Needed for spawning instances for embedded objects.
  77. IWbemServices *m_pNamespace;
  78. CPropUtil();
  79. virtual ~CPropUtil();
  80. void Init(CWnd *pWnd);
  81. void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  82. void OnNull();
  83. void OnAdd();
  84. void OnDelete();
  85. void OnUp();
  86. void OnDown();
  87. void OnSelchangeValueArray();
  88. void OnSelchangeType();
  89. void OnEdit();
  90. void OnArray();
  91. void OnEditEmbedded();
  92. void OnClearEmbedded();
  93. void OnDblclkArrayValues();
  94. BOOL OnInitDialog();
  95. BOOL OnSetActive();
  96. protected:
  97. enum VALUE_TYPE
  98. {
  99. TYPE_EDIT,
  100. TYPE_CHECKLISTBOX,
  101. TYPE_DROPDOWN,
  102. TYPE_DROPDOWNLIST,
  103. TYPE_ARRAYLISTBOX,
  104. };
  105. CWnd *m_pWnd;
  106. CSinglePropUtil m_spropUtil;
  107. CListBox m_ctlArrayValues;
  108. VALUE_TYPE m_type;
  109. DWORD m_dwScalarID;
  110. BOOL m_bOnInitDialog;
  111. BOOL IsObjEdit() { return GetCurrentType() == CIM_OBJECT; }
  112. void UpdateArrayButtons();
  113. void Modify(BOOL bEdit);
  114. void InitTypeCombo();
  115. CIMTYPE GetCurrentType();
  116. void ShowArrayControls(BOOL bVal);
  117. void MoveArrayButtons();
  118. };
  119. #endif // !defined(AFX_PROPUTIL_H__6F2C145F_F170_480E_B56B_C80A0039E388__INCLUDED_)