Merge branch '1.21' into new-container-api
This commit is contained in:
commit
70ed0cfcba
@ -847,6 +847,12 @@ open class EditablePanel<out S : Screen>(
|
||||
childrenSortingInvalidated = true
|
||||
}
|
||||
|
||||
protected open fun onChildrenAdded(child: EditablePanel<*>) {}
|
||||
protected open fun onChildrenRemoved(child: EditablePanel<*>) {}
|
||||
|
||||
protected open fun onParented(parent: EditablePanel<*>) {}
|
||||
protected open fun onUnParented(parent: EditablePanel<*>) {}
|
||||
|
||||
private fun onParent(child: EditablePanel<*>) {
|
||||
if (childrenInternal.contains(child)) throw IllegalStateException("Already containing $child")
|
||||
childrenInternal.add(child)
|
||||
@ -864,11 +870,15 @@ open class EditablePanel<out S : Screen>(
|
||||
else
|
||||
updateVisibility = true
|
||||
}
|
||||
|
||||
onChildrenAdded(child)
|
||||
child.onParented(this)
|
||||
}
|
||||
|
||||
private fun onUnParent(child: EditablePanel<*>) {
|
||||
val indexOf = childrenInternal.indexOf(child)
|
||||
if (indexOf == -1) throw IllegalStateException("Already not containing $child")
|
||||
child.onUnParented(this)
|
||||
childrenInternal.removeAt(indexOf)
|
||||
invalidateChildrenSorting()
|
||||
|
||||
@ -880,6 +890,8 @@ open class EditablePanel<out S : Screen>(
|
||||
if (child.isVisible() != isVisible()) {
|
||||
updateVisible()
|
||||
}
|
||||
|
||||
onChildrenRemoved(child)
|
||||
}
|
||||
|
||||
private fun sortChildren() {
|
||||
|
Loading…
Reference in New Issue
Block a user