int wyNode::insertChild(wyNode* n, int z) { // insert or push int index = wyArrayIndexOf(m_children, n, zOrderLocator, &z); if(index == -1) wyArrayPush(m_children, n); else wyArrayInsert(m_children, n, index); // save z order and parent n->m_zOrder = z; n->m_parent = this; return index; }
void wyPageControl::addPageAt(wyNode* page, int index) { if(index < 0 || index > m_pages->num) return; wyArrayInsert(m_pages, page, index); page->retain(); m_container->addChildLocked(page); updatePagePositions(); // notify indicator if(m_indicator) m_indicator->onPageAdded(index); // ensure page position changed is set notifyOnPagePositionChanged(); }