+ 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