osgGA/Widget
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2013 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 OSGGA_WIDGET
#define OSGGA_WIDGET
#include <osg/Group>
#include <osg/BoundingBox>
#include <osgGA/Event>
#include <osgGA/EventVisitor>
namespace osgGA
{
class OSGGA_EXPORT Widget : public osg::Group
{
public:
Widget();
Widget(const Widget& tfw, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Node(osgGA, Widget);
virtual void traverse(osg::NodeVisitor& nv);
virtual void traverseImplementation(osg::NodeVisitor& nv);
virtual bool handle(osgGA::EventVisitor* ev, osgGA::Event* event);
virtual bool handleImplementation(osgGA::EventVisitor* ev, osgGA::Event* event);
virtual bool computePositionInLocalCoordinates(osgGA::EventVisitor* ev, osgGA::GUIEventAdapter* event, osg::Vec3& localPosition) const;
virtual void createGraphics();
virtual void createGraphicsImplementation();
virtual void setExtents(const osg::BoundingBoxf& bb);
const osg::BoundingBoxf& getExtents() const { return _extents; }
enum FocusBehaviour
{
CLICK_TO_FOCUS,
FOCUS_FOLLOWS_POINTER,
EVENT_DRIVEN_FOCUS_DISABLED
};
void setFocusBehaviour(FocusBehaviour behaviour) { _focusBehaviour = behaviour; }
FocusBehaviour getFocusBehaviour() const { return _focusBehaviour; }
virtual void updateFocus(osg::NodeVisitor& nv);
virtual void setHasEventFocus(bool focus);
virtual bool getHasEventFocus() const;
virtual osg::BoundingSphere computeBound() const;
virtual void enter();
virtual void enterImplementation();
virtual void leave();
virtual void leaveImplementation();
protected:
virtual ~Widget() {}
FocusBehaviour _focusBehaviour;
bool _hasEventFocus;
bool _graphicsInitialized;
osg::BoundingBoxf _extents;
};
}
#endif
BoundingBox
EventVisitor
Event
Group
osgGA::EventVisitor
Definition EventVisitor:42
osgGA::Event
Definition Event:27
osgGA::GUIEventAdapter
Definition GUIEventAdapter:82
osgGA::Widget::setHasEventFocus
virtual void setHasEventFocus(bool focus)
osgGA::Widget::enter
virtual void enter()
osgGA::Widget::~Widget
virtual ~Widget()
Definition osgGA/Widget:77
osgGA::Widget::_hasEventFocus
bool _hasEventFocus
Definition osgGA/Widget:80
osgGA::Widget::META_Node
META_Node(osgGA, Widget)
osgGA::Widget::handleImplementation
virtual bool handleImplementation(osgGA::EventVisitor *ev, osgGA::Event *event)
osgGA::Widget::_focusBehaviour
FocusBehaviour _focusBehaviour
Definition osgGA/Widget:79
osgGA::Widget::enterImplementation
virtual void enterImplementation()
osgGA::Widget::FocusBehaviour
FocusBehaviour
Definition osgGA/Widget:47
osgGA::Widget::CLICK_TO_FOCUS
@ CLICK_TO_FOCUS
Definition osgGA/Widget:48
osgGA::Widget::EVENT_DRIVEN_FOCUS_DISABLED
@ EVENT_DRIVEN_FOCUS_DISABLED
Definition osgGA/Widget:50
osgGA::Widget::FOCUS_FOLLOWS_POINTER
@ FOCUS_FOLLOWS_POINTER
Definition osgGA/Widget:49
osgGA::Widget::getFocusBehaviour
FocusBehaviour getFocusBehaviour() const
Definition osgGA/Widget:54
osgGA::Widget::_extents
osg::BoundingBoxf _extents
Definition osgGA/Widget:83
osgGA::Widget::computeBound
virtual osg::BoundingSphere computeBound() const
osgGA::Widget::Widget
Widget(const Widget &tfw, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgGA::Widget::computePositionInLocalCoordinates
virtual bool computePositionInLocalCoordinates(osgGA::EventVisitor *ev, osgGA::GUIEventAdapter *event, osg::Vec3 &localPosition) const
osgGA::Widget::handle
virtual bool handle(osgGA::EventVisitor *ev, osgGA::Event *event)
osgGA::Widget::setExtents
virtual void setExtents(const osg::BoundingBoxf &bb)
osgGA::Widget::createGraphicsImplementation
virtual void createGraphicsImplementation()
osgGA::Widget::traverse
virtual void traverse(osg::NodeVisitor &nv)
osgGA::Widget::getExtents
const osg::BoundingBoxf & getExtents() const
Definition osgGA/Widget:44
osgGA::Widget::traverseImplementation
virtual void traverseImplementation(osg::NodeVisitor &nv)
osgGA::Widget::leaveImplementation
virtual void leaveImplementation()
osgGA::Widget::setFocusBehaviour
void setFocusBehaviour(FocusBehaviour behaviour)
Definition osgGA/Widget:53
osgGA::Widget::leave
virtual void leave()
osgGA::Widget::createGraphics
virtual void createGraphics()
osgGA::Widget::_graphicsInitialized
bool _graphicsInitialized
Definition osgGA/Widget:81
osgGA::Widget::getHasEventFocus
virtual bool getHasEventFocus() const
osgGA::Widget::Widget
Widget()
osgGA::Widget::updateFocus
virtual void updateFocus(osg::NodeVisitor &nv)
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Group
Definition Group:29
osg::NodeVisitor
Definition NodeVisitor:82
osgGA
Definition Callback:21
osg::Vec3
Vec3f Vec3
Definition Vec3:21
osg::BoundingBoxf
BoundingBoxImpl< Vec3f > BoundingBoxf
Definition BoundingBox:251
osg::BoundingSphere
BoundingSphered BoundingSphere
Definition BoundingSphere:314
OSGGA_EXPORT
#define OSGGA_EXPORT
Definition osgGA/Export:40