osgEarth 2.1.1
Public Member Functions | Private Attributes

osgEarth::Util::Controls::VBox Class Reference

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

List of all members.

Public Member Functions

 VBox ()
virtual void addControl (Control *control, int index=-1)
virtual const ControlListchildren () const
virtual void clearControls ()
virtual void calcSize (const ControlContext &context, osg::Vec2f &out_size)
virtual void calcFill (const ControlContext &context)
virtual void calcPos (const ControlContext &context, const osg::Vec2f &cursor, const osg::Vec2f &parentSize)
virtual void draw (const ControlContext &context, DrawableList &drawables)

Private Attributes

ControlList _controls

Detailed Description

Container that stacks controls vertically.

Definition at line 480 of file Controls.


Constructor & Destructor Documentation

VBox::VBox ( )

Definition at line 1233 of file Controls.cpp.

{
    //nop
}

Member Function Documentation

void VBox::addControl ( Control control,
int  index = -1 
) [virtual]

Implements osgEarth::Util::Controls::Container.

Definition at line 1239 of file Controls.cpp.

{
    if ( index < 0 )
        _controls.push_back( control );
    else
        _controls.insert( _controls.begin() + osg::minimum(index,(int)_controls.size()-1), control );
    control->setParent( this );

    applyChildAligns();
    dirty();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void VBox::calcFill ( const ControlContext context) [virtual]

Reimplemented from osgEarth::Util::Controls::Container.

Definition at line 1298 of file Controls.cpp.

{
    //Container::calcFill( cx );

    float used_x = padding().x();
    float used_y = padding().y() - childSpacing();

    Control* hc = 0L;
    Control* vc = 0L;

    for( ControlList::const_iterator i = _controls.begin(); i != _controls.end() && (!hc || !vc); ++i )
    {
        Control* child = i->get();

        used_y += child->margin().y() + childSpacing();
        if ( !hc && child->horizFill() )
        {
            hc = child;
            used_x += child->margin().x();
        }

        if ( !vc && child->vertFill() )
            vc = child;
        else
            used_y += child->renderSize().y();
    }

    if ( hc && renderWidth(hc) < (_renderSize.x() - used_x) )
        renderWidth(hc) = _renderSize.x() - used_x;

    if ( vc && renderHeight(vc) < (_renderSize.y() - used_y) )
        renderHeight(vc) = _renderSize.y() - used_y;
   
    Container::calcFill( cx );
}

Here is the call graph for this function:

void VBox::calcPos ( const ControlContext context,
const osg::Vec2f &  cursor,
const osg::Vec2f &  parentSize 
) [virtual]

Reimplemented from osgEarth::Util::Controls::Container.

Definition at line 1335 of file Controls.cpp.

{
    Container::calcPos( cx, cursor, parentSize );

    osg::Vec2f childCursor = _renderPos;

    osg::Vec2f renderArea = _renderSize - padding().size();

    for( ControlList::const_iterator i = _controls.begin(); i != _controls.end(); ++i )
    {
        Control* child = i->get();
        child->calcPos( cx, childCursor, renderArea ); // GW1
        float deltaY = child->margin().top() + child->renderSize().y() + child->margin().bottom() + childSpacing();
        childCursor.y() += deltaY;
        renderArea.y() -= deltaY;
    }
}

Here is the call graph for this function:

void VBox::calcSize ( const ControlContext context,
osg::Vec2f &  out_size 
) [virtual]

Reimplemented from osgEarth::Util::Controls::Container.

Definition at line 1259 of file Controls.cpp.

{
    if ( visible() == true )
    {
        _renderSize.set( 0, 0 );

        // collect all the members, growing the container size vertically
        for( ControlList::const_iterator i = _controls.begin(); i != _controls.end(); ++i )
        {
            Control* child = i->get();
            osg::Vec2f childSize;
            bool first = i == _controls.begin();

            child->calcSize( cx, childSize );

            _renderSize.x() = osg::maximum( _renderSize.x(), childSize.x() );
            _renderSize.y() += first ? childSize.y() : childSpacing() + childSize.y();
        }

        _renderSize.set(
            _renderSize.x() + padding().x(),
            _renderSize.y() + padding().y() );

        // process fills:


        out_size.set(
            _renderSize.x() + margin().x(),
            _renderSize.y() + margin().y() );

        Container::calcSize( cx, out_size );
    }
    else
    {
        out_size.set(0,0);
    }
}

Here is the call graph for this function:

virtual const ControlList& osgEarth::Util::Controls::VBox::children ( ) const [inline, virtual]

Implements osgEarth::Util::Controls::Container.

Definition at line 487 of file Controls.

{ return _controls; }
void VBox::clearControls ( ) [virtual]

Implements osgEarth::Util::Controls::Container.

Definition at line 1252 of file Controls.cpp.

{
    _controls.clear();
    dirty();
}

Here is the call graph for this function:

void VBox::draw ( const ControlContext context,
DrawableList drawables 
) [virtual]

Reimplemented from osgEarth::Util::Controls::Container.

Definition at line 1354 of file Controls.cpp.

{
    if ( visible() == true )
    {
        Container::draw( cx, out );
        for( ControlList::const_iterator i = _controls.begin(); i != _controls.end(); ++i )
            i->get()->draw( cx, out );
    }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 497 of file Controls.


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