GWidget* GWidget::findChild( int id , GWidget* start ) { GWidget* child = ( start ) ? nextChild( start ) : getChild(); while( child ) { if ( child->getID() == id ) return child; child = nextChild( child ); } return NULL; }
void Composite::draw() { glPushMatrix(); for (int i = 0; i < children.size(); i++) { if (currentDepth < globalSize) { // Draw big bounding box glPushMatrix(); glColor4f(color[0], color[1], color[2], color[3]); glTranslatef(_padding*SCALE, -_padding*SCALE, 0); #ifdef BOX_3D DrawBox(children[i]->getWidth(), -children[i]->getHeight(), globalDepth); #else DrawRectangle(children[i]->getWidth(), -children[i]->getHeight(), globalDepth); #endif glPopMatrix(); } // Draw children glPushMatrix(); currentDepth++; if (currentDepth <= globalSize) glTranslatef(_padding*SCALE, -_padding*SCALE, globalDepth); children[i]->draw(); currentDepth--; glPopMatrix(); nextChild(*children[i]); } glPopMatrix(); }
void TUICore<T>::removeChildFlag( unsigned flag ) { TUICore* ui = getChild(); while( ui ) { ui->_removeFlag( flag ); ui->removeChildFlag( flag ); ui = nextChild( ui ); } }
void TUICore<T>::addChildFlag( unsigned flag ) { TUICore* ui = getChild(); while( ui ) { ui->_addFlag( flag ); ui->addChildFlag( flag ); ui = nextChild( ui ); } }
void TUICore<T>::setManager( TUIManager<T>* mgr ) { mManager = mgr; TUICore* ui = getChild(); while ( ui ) { ui->setManager( mgr ); ui = nextChild( ui ); } }
void GWidget::doRenderAll() { if ( mClipEnable ) { Vec2i pos = getWorldPos(); Vec2i size = getSize(); pos.y = getGame()->getScreenSize().y - ( pos.y + size.y ); gClipStack.push( pos , size , true ); } TUICore< GWidget >::doRenderAll(); GWidget* ui = getChild(); while( ui ) { ui->onRenderSiblingsEnd(); ui = nextChild( ui ); } if ( mClipEnable ) { gClipStack.pop(); } }