Event 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2013 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. #ifndef OSGGA_EVENT
  14. #define OSGGA_EVENT 1
  15. #include <osgGA/Export>
  16. #include <osg/Object>
  17. namespace osgGA {
  18. // forward declare
  19. class GUIEventAdapter;
  20. /** Base Event class.*/
  21. class OSGGA_EXPORT Event : public osg::Object
  22. {
  23. public:
  24. Event();
  25. Event(const Event& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
  26. META_Object(osgGA, Event);
  27. virtual GUIEventAdapter* asGUIEventAdapter() { return 0; }
  28. virtual const GUIEventAdapter* asGUIEventAdapter() const { return 0; }
  29. /** Set whether this event has been handled by an event handler or not.*/
  30. void setHandled(bool handled) const { _handled = handled; }
  31. /** Get whether this event has been handled by an event handler or not.*/
  32. bool getHandled() const { return _handled; }
  33. /** set time in seconds of event. */
  34. void setTime(double time) { _time = time; }
  35. /** get time in seconds of event. */
  36. double getTime() const { return _time; }
  37. protected:
  38. virtual ~Event() {}
  39. mutable bool _handled;
  40. double _time;
  41. };
  42. }
  43. #endif