Leaked source code of windows server 2003
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.

81 lines
2.5 KiB

  1. //==============================================================;
  2. //
  3. // This source code is only intended as a supplement to
  4. // existing Microsoft documentation.
  5. //
  6. //
  7. //
  8. //
  9. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  10. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  11. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  12. // PURPOSE.
  13. //
  14. // Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  15. //
  16. //
  17. //
  18. //==============================================================;
  19. #include "StatNode.h"
  20. #include "Space.h"
  21. #include "Sky.h"
  22. #include "People.h"
  23. #include "Land.h"
  24. const GUID CStaticNode::thisGuid = { 0x2974380c, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } };
  25. //==============================================================
  26. //
  27. // CStaticNode implementation
  28. //
  29. //
  30. CStaticNode::CStaticNode(CComponentData *pComponentData)
  31. {
  32. m_pComponentData = pComponentData;
  33. children[0] = new CPeoplePoweredVehicle(pComponentData);
  34. children[1] = new CLandBasedVehicle(pComponentData);
  35. children[2] = new CSkyBasedVehicle(pComponentData);
  36. children[3] = new CSpaceVehicle(pComponentData);
  37. }
  38. CStaticNode::~CStaticNode()
  39. {
  40. for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
  41. if (children[n]) {
  42. delete children[n];
  43. }
  44. }
  45. HRESULT CStaticNode::Expand(IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
  46. {
  47. SCOPEDATAITEM sdi;
  48. if (!bExpanded) {
  49. // create the child nodes, then expand them
  50. for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
  51. ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
  52. sdi.mask = SDI_STR | // Displayname is valid
  53. SDI_PARAM | // lParam is valid
  54. SDI_IMAGE | // nImage is valid
  55. SDI_OPENIMAGE | // nOpenImage is valid
  56. SDI_PARENT |
  57. SDI_CHILDREN;
  58. sdi.relativeID = (HSCOPEITEM)parent;
  59. sdi.nImage = children[n]->GetBitmapIndex();
  60. sdi.nOpenImage = INDEX_OPENFOLDER;
  61. sdi.displayname = MMC_CALLBACK;
  62. sdi.lParam = (LPARAM)children[n]; // The cookie
  63. sdi.cChildren = (n == 0); // only the first child has children
  64. HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );
  65. _ASSERT( SUCCEEDED(hr) );
  66. }
  67. }
  68. return S_OK;
  69. }