Improved handling of callback object to open the door to use of general osg::CallbackObject as mechnisms for something simialr to Qt's signal/slot mechanism.

This commit is contained in:
Robert Osfield
2014-05-21 09:45:11 +00:00
parent 28c36d615b
commit 20fd80de3a
2 changed files with 27 additions and 64 deletions

View File

@@ -16,6 +16,7 @@
#include <osg/Group>
#include <osg/BoundingBox>
#include <osg/ScriptEngine>
#include <osgGA/Event>
#include <osgGA/EventVisitor>
@@ -44,6 +45,7 @@ public:
virtual void createGraphics();
virtual void createGraphicsImplementation();
virtual void setExtents(const osg::BoundingBoxf& bb);
const osg::BoundingBoxf& getExtents() const { return _extents; }
@@ -83,6 +85,15 @@ public:
/** get whether the widget has focus or not.*/
virtual bool getHasEventFocus() const;
/** invoke all callbacks with specified names providing input and output parameters.*/
bool runCallbacks(const std::string& name, osg::Parameters& inputParameters, osg::Parameters& outputParameters) { return osg::runNamedCallbackObjects(this, name, inputParameters, outputParameters); }
/** invoke all callbacks with specified names without any specified input or output parameters.*/
bool runCallbacks(const std::string& name) { osg::Parameters inputParameters, outputParameters; return osg::runNamedCallbackObjects(this, name, inputParameters, outputParameters); }
/** Compute the bounding sphere of the widget.*/
virtual osg::BoundingSphere computeBound() const;
/** update any focus related graphics+state to the focused state.*/
@@ -108,7 +119,6 @@ protected:
osg::ref_ptr<AlignmentSettings> _alignmentSettings;
osg::ref_ptr<FrameSettings> _frameSettings;
osg::ref_ptr<TextSettings> _textSettings;
};
}