OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Widget.h
Go to the documentation of this file.
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 
14 #ifndef OSGUI_WIDGET
15 #define OSGUI_WIDGET
16 
17 #include <osg/Group>
18 #include <osg/BoundingBox>
19 #include <osgGA/Event>
20 #include <osgGA/EventVisitor>
21 
22 #define OSGUI_EXPORT
23 
24 namespace osgGA
25 {
26 
28 {
29 public:
30  Widget();
31  Widget(const Widget& tfw, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
33 
34  virtual void traverse(osg::NodeVisitor& nv);
35  virtual void traverseImplementation(osg::NodeVisitor& nv);
36 
37  virtual bool handle(osgGA::EventVisitor* ev, osgGA::Event* event);
38  virtual bool handleImplementation(osgGA::EventVisitor* ev, osgGA::Event* event);
39 
40  virtual bool computePositionInLocalCoordinates(osgGA::EventVisitor* ev, osgGA::GUIEventAdapter* event, osg::Vec3& localPosition) const;
41 
42  virtual void createGraphics();
43  virtual void createGraphicsImplementation();
44 
45  virtual void setExtents(const osg::BoundingBoxf& bb);
46  const osg::BoundingBoxf& getExtents() const { return _extents; }
47 
49  {
52  EVENT_DRIVEN_FOCUS_DISABLED
53  };
54 
55  void setFocusBehaviour(FocusBehaviour behaviour) { _focusBehaviour = behaviour; }
56  FocusBehaviour getFocusBehaviour() const { return _focusBehaviour; }
57 
59  virtual void updateFocus(osg::NodeVisitor& nv);
60 
62  virtual void setHasEventFocus(bool focus);
63 
65  virtual bool getHasEventFocus() const;
66 
67  virtual osg::BoundingSphere computeBound() const;
68 
70  virtual void enter();
71  virtual void enterImplementation();
72 
74  virtual void leave();
75  virtual void leaveImplementation();
76 
77 
78 protected:
79  virtual ~Widget() {}
80 
84 
86 };
87 
88 }
89 
90 #endif
void setFocusBehaviour(FocusBehaviour behaviour)
Definition: Widget.h:55
FocusBehaviour _focusBehaviour
Definition: Widget.h:81
#define META_Node(library, name)
Definition: Node.h:59
bool _hasEventFocus
Definition: Widget.h:82
FocusBehaviour getFocusBehaviour() const
Definition: Widget.h:56
#define OSGGA_EXPORT
Definition: Export.h:40
const osg::BoundingBoxf & getExtents() const
Definition: Widget.h:46
osg::BoundingBoxf _extents
Definition: Widget.h:85
virtual ~Widget()
Definition: Widget.h:79
bool _graphicsInitialized
Definition: Widget.h:83