float CocoWidget::getAbsoluteScaleY() { if (this->m_bScaleYDirty) { float scaleY = this->getScaleY(); CocoWidget* parent = this->getWidgetParent(); while (parent){ scaleY *= parent->getScaleY(); parent = parent->getWidgetParent(); } this->m_fAbsoluteScaleY = scaleY; this->m_bScaleYDirty = false; } return this->m_fAbsoluteScaleY; }
bool CocoWidget::getAbsoluteVisible() { if (this->m_bVisibleDirty) { CocoWidget* parent = this; bool visible = this->getVisible(); while (parent){ visible &= parent->getVisible(); if (!visible) { break; } parent = parent->getWidgetParent(); } this->m_bAbsoluteVisible = visible; this->m_bVisibleDirty = false; } return this->m_bAbsoluteVisible; }
bool CocoContainerWidget::addChild(CocoWidget* child) { CocoWidget::addChild(child); bool needSetChildCheckAble = false; CocoWidget* parent = this; while (parent != 0) { if (parent->getClipAble()) { needSetChildCheckAble = true; break; } parent = parent->getWidgetParent(); } if (needSetChildCheckAble) { child->setNeedCheckVisibleDepandParent(true); } return true; }