app :: ListLayout
app :: ListLayout :: defaultinit
app :: ListLayout :: native=
app :: ListLayout :: native=
app :: ListLayout :: native=
app :: ListLayout :: native_list_box=
Container insidenative
app :: ListLayout :: native_rows
GtkListBoxRow
used to contains children View
s
app :: ListLayout :: native_rows=
GtkListBoxRow
used to contains children View
s
app :: ListLayout :: native_stack_view
Real container of the subviews, contained withinnative
app :: ListLayout :: native_stack_view=
Real container of the subviews, contained withinnative
ios :: ui $ ListLayout :: NATIVE
Type of thenative
implementation of this control
app $ ListLayout :: SELF
Type of this instance, automatically specialized in every classlinux :: ui $ ListLayout :: init
ios :: ui $ ListLayout :: parent=
Direct parentControl
in the control tree
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
app :: ListLayout :: defaultinit
app :: CompositeControl :: defaultinit
app :: AppObserver :: defaultinit
app :: AppComponent :: defaultinit
core :: Object :: defaultinit
app :: View :: defaultinit
gtk :: GtkCallable :: defaultinit
core :: Finalizable :: defaultinit
app :: Control :: defaultinit
core :: Finalizable :: finalize
Liberate any resources held byself
before the memory holding self
is freed
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
app :: ListLayout :: native=
app :: ListLayout :: native=
app :: ListLayout :: native=
app :: ListLayout :: native_list_box=
Container insidenative
app :: ListLayout :: native_rows
GtkListBoxRow
used to contains children View
s
app :: ListLayout :: native_rows=
GtkListBoxRow
used to contains children View
s
app :: ListLayout :: native_stack_view
Real container of the subviews, contained withinnative
app :: ListLayout :: native_stack_view=
Real container of the subviews, contained withinnative
app :: AppComponent :: notify_observers
Propagateevent
to all observers
by calling AppObserver::on_event
app :: AppComponent :: observers
AllAppObserver
notified of events raised by self
app :: AppComponent :: observers=
AllAppObserver
notified of events raised by self
app :: AppComponent :: on_pause
The application leaves the active state but is still partially visibleapp :: AppComponent :: on_restart
The application returns to a visible state from a previouson_stop
app :: AppComponent :: on_restore_state
The application is launching, restore its state from a previouson_save_state
app :: AppComponent :: on_resume
The application enters the active state, it is in the foreground and interactiveapp :: AppComponent :: on_save_state
The application may be destroyed soon, save its state for a futureon_restore_state
app :: AppComponent :: on_start
The application is starting or restarting, it is visible to the usercore :: Object :: output_class_name
Display class name on stdout (debug only).Control
in the control tree
Control
in the control tree
app :: AppComponent
An element of an application that is notified of the application life cyclegtk :: GtkCallable
# Scrollable list of views in a simple list
class ListLayout
super View
super CompositeControl
end
lib/app/ui.nit:327,1--331,3
# On iOS, implemented by a `UIStackView` inside a ` UIScrollView`
redef class ListLayout
redef type NATIVE: UIScrollView
redef var native = new UIScrollView
# Real container of the subviews, contained within `native`
var native_stack_view = new UIStackView
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
# Add constraints to lock the vertical and horizontal dimensions
private fun native_add_constraints(root_view: UIView, nested_view: UIView)
in "ObjC" `{
[root_view addConstraints:[NSLayoutConstraint
constraintsWithVisualFormat: @"V:|-0-[nested_view]-0-|"
options: NSLayoutFormatAlignAllCenterX metrics: nil views: @{@"nested_view": nested_view}]];
[root_view addConstraints:[NSLayoutConstraint
constraintsWithVisualFormat: @"H:|-0-[nested_view]-0-|"
options: NSLayoutFormatAlignAllCenterX metrics: nil views: @{@"nested_view": nested_view}]];
`}
# Add a constraint to lock to the scroll vertically
private fun native_lock_vertical_scroll(scroll_view: UIScrollView, stack_view: UIStackView)
in "ObjC" `{
[scroll_view addConstraint: [scroll_view.widthAnchor constraintEqualToAnchor:stack_view.widthAnchor]];
`}
redef fun add(view)
do
super
if view isa View then
native_stack_view.add_arranged_subview view.native
end
end
end
lib/ios/ui/ui.nit:438,1--496,3
# On GNU/Linux, this is implemented by a `GtkListBox` inside a `GtkScrolledWindow`
redef class ListLayout
redef type NATIVE: GtkScrolledWindow
redef var native = new GtkScrolledWindow
# Container inside `native`
var native_list_box = new GtkListBox
# `GtkListBoxRow` used to contains children `View`s
var native_rows = new Map[View, GtkListBoxRow]
init do
native_list_box.selection_mode = new GtkSelectionMode.none
native.add native_list_box
# Set the size of the GtkScrolledWindow:
# use content width and set static height
native.set_policy(new GtkPolicyType.never, new GtkPolicyType.automatic)
native.set_size_request(gtk_window_width_request, 640)
end
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
redef fun remove(item)
do
super
if item isa View then
var native_row = native_rows.get_or_null(item)
if native_row == null then
print_error "Error: {self} does not contains {item}"
return
end
native_list_box.remove native_row
native_rows.keys.remove item
native_row.destroy
end
end
end
lib/linux/ui.nit:185,1--238,3
redef class ListLayout
redef type NATIVE: Android_widget_ListView
redef var native do
var layout = new Android_widget_ListView(app.native_activity)
layout = layout.new_global_ref
return layout
end
private var adapter: Android_widget_ArrayAdapter do
var adapter = new Android_widget_ArrayAdapter(app.native_activity,
android_r_layout_simple_list_item_1, self)
native.set_adapter adapter
return adapter.new_global_ref
end
redef fun add(item)
do
super
if item isa View then adapter.add item.native
end
private fun create_view(position: Int): NativeView
do
var ctrl = items[position]
assert ctrl isa View
return ctrl.native
end
end
lib/android/ui/ui.nit:177,1--205,3