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.

87 lines
2.6 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 "Backgrnd.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. children[4] = new CBackgroundFolder;
  38. }
  39. CStaticNode::~CStaticNode()
  40. {
  41. for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
  42. if (children[n]) {
  43. delete children[n];
  44. }
  45. if (m_pBMapSm != NULL)
  46. DeleteObject(m_pBMapSm);
  47. if (m_pBMapLg != NULL)
  48. DeleteObject(m_pBMapLg);
  49. }
  50. HRESULT CStaticNode::OnExpand(IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
  51. {
  52. SCOPEDATAITEM sdi;
  53. if (!bExpanded) {
  54. // create the child nodes, then expand them
  55. for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
  56. ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
  57. sdi.mask = SDI_STR | // Displayname is valid
  58. SDI_PARAM | // lParam is valid
  59. SDI_IMAGE | // nImage is valid
  60. SDI_OPENIMAGE | // nOpenImage is valid
  61. SDI_PARENT |
  62. SDI_CHILDREN;
  63. sdi.relativeID = (HSCOPEITEM)parent;
  64. sdi.nImage = children[n]->GetBitmapIndex();
  65. sdi.nOpenImage = INDEX_OPENFOLDER;
  66. sdi.displayname = MMC_CALLBACK;
  67. sdi.lParam = (LPARAM)children[n]; // The cookie
  68. sdi.cChildren = (n == 0); // only the first child has children
  69. HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );
  70. _ASSERT( SUCCEEDED(hr) );
  71. }
  72. }
  73. return S_OK;
  74. }