osgEarth 2.1.1
Public Member Functions

osgEarth::Util::Controls::Frame Class Reference

Inheritance diagram for osgEarth::Util::Controls::Frame:
Collaboration diagram for osgEarth::Util::Controls::Frame:

List of all members.

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)

Detailed Description

A control that renders a simple rectangular border for a container. This is also the base class for all Frame objects.

Definition at line 393 of file Controls.


Constructor & Destructor Documentation

Frame::Frame ( )

Definition at line 1005 of file Controls.cpp.

{
    setPadding( 0 );
}

Here is the call graph for this function:


Member Function Documentation

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
}

Here is the call graph for this function:


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines