osgEarth 2.1.1
|
Public Member Functions | |
Frame () | |
virtual void | calcPos (const ControlContext &context, const osg::Vec2f &cursor, const osg::Vec2f &parentSize) |
virtual void | draw (const ControlContext &context, DrawableList &drawables) |
A control that renders a simple rectangular border for a container. This is also the base class for all Frame objects.
Frame::Frame | ( | ) |
Definition at line 1005 of file Controls.cpp.
{ setPadding( 0 ); }
void Frame::calcPos | ( | const ControlContext & | context, |
const osg::Vec2f & | cursor, | ||
const osg::Vec2f & | parentSize | ||
) | [virtual] |
Reimplemented from osgEarth::Util::Controls::Control.
Definition at line 1011 of file Controls.cpp.
{ _renderPos = cursor; }
void Frame::draw | ( | const ControlContext & | context, |
DrawableList & | drawables | ||
) | [virtual] |
Reimplemented from osgEarth::Util::Controls::ImageControl.
Reimplemented in osgEarth::Util::Controls::RoundedFrame.
Definition at line 1017 of file Controls.cpp.
{ if ( !getImage() || getImage()->s() != _renderSize.x() || getImage()->t() != _renderSize.y() ) { // a simple colored border frame osg::ref_ptr<Geometry> geom = new Ring(); geom->push_back( osg::Vec3d( 0, 0, 0 ) ); geom->push_back( osg::Vec3d( _renderSize.x()-1, 0, 0 ) ); geom->push_back( osg::Vec3d( _renderSize.x()-1, _renderSize.y()-1, 0 ) ); geom->push_back( osg::Vec3d( 0, _renderSize.y()-1, 0 ) ); Style style; LineSymbol* line = style.getOrCreate<LineSymbol>(); line->stroke()->color() = Color::White; line->stroke()->width() = 2.5f; GeometryRasterizer ras( (int)_renderSize.x(), (int)_renderSize.y(), style ); ras.draw( geom.get() ); osg::Image* image = ras.finalize(); const_cast<Frame*>(this)->setImage( image ); } Control::draw( cx, out ); // draws the background ImageControl::draw( cx, out ); // draws the border }