mirror of
https://github.com/edubart/otclient.git
synced 2025-04-30 09:39:21 +02:00
optimize UIWidget for largers NPC trades
This commit is contained in:
parent
ec9ea9e33d
commit
3f689e0edf
@ -133,6 +133,8 @@ void UIWidget::addChild(const UIWidgetPtr& child)
|
||||
return;
|
||||
}
|
||||
|
||||
UIWidgetPtr oldLastChild = getLastChild();
|
||||
|
||||
m_children.push_back(child);
|
||||
child->setParent(asUIWidget());
|
||||
|
||||
@ -145,7 +147,12 @@ void UIWidget::addChild(const UIWidgetPtr& child)
|
||||
|
||||
// update new child states
|
||||
child->updateStates();
|
||||
updateChildrenIndexStates();
|
||||
|
||||
// update old child index states
|
||||
if(oldLastChild) {
|
||||
oldLastChild->updateState(Fw::MiddleState);
|
||||
oldLastChild->updateState(Fw::LastState);
|
||||
}
|
||||
|
||||
g_ui.onWidgetAppear(child);
|
||||
}
|
||||
@ -714,8 +721,15 @@ void UIWidget::destroyChildren()
|
||||
if(layout)
|
||||
layout->disableUpdates();
|
||||
|
||||
while(!m_children.empty())
|
||||
m_children[0]->destroy();
|
||||
m_focusedChild = nullptr;
|
||||
m_lockedChildren.clear();
|
||||
while(!m_children.empty()) {
|
||||
UIWidgetPtr child = m_children.front();
|
||||
m_children.pop_front();
|
||||
child->setParent(nullptr);
|
||||
m_layout->removeWidget(child);
|
||||
child->destroy();
|
||||
}
|
||||
|
||||
layout->enableUpdates();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user