Added close button on Dialog title bar

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14435 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-09-03 12:28:04 +00:00
parent 1e9722601c
commit 4f6dbf5623
4 changed files with 81 additions and 8 deletions

View File

@@ -13,12 +13,51 @@
#include <osgUI/Callbacks>
#include <osgUI/Widget>
#include <osgUI/Dialog>
#include <osg/ValueObject>
#include <osg/MatrixTransform>
#include <osg/io_utils>
using namespace osgUI;
CloseCallback::CloseCallback(const std::string& callbackName)
{
setName(callbackName);
}
CloseCallback::CloseCallback(const CloseCallback& hc, const osg::CopyOp& copyop)
{
}
bool CloseCallback::run(osg::Object* object, osg::Parameters&, osg::Parameters&) const
{
osg::Node* node = dynamic_cast<osg::Node*>(object);
if (node)
{
osg::NodePathList nodePathList = node->getParentalNodePaths();
for(osg::NodePathList::iterator itr = nodePathList.begin();
itr != nodePathList.end();
++itr)
{
osg::NodePath& nodePath = *itr;
for(osg::NodePath::reverse_iterator ritr = nodePath.rbegin();
ritr != nodePath.rend();
++ritr)
{
osgUI::Dialog* dialog = dynamic_cast<osgUI::Dialog*>(*ritr);
if (dialog)
{
dialog->setVisible(false);
break;
}
}
}
return true;
}
return false;
}
HandleCallback::HandleCallback()
{
setName("handle");