# Direct parent `Control` in the control tree
#
# The parents (direct and indirect) receive all events from `self`,
# like the `observers`.
#
# Setting `parent` calls `remove` on the old parent and `add` on the new one.
fun parent=(parent: nullable CompositeControl)
is autoinit do
var old_parent = self.parent
if old_parent != null and old_parent != parent then
old_parent.remove self
end
if parent != null then parent.add self
set_parent parent
end
lib/app/ui.nit:139,2--155,4
redef fun parent=(parent)
do
super
var root_view
if parent isa Window then
root_view = parent.native.view
else if parent isa View then
root_view = parent.native
else return
# Setup scroll view
var native_scroll_view = native
native_scroll_view.translates_autoresizing_mask_into_constraits = false
native_add_constraints(root_view, native_scroll_view)
# Setup stack_view
native_stack_view.translates_autoresizing_mask_into_constraits = false
native_stack_view.axis = new UILayoutConstraintAxis.vertical
native_scroll_view.add_subview native_stack_view
native_add_constraints(native_scroll_view, native_stack_view)
native_lock_vertical_scroll(native_scroll_view, native_stack_view)
end
lib/ios/ui/ui.nit:447,2--469,4