osgEarth 2.1.1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

osgEarth::Util::Controls::Container Class Reference

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

List of all members.

Public Member Functions

 Container ()
void setFrame (Frame *frame)
FramegetFrame () const
void setChildSpacing (float value)
float childSpacing () const
void setChildHorizAlign (Alignment align)
const optional< Alignment > & childHorizAlign () const
void setChildVertAlign (Alignment align)
const optional< Alignment > & childVertAlign () const
virtual void addControl (Control *control, int index=-1)=0
virtual void addControls (const ControlVector &controls)
virtual const ControlListchildren () const =0
virtual void clearControls ()=0
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)

Protected Member Functions

virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, ControlContext &cx)
void applyChildAligns ()
float & renderWidth (Control *child)
float & renderHeight (Control *child)

Private Member Functions

ControlListmutable_children ()

Private Attributes

osg::ref_ptr< Frame_frame
float _spacing
optional< Alignment_childhalign
optional< Alignment_childvalign

Detailed Description

Container is a control that houses child controls. This is the base class for all containers. (It is abstract so cannot be used directly) Containers are control, so you can nest them in other containers.

Definition at line 420 of file Controls.


Constructor & Destructor Documentation

Container::Container ( )

Definition at line 1089 of file Controls.cpp.

                     :
_spacing( 1 )
{
    //nop
}

Member Function Documentation

virtual void osgEarth::Util::Controls::Container::addControl ( Control control,
int  index = -1 
) [pure virtual]

Implemented in osgEarth::Util::Controls::VBox, osgEarth::Util::Controls::HBox, and osgEarth::Util::Controls::Grid.

Here is the caller graph for this function:

void Container::addControls ( const ControlVector controls) [virtual]

Reimplemented in osgEarth::Util::Controls::Grid.

Definition at line 1223 of file Controls.cpp.

{
    for( ControlVector::const_iterator i = controls.begin(); i != controls.end(); ++i )
    {
        addControl( i->get() );
    }
}

Here is the call graph for this function:

void Container::applyChildAligns ( ) [protected]

Definition at line 1134 of file Controls.cpp.

{
    if ( _childhalign.isSet() || _childvalign.isSet() )
    {
        for( ControlList::iterator i = mutable_children().begin(); i != mutable_children().end(); ++i )
        {
            Control* child = i->get();

            if ( _childvalign.isSet() && !child->vertAlign().isSet() )
                child->setVertAlign( *_childvalign );

            if ( _childhalign.isSet() && !child->horizAlign().isSet() )
                child->setHorizAlign( *_childhalign );
        }

        dirty();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from osgEarth::Util::Controls::Control.

Reimplemented in osgEarth::Util::Controls::VBox, osgEarth::Util::Controls::HBox, and osgEarth::Util::Controls::Grid.

Definition at line 1174 of file Controls.cpp.

{
    for( ControlList::iterator i = mutable_children().begin(); i != mutable_children().end(); ++i )
    {
        Control* child = i->get();
        child->calcFill( cx );
    }
}

Here is the call graph for this function:

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

Reimplemented from osgEarth::Util::Controls::Control.

Reimplemented in osgEarth::Util::Controls::VBox, osgEarth::Util::Controls::HBox, and osgEarth::Util::Controls::Grid.

Definition at line 1184 of file Controls.cpp.

{
    Control::calcPos( context, cursor, parentSize );

    // process the frame.. it's not a child of the container
    if ( visible() == true && _frame.valid() )
    {
        _frame->calcPos( context, _renderPos - padding().offset(), parentSize );
    }
}

Here is the call graph for this function:

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

Reimplemented from osgEarth::Util::Controls::Control.

Reimplemented in osgEarth::Util::Controls::VBox, osgEarth::Util::Controls::HBox, and osgEarth::Util::Controls::Grid.

Definition at line 1154 of file Controls.cpp.

{
    if ( visible() == true )
    {
        if ( _frame.valid() )
        {
            _frame->setWidth( _renderSize.x() );
            _frame->setHeight( _renderSize.y() );

            osg::Vec2f dummy;
            _frame->calcSize( cx, dummy );
        }

        // no need to set the output vars.

        //_dirty = false;
    }
}

Here is the call graph for this function:

const optional<Alignment>& osgEarth::Util::Controls::Container::childHorizAlign ( ) const [inline]

Definition at line 435 of file Controls.

{ return _childhalign; }
virtual const ControlList& osgEarth::Util::Controls::Container::children ( ) const [pure virtual]

Implemented in osgEarth::Util::Controls::VBox, osgEarth::Util::Controls::HBox, and osgEarth::Util::Controls::Grid.

Here is the caller graph for this function:

float osgEarth::Util::Controls::Container::childSpacing ( ) const [inline]

Definition at line 431 of file Controls.

{ return _spacing; }

Here is the caller graph for this function:

const optional<Alignment>& osgEarth::Util::Controls::Container::childVertAlign ( ) const [inline]

Definition at line 439 of file Controls.

{ return _childvalign; }
virtual void osgEarth::Util::Controls::Container::clearControls ( ) [pure virtual]
void Container::draw ( const ControlContext context,
DrawableList drawables 
) [virtual]

Reimplemented from osgEarth::Util::Controls::Control.

Reimplemented in osgEarth::Util::Controls::VBox, osgEarth::Util::Controls::HBox, and osgEarth::Util::Controls::Grid.

Definition at line 1196 of file Controls.cpp.

{
    if ( visible() == true )
    {
        Control::draw( cx, out );
        if ( _frame.valid() )
            _frame->draw( cx, out );
    }
}

Here is the call graph for this function:

Frame* osgEarth::Util::Controls::Container::getFrame ( ) const [inline]

Definition at line 427 of file Controls.

{ return _frame.get(); }

Here is the caller graph for this function:

bool Container::handle ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  aa,
ControlContext cx 
) [protected, virtual]

Reimplemented from osgEarth::Util::Controls::Control.

Definition at line 1207 of file Controls.cpp.

{
    bool handled = false;
    for( ControlList::const_reverse_iterator i = children().rbegin(); i != children().rend(); ++i )
    {
        Control* child = i->get();
        if (ea.getEventType() == osgGA::GUIEventAdapter::FRAME || child->intersects( ea.getX(), cx._vp->height() - ea.getY() ) )
            handled = child->handle( ea, aa, cx );
        if ( handled )
            break;
    }

    return handled ? handled : Control::handle( ea, aa, cx );
}

Here is the call graph for this function:

ControlList& osgEarth::Util::Controls::Container::mutable_children ( ) [inline, private]

Definition at line 474 of file Controls.

{ return const_cast<ControlList&>(children()); }

Here is the caller graph for this function:

float& osgEarth::Util::Controls::Container::renderHeight ( Control child) [inline, protected]

Definition at line 466 of file Controls.

{ return child->_renderSize.y(); }

Here is the caller graph for this function:

float& osgEarth::Util::Controls::Container::renderWidth ( Control child) [inline, protected]

Definition at line 465 of file Controls.

{ return child->_renderSize.x(); }

Here is the caller graph for this function:

void Container::setChildHorizAlign ( Alignment  align)

Definition at line 1114 of file Controls.cpp.

{
    if ( !_childhalign.isSet() || _childhalign != value )
    {
        _childhalign = value;
        applyChildAligns();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Container::setChildSpacing ( float  value)

Definition at line 1105 of file Controls.cpp.

{
    if ( value != _spacing ) {
        _spacing = value;
        dirty();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Container::setChildVertAlign ( Alignment  align)

Definition at line 1124 of file Controls.cpp.

{
    if ( !_childvalign.isSet() || _childvalign != value )
    {
        _childvalign = value;
        applyChildAligns();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Container::setFrame ( Frame frame)

Definition at line 1096 of file Controls.cpp.

{
    if ( frame != _frame.get() ) {
        _frame = frame;
        dirty();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 471 of file Controls.

Definition at line 472 of file Controls.

Definition at line 469 of file Controls.

Definition at line 470 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