Add item as a child of self

Property definitions

app $ CompositeControl :: add
	# Add `item` as a child of `self`
	protected fun add(item: Control) do items.add item
lib/app/ui.nit:177,2--178,51

ios :: ui $ Window :: add
	redef fun add(view)
	do
		super

		var native_view = view.native
		assert native_view isa UIView

		if view isa ListLayout then
			native.view.add_subview native_view
		else native.view = native_view
	end
lib/ios/ui/ui.nit:217,2--227,4

linux :: ui $ Window :: add
	redef fun add(view)
	do
		if view isa View then
			self.view = view
			view.native.valign = new GtkAlign.start
			view.native.set_size_request(gtk_window_width_request, 0)
		end

		super
	end
lib/linux/ui.nit:127,2--136,4

android :: ui $ Window :: add
	redef fun add(item)
	do
		if item isa View then view = item
		super
	end
lib/android/ui/ui.nit:116,2--120,4

ios $ TableView :: add
	redef fun add(item)
	do
		# Adding a view to a UITableView is a bit tricky.
		#
		# Items are added to the Objective-C view only by callbacks.
		# We must store the sub views in local lists while waiting
		# for the callbacks.
		#
		# As usual, we keep the Nity object in `items`.
		# But we also keep their native counterparts in a list of
		# the `UITableViewAndDataSource` set as `native.delegate`.
		# Otherwise the native views could be freed by the Objective-C GC.

		# TODO use an adapter for the app.nit ListLayout closer to what exists
		# on both iOS and Android, to support large data sets.

		if item isa View then
			add_view_to_native_list(native, item.native)
		end

		super

		# Force redraw and trigger callbacks
		native.reload_data
	end
lib/ios/ui/ui.nit:511,2--535,4

ios :: ui $ Layout :: add
	redef fun add(view)
	do
		super

		var native_view = view.native
		assert native_view isa UIView
		self.native.add_arranged_subview native_view
	end
lib/ios/ui/ui.nit:240,2--247,4

linux :: ui $ Layout :: add
	redef fun add(item)
	do
		super
		if item isa View then native.add item.native
	end
lib/linux/ui.nit:149,2--153,4

android :: ui $ Layout :: add
	redef fun add(item)
	do
		super

		assert item isa View

		# FIXME abstract the use either homogeneous or weight to balance views size in a layout
		native.add_view_with_weight(item.native, 1.0)
	end
lib/android/ui/ui.nit:142,2--150,4

ios :: ui $ ListLayout :: add
	redef fun add(view)
	do
		super

		if view isa View then
			native_stack_view.add_arranged_subview view.native
		end
	end
lib/ios/ui/ui.nit:488,2--495,4

linux :: ui $ ListLayout :: add
	redef fun add(item)
	do
		super
		if item isa View then
			var native_row = new GtkListBoxRow
			#native_row.activable = false # TODO with GTK 3.14
			#native_row.selectable = false
			native_row.add item.native

			native_rows[item] = native_row
			native_list_box.add native_row
			native_row.show
		end
	end
lib/linux/ui.nit:208,2--221,4

android :: ui $ ListLayout :: add
	redef fun add(item)
	do
		super
		if item isa View then adapter.add item.native
	end
lib/android/ui/ui.nit:193,2--197,4

linux :: ui $ HorizontalLayout :: add
	redef fun add(item)
	do
		super
		# FIXME abstract the use either homogeneous or weight to balance views size in a layout
		native.homogeneous = true
		native.set_child_packing(item.native, true, true, 0, new GtkPackType.start)
	end
lib/linux/ui.nit:165,2--171,4

linux :: ui $ VerticalLayout :: add
	redef fun add(item)
	do
		super

		native.set_child_packing(item.native, true, true, 0, new GtkPackType.start)
	end
lib/linux/ui.nit:177,2--182,4