Implemented scheme for making sure nested widgest overdraw parent widgets graphics

This commit is contained in:
Robert Osfield
2014-05-23 15:00:49 +00:00
parent 55c2041d4d
commit cca18e82e8
6 changed files with 30 additions and 14 deletions

View File

@@ -32,8 +32,6 @@ Dialog::Dialog(const osgUI::Dialog& dialog, const osg::CopyOp& copyop):
bool Dialog::handleImplementation(osgGA::EventVisitor* ev, osgGA::Event* event)
{
OSG_NOTICE<<"Dialog::handleImplementation"<<std::endl;
osgGA::GUIEventAdapter* ea = event->asGUIEventAdapter();
if (!ea) return false;
@@ -80,10 +78,6 @@ void Dialog::createGraphicsImplementation()
float titleHeight = 1.0;
osg::BoundingBox titleBarExents(_extents.xMin(), _extents.yMax(), _extents.zMin(), _extents.xMax(), _extents.yMax()+titleHeight, _extents.zMin());
osg::ref_ptr<Node> node = style->createText(titleBarExents, getAlignmentSettings(), getTextSettings(), _title);
_titleDrawable = dynamic_cast<osgText::Text*>(node.get());
_titleDrawable->setDataVariance(osg::Object::DYNAMIC);
_transform->addChild(_titleDrawable.get());
osg::Vec4 dialogBackgroundColor(0.8,0.8,0.8,1.0);
osg::Vec4 dialogTitleBackgroundColor(0.5,0.5,1.0,1.0);
@@ -91,5 +85,12 @@ void Dialog::createGraphicsImplementation()
_transform->addChild( style->createPanel(_extents, dialogBackgroundColor) );
_transform->addChild( style->createPanel(titleBarExents, dialogTitleBackgroundColor) );
osg::ref_ptr<Node> node = style->createText(titleBarExents, getAlignmentSettings(), getTextSettings(), _title);
_titleDrawable = dynamic_cast<osgText::Text*>(node.get());
_titleDrawable->setDataVariance(osg::Object::DYNAMIC);
_transform->addChild(_titleDrawable.get());
style->setupDialogStateSet(getOrCreateStateSet());
setGraphicsSubgraph(_transform.get());
}