88 lines
2.5 KiB
C++
88 lines
2.5 KiB
C++
//==============================================================;
|
|
//
|
|
// This source code is only intended as a supplement to
|
|
// existing Microsoft documentation.
|
|
//
|
|
//
|
|
//
|
|
//
|
|
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
|
|
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
|
|
// PURPOSE.
|
|
//
|
|
// Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
|
|
//
|
|
//
|
|
//
|
|
//==============================================================;
|
|
|
|
#include "StatNode.h"
|
|
|
|
#include "Space.h"
|
|
#include "Sky.h"
|
|
#include "People.h"
|
|
#include "Land.h"
|
|
#include "Backgrnd.h"
|
|
|
|
const GUID CStaticNode::thisGuid = { 0x2974380c, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } };
|
|
|
|
//==============================================================
|
|
//
|
|
// CStaticNode implementation
|
|
//
|
|
//
|
|
CStaticNode::CStaticNode()
|
|
{
|
|
children[0] = new CPeoplePoweredVehicle;
|
|
children[1] = new CLandBasedVehicle;
|
|
children[2] = new CSkyBasedVehicle;
|
|
children[3] = new CSpaceVehicle;
|
|
children[4] = new CBackgroundFolder;
|
|
}
|
|
|
|
CStaticNode::~CStaticNode()
|
|
{
|
|
for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
|
|
if (children[n]) {
|
|
delete children[n];
|
|
}
|
|
|
|
if (m_pBMapSm != NULL)
|
|
DeleteObject(m_pBMapSm);
|
|
|
|
if (m_pBMapLg != NULL)
|
|
DeleteObject(m_pBMapLg);
|
|
}
|
|
|
|
HRESULT CStaticNode::OnExpand(IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
|
|
{
|
|
SCOPEDATAITEM sdi;
|
|
|
|
if (!bExpanded) {
|
|
// create the child nodes, then expand them
|
|
for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
|
|
ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
|
|
sdi.mask = SDI_STR | // Displayname is valid
|
|
SDI_PARAM | // lParam is valid
|
|
SDI_IMAGE | // nImage is valid
|
|
SDI_OPENIMAGE | // nOpenImage is valid
|
|
SDI_PARENT |
|
|
SDI_CHILDREN;
|
|
|
|
sdi.relativeID = (HSCOPEITEM)parent;
|
|
sdi.nImage = children[n]->GetBitmapIndex();
|
|
sdi.nOpenImage = INDEX_OPENFOLDER;
|
|
sdi.displayname = MMC_CALLBACK;
|
|
sdi.lParam = (LPARAM)children[n]; // The cookie
|
|
sdi.cChildren = (n == 0); // only the first child has children
|
|
|
|
HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );
|
|
|
|
_ASSERT( SUCCEEDED(hr) );
|
|
}
|
|
}
|
|
|
|
return S_OK;
|
|
}
|