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.4 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. #include "Extend.h"
  25. const GUID CStaticNode::thisGuid = { 0x2974380c, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } };
  26. //==============================================================
  27. //
  28. // CStaticNode implementation
  29. //
  30. //
  31. CStaticNode::CStaticNode()
  32. {
  33. children[0] = new CPeoplePoweredVehicle;
  34. children[1] = new CLandBasedVehicle;
  35. children[2] = new CSkyBasedVehicle;
  36. children[3] = new CSpaceVehicle;
  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::OnExpand(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 || n == 2); // Only first and third
  64. // children have child nodes
  65. HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );
  66. _ASSERT( SUCCEEDED(hr) );
  67. }
  68. }
  69. return S_OK;
  70. }