1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
14#ifndef OSGGA_EVENTSOURCE
15#define OSGGA_EVENTSOURCE 1
17#include <osgGA/EventQueue>
22 * Device base class from abstracting away from devices/windows that can generate events.
24class OSGGA_EXPORT Device : public osg::Object
35 Device(const Device& es, const osg::CopyOp& copyop);
37 META_Object(osgGA,Device);
39 int getCapabilities() const { return _capabilities; }
41 virtual bool checkEvents() { return _eventQueue.valid() ? !(getEventQueue()->empty()) : false; }
42 virtual void sendEvent(const Event& ea);
43 virtual void sendEvents(const EventQueue::Events& events);
45 void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; }
46 osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); }
47 const osgGA::EventQueue* getEventQueue() const { return _eventQueue.get(); }
50 void setCapabilities(int capabilities) { _capabilities = capabilities; }
54 /** Prevent unwanted copy operator.*/
55 Device& operator = (const Device&) { return *this; }
57 osg::ref_ptr<osgGA::EventQueue> _eventQueue;