2012-03-22 01:36:20 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2005-02-25 22:02:48 +08:00
|
|
|
*
|
2012-03-22 01:36:20 +08:00
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
2005-02-25 22:02:48 +08:00
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
2012-03-22 01:36:20 +08:00
|
|
|
*
|
2005-02-25 22:02:48 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-03-22 01:36:20 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2005-02-25 22:02:48 +08:00
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
#include <osgGA/EventVisitor>
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
using namespace osg;
|
|
|
|
using namespace osgGA;
|
|
|
|
|
2005-07-27 17:37:26 +08:00
|
|
|
EventVisitor::EventVisitor()
|
2005-12-07 23:29:29 +08:00
|
|
|
: NodeVisitor(EVENT_VISITOR,TRAVERSE_ACTIVE_CHILDREN),
|
2016-06-24 22:23:57 +08:00
|
|
|
_actionAdapter(0),
|
2005-07-27 17:37:26 +08:00
|
|
|
_handled(false)
|
2005-02-25 22:02:48 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EventVisitor::~EventVisitor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-10-25 22:54:15 +08:00
|
|
|
void EventVisitor::addEvent(Event* event)
|
2005-02-25 22:02:48 +08:00
|
|
|
{
|
|
|
|
_events.push_back(event);
|
|
|
|
}
|
|
|
|
|
2013-10-25 22:54:15 +08:00
|
|
|
void EventVisitor::removeEvent(Event* event)
|
2005-02-25 22:02:48 +08:00
|
|
|
{
|
2013-10-25 22:54:15 +08:00
|
|
|
EventQueue::Events::iterator itr = std::find(_events.begin(), _events.end(), event);
|
2005-02-25 22:02:48 +08:00
|
|
|
if (itr!=_events.end()) _events.erase(itr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EventVisitor::reset()
|
|
|
|
{
|
|
|
|
_events.clear();
|
2005-07-27 17:37:26 +08:00
|
|
|
_handled = false;
|
2005-02-25 22:02:48 +08:00
|
|
|
}
|