ListBoxBase(const std::string& name): osgWidget::Frame(name), _lineColor (0.0f, 0.0f, 0.1f), _fillColor (0.7f, 0.8f, 0.8f), _lineWidth (1.0f), _fontSize (10) { std::ostringstream font; font << "Bitstream Vera Sans " << _fontSize; _font = new osgPairo::Font(font.str().c_str()); ButtonTheme* bt = new ButtonTheme(); bt->renderTheme( 8.0f, _lineWidth, osgWidget::Color(_lineColor, 1.0f), osgWidget::Color(_fillColor, 1.0f) ); createSimpleFrameWithSingleTexture(bt, 200.0f, 15.0f); setFlags(osgWidget::Frame::FRAME_TEXTURE); getBackground()->setColor(0.0f, 0.0f, 0.0f, 0.0f); getGeode()->getOrCreateStateSet()->setAttributeAndModes( new osg::BlendFunc(osg::BlendFunc::ONE, osg::BlendFunc::ONE_MINUS_SRC_ALPHA) ); }
Frame* Frame::createSimpleFrameFromTheme( const std::string& name, osg::ref_ptr<osg::Image> image, point_type width, point_type height, unsigned int flags, Frame* exFrame ) { osg::ref_ptr<osg::Image> natifImage = createNatifEdgeImageFromTheme(image.get()); Frame* frame; frame = createSimpleFrameWithSingleTexture(name, natifImage.get(), width, height, flags, exFrame); if (frame && image && natifImage.valid()) { const unsigned int bpps = image->getPixelSizeInBits() / 8; const unsigned int one_third_s = image->s()/3; unsigned char* srcdata = (unsigned char*)image->data(); osg::Vec4 color(0,0,0,1); for (unsigned int d = 0; d < bpps; d++) { color[d] = srcdata[one_third_s * image->s() * bpps + (one_third_s) * bpps + d] * 1.0/255.0; } frame->getEmbeddedWindow()->setColor(color); } return frame; }