/// Creates a new UIView, names it and attaches it as a child, then returns it UIView* UIView::createChild(const String& name) { // Instance a new view UIView* view = new UIView(); view->setName(name); view->setPosition(getPosition()); //view->addComponent(new UIComponentDebugColor(Color(100,100,100,100))); // Attach attach(view); return view; }
void UIComponentTreeView::updateItemPositions() { float offset_y = 0.f; for(size_t i = 0; i < mParent->getChildCount(); ++i) { UIView* child = mParent->getChild(i); child->setPosition(child->getPosition().x, mParent->getPosition().y + offset_y); offset_y += child->getSize().y + 2.f; if(mSubTreeView) { Log("Child %d sizeY %f stays at %f", i, child->getSize().y, child->getPosition().y); } } }