Added new osgGA - GUI Adapter library submitted by Neil Salter. This will

replace the current GUI adapter code inside osgUtil.
This commit is contained in:
Robert Osfield
2002-05-09 10:31:03 +00:00
parent e58b79c997
commit cf4a3500ec
28 changed files with 2617 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
#include <osgGA/GUIEventHandler>
using osgGA::CompositeGUIEventHandler;
bool CompositeGUIEventHandler::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa)
{
bool result=false;
for (ChildList::iterator itr=_children.begin();
itr!=_children.end();
++itr)
{
result |= (*itr)->handle(ea,aa);
}
return result;
}
bool CompositeGUIEventHandler::addChild(GUIEventHandler *child)
{
if (child && !containsNode(child))
{
// note ref_ptr<> automatically handles incrementing child's reference count.
_children.push_back(child);
return true;
}
else return false;
}
bool CompositeGUIEventHandler::removeChild(GUIEventHandler *child)
{
ChildList::iterator itr = findChild(child);
if (itr!=_children.end())
{
// note ref_ptr<> automatically handles decrementing child's reference count.
_children.erase(itr);
return true;
}
else return false;
}