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.

86 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 = { 0xc094012c, 0x6be7, 0x11d3, {0x91, 0x56, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9} };
  25. //==============================================================
  26. //
  27. // CStaticNode implementation
  28. //
  29. //
  30. CStaticNode::CStaticNode()
  31. {
  32. children[0] = new CPeoplePoweredVehicle;
  33. children[1] = new CLandBasedVehicle;
  34. children[2] = new CSkyBasedVehicle;
  35. children[3] = new CSpaceVehicle;
  36. }
  37. CStaticNode::~CStaticNode()
  38. {
  39. for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
  40. if (children[n]) {
  41. delete children[n];
  42. }
  43. }
  44. HRESULT CStaticNode::OnExpand(IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
  45. {
  46. //cache static node's HSCOPEITEM for future use
  47. m_hParentHScopeItem = parent;
  48. SCOPEDATAITEM sdi;
  49. if (!bExpanded) {
  50. // create the child nodes, then expand them
  51. for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
  52. ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
  53. sdi.mask = SDI_STR | // Displayname is valid
  54. SDI_PARAM | // lParam is valid
  55. SDI_IMAGE | // nImage is valid
  56. SDI_OPENIMAGE | // nOpenImage is valid
  57. SDI_PARENT |
  58. SDI_CHILDREN;
  59. sdi.relativeID = (HSCOPEITEM)parent;
  60. sdi.nImage = children[n]->GetBitmapIndex();
  61. sdi.nOpenImage = INDEX_OPENFOLDER;
  62. sdi.displayname = MMC_CALLBACK;
  63. sdi.lParam = (LPARAM)children[n]; // The cookie
  64. sdi.cChildren = (n == 0); // only the first child has children
  65. HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );
  66. _ASSERT( SUCCEEDED(hr) );
  67. children[n]->SetScopeItemValue(sdi.ID);
  68. }
  69. }
  70. return S_OK;
  71. }