root/OpenSceneGraph/trunk/src/osgGA/GUIEventHandler.cpp @ 13890

Revision 13890, 1.3 kB (checked in by robert, 10 hours ago)

Changed the osgUI behaviour so that events are set to be handled by Widgets that have focus even if they don't directly use them.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#include <osgGA/GUIEventHandler>
15#include <osgGA/EventVisitor>
16
17using namespace osgGA;
18
19// adapt EventHandler usage to old style GUIEventHandler usage
20bool GUIEventHandler::handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
21{
22    osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
23    osgGA::GUIEventAdapter* ea = event->asGUIEventAdapter();
24    if (ea && ev && ev->getActionAdapter())
25    {
26#if 1
27        bool handled = handle(*ea, *(ev->getActionAdapter()), object, nv);
28        if (handled) ea->setHandled(true);
29        return handled;
30#else
31        return handleWithCheckAgainstIgnoreHandledEventsMask(*ea, *(ev->getActionAdapter()), object, nv);
32#endif
33    }
34    return false;
35}
Note: See TracBrowser for help on using the browser.