This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
MyGameFramework/lib/gwen/controls/gwen_propertytree.cpp
Gered c5cdddbeaa initial commit
current versions of all of my basic framework sources, build configurations/scripts, and supporting assets
2013-01-31 12:53:05 -05:00

54 lines
1.1 KiB
C++

/*
GWEN
Copyright (c) 2010 Facepunch Studios
See license in Gwen.h
*/
#include "../gwen.h"
#include "gwen_propertytree.h"
#include "../gwen_skin.h"
namespace Gwen
{
namespace Controls
{
Properties* PropertyTree::Add( const TextObject& text )
{
TreeNode* node = new PropertyTreeNode( this );
node->SetText( text );
node->Dock( Pos::Top );
Properties* props = new Properties( node );
props->Dock( Pos::Top );
return props;
}
Properties* PropertyTree::Find( const TextObject& text )
{
Controls::Base::List& children = GetChildNodes();
for ( Base::List::iterator iter = children.begin(); iter != children.end(); ++iter )
{
PropertyTreeNode* pChild = gwen_cast<PropertyTreeNode>(*iter);
if ( !pChild ) continue;
if ( pChild->GetText() == text )
{
Base::List& nodechildren = pChild->GetChildren();
for ( Base::List::iterator iter = nodechildren.begin(); iter != nodechildren.end(); ++iter )
{
Properties* pPropertyChild = gwen_cast<Properties>(*iter);
if ( !pPropertyChild ) continue;
return pPropertyChild;
}
}
}
return NULL;
}
}
}