/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * 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 * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGVIEWER_GRAPHICWINDOW #define OSGVIEWER_GRAPHICWINDOW 1 #include #include #include #include #include namespace osgViewer { /** Base class for providing Windowing API agnostic access to creating and managing graphisc window and events. * Note, the GraphicsWindow is subclassed from osg::GraphicsContext, and to provide an implemention you'll need to implement its * range of pure virtual functions, you'll find these all have naming convention methodNameImplemention(..). * GraphicsWindow adds the event queue ontop of the GraphicsContext, thereby adding a mechnism for adapting Windowing events * as well as basics graphics context work, you should wire up custom GraphicsWindowImplementation to push their events through * into the EventQueue. */ class OSGVIEWER_EXPORT GraphicsWindow : public osg::GraphicsContext, public osgGA::GUIActionAdapter { public: GraphicsWindow() { _eventQueue = new osgGA::EventQueue; } void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; } osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); } const osgGA::EventQueue* getEventQueue() const { return _eventQueue.get(); } virtual void checkEvents() {} /** Set Window decoration.*/ virtual void setWindowDecoration(bool /*flag*/) {} /** Get focus.*/ virtual void grabFocus() {} /** Get focus on if the pointer is in this window.*/ virtual void grabFocusIfPointerInWindow() {} /** Switch on/off the cursor.*/ virtual void useCursor(bool /*cursorOn*/) {} public: /** Return whether a valid and usable GraphicsContext has been created.*/ virtual bool valid() const { osg::notify(osg::NOTICE)<<"GraphicsWindow::realizeImplementation() not implemented."< _eventQueue; }; } #endif