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
|
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<*>) {
|
private fun onParent(child: EditablePanel<*>) {
|
||||||
if (childrenInternal.contains(child)) throw IllegalStateException("Already containing $child")
|
if (childrenInternal.contains(child)) throw IllegalStateException("Already containing $child")
|
||||||
childrenInternal.add(child)
|
childrenInternal.add(child)
|
||||||
@ -864,11 +870,15 @@ open class EditablePanel<out S : Screen>(
|
|||||||
else
|
else
|
||||||
updateVisibility = true
|
updateVisibility = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChildrenAdded(child)
|
||||||
|
child.onParented(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onUnParent(child: EditablePanel<*>) {
|
private fun onUnParent(child: EditablePanel<*>) {
|
||||||
val indexOf = childrenInternal.indexOf(child)
|
val indexOf = childrenInternal.indexOf(child)
|
||||||
if (indexOf == -1) throw IllegalStateException("Already not containing $child")
|
if (indexOf == -1) throw IllegalStateException("Already not containing $child")
|
||||||
|
child.onUnParented(this)
|
||||||
childrenInternal.removeAt(indexOf)
|
childrenInternal.removeAt(indexOf)
|
||||||
invalidateChildrenSorting()
|
invalidateChildrenSorting()
|
||||||
|
|
||||||
@ -880,6 +890,8 @@ open class EditablePanel<out S : Screen>(
|
|||||||
if (child.isVisible() != isVisible()) {
|
if (child.isVisible() != isVisible()) {
|
||||||
updateVisible()
|
updateVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChildrenRemoved(child)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun sortChildren() {
|
private fun sortChildren() {
|
||||||
|
Loading…
Reference in New Issue
Block a user