osgEarth 2.1.1
|
Public Member Functions | |
Container () | |
void | setFrame (Frame *frame) |
Frame * | getFrame () 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 ControlList & | children () 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 | |
ControlList & | mutable_children () |
Private Attributes | |
osg::ref_ptr< Frame > | _frame |
float | _spacing |
optional< Alignment > | _childhalign |
optional< Alignment > | _childvalign |
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.
Container::Container | ( | ) |
Definition at line 1089 of file Controls.cpp.
: _spacing( 1 ) { //nop }
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.
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() ); } }
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(); } }
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 ); } }
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 ); } }
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; } }
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.
float osgEarth::Util::Controls::Container::childSpacing | ( | ) | const [inline] |
Definition at line 439 of file Controls.
{ return _childvalign; }
virtual void osgEarth::Util::Controls::Container::clearControls | ( | ) | [pure virtual] |
Implemented in osgEarth::Util::Controls::VBox, osgEarth::Util::Controls::HBox, and osgEarth::Util::Controls::Grid.
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 ); } }
Frame* osgEarth::Util::Controls::Container::getFrame | ( | ) | const [inline] |
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 ); }
ControlList& osgEarth::Util::Controls::Container::mutable_children | ( | ) | [inline, private] |
Definition at line 474 of file Controls.
{ return const_cast<ControlList&>(children()); }
float& osgEarth::Util::Controls::Container::renderHeight | ( | Control * | child | ) | [inline, protected] |
float& osgEarth::Util::Controls::Container::renderWidth | ( | Control * | child | ) | [inline, protected] |
void Container::setChildHorizAlign | ( | Alignment | align | ) |
Definition at line 1114 of file Controls.cpp.
{ if ( !_childhalign.isSet() || _childhalign != value ) { _childhalign = value; applyChildAligns(); } }
void Container::setChildSpacing | ( | float | value | ) |
Definition at line 1105 of file Controls.cpp.
void Container::setChildVertAlign | ( | Alignment | align | ) |
Definition at line 1124 of file Controls.cpp.
{ if ( !_childvalign.isSet() || _childvalign != value ) { _childvalign = value; applyChildAligns(); } }
void Container::setFrame | ( | Frame * | frame | ) |
Definition at line 1096 of file Controls.cpp.
osg::ref_ptr<Frame> osgEarth::Util::Controls::Container::_frame [private] |
float osgEarth::Util::Controls::Container::_spacing [private] |