Class: MG::List

Inherits:
Scroll show all
Defined in:
doc/API_reference.rb

Properties collapse

Attributes inherited from Scroll

#direction, #inner_container, #inner_size

Attributes inherited from Layout

#background_color, #clipping?, #type

Attributes inherited from Widget

#enabled?, #highlighted?, #touch_enabled?

Attributes inherited from Node

#alpha, #anchor_point, #color, #name, #position, #rotation, #scale, #size, #visible?, #z_index

Constructors collapse

Managing Items collapse

Selection collapse

Methods inherited from Widget

#on_touch

Methods inherited from Node

#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #parent, #run_action, #stop_action, #stop_all_actions

Constructor Details

#initializeList

Creates a new List widget.



1314
# File 'doc/API_reference.rb', line 1314

def initialize; end

Instance Attribute Details

#items_marginFloat

Returns the margin between items in the list.

Returns:

  • (Float)

    the margin between items in the list.



1360
1361
1362
# File 'doc/API_reference.rb', line 1360

def items_margin
  @items_margin
end

Instance Method Details

#add_item(widget) ⇒ List

Adds a new item to the end of the list.

Parameters:

  • widget (Widget)

    the item to add.

Returns:

  • (List)

    the receiver.



1322
# File 'doc/API_reference.rb', line 1322

def add_item(widget); end

#clear_itemsList

Removes all items in the list.

Returns:

  • (List)

    the receiver.



1342
# File 'doc/API_reference.rb', line 1342

def clear_items; end

#delete_item(index) ⇒ List

Deletes the item at the given index.

Parameters:

  • index (Integer)

    the index to look up.

Returns:

  • (List)

    the receiver.



1338
# File 'doc/API_reference.rb', line 1338

def delete_item(index); end

#insert_item(index, widget) ⇒ List

Inserts a new item at the given index in the list.

Parameters:

  • index (Integer)

    the index where to add the item.

  • widget (Widget)

    the item to add.

Returns:

  • (List)

    the receiver.



1328
# File 'doc/API_reference.rb', line 1328

def insert_item(index, widget); end

#item_at(index) ⇒ Widget

Retrieves the item at the given index.

Parameters:

  • index (Integer)

    the index to look up.

Returns:

  • (Widget)

    the item at the given index, or nil if there isn’t any.



1333
# File 'doc/API_reference.rb', line 1333

def item_at(index); end

#on_selection {|Integer| ... } ⇒ List

Configures a block to be called when an item is selected in the list view.

Yields:

  • (Integer)

    the given block will be called when an item is selected, passing the index of the selection as the argument.

Returns:

  • (List)

    the receiver.



1351
# File 'doc/API_reference.rb', line 1351

def on_selection; end

#selected_itemInteger

Returns the index of the currently selected item.

Returns:

  • (Integer)

    the index of the currently selected item.



1354
# File 'doc/API_reference.rb', line 1354

def selected_item; end