Added support for new event visitor type into osgGA and osgProducer::Viewer,

and event callback into Drawable.
This commit is contained in:
Robert Osfield
2005-02-25 14:02:48 +00:00
parent 82d8bcd2af
commit 0f61af08bd
11 changed files with 319 additions and 10 deletions

View File

@@ -12,9 +12,40 @@
*/
#include <osgGA/GUIEventHandler>
#include <osgGA/EventVisitor>
using namespace osgGA;
void GUIEventHandler::operator()(osg::Node* node, osg::NodeVisitor* nv)
{
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
if (ev && ev->getActionAdapter() && !ev->getEventList().empty())
{
for(osgGA::EventVisitor::EventList::iterator itr = ev->getEventList().begin();
itr != ev->getEventList().end();
++itr)
{
handle(*(*itr), *(ev->getActionAdapter()));
}
}
traverse(node,nv);
}
void GUIEventHandler::event(osg::NodeVisitor* nv, osg::Drawable* /*drawable*/)
{
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
if (ev && ev->getActionAdapter() && !ev->getEventList().empty())
{
for(osgGA::EventVisitor::EventList::iterator itr = ev->getEventList().begin();
itr != ev->getEventList().end();
++itr)
{
handle(*(*itr), *(ev->getActionAdapter()));
}
}
}
void CompositeGUIEventHandler::getUsage(osg::ApplicationUsage& usage) const
{
for (ChildList::const_iterator itr=_children.begin();