Class: MG::List

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

Instance Attribute Summary collapse

Attributes inherited from Scroll

#direction, #inner_container, #inner_size

Attributes inherited from Layout

#background_color, #type

Attributes inherited from Node

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

Constructors collapse

Managing Items collapse

Selection collapse

Methods inherited from Scroll

#jump_to_bottom, #jump_to_bottom_left, #jump_to_bottom_right, #jump_to_left, #jump_to_right, #jump_to_top, #jump_to_top_left, #jump_to_top_right

Methods inherited from Layout

#<<, #add, #clipping=, #clipping?

Methods inherited from Widget

#enabled=, #enabled?, #highlighted=, #highlighted?, #on_touch, #touch_enabled=, #touch_enabled?

Methods inherited from Node

#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #number_of_running_actions, #parent, #run_action, #schedule, #schedule_once, #stop_action, #stop_all_actions, #unschedule, #visible=, #visible?

Constructor Details

#initializeList

Creates a new List widget.



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

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.



1766
1767
1768
# File 'doc/API_reference.rb', line 1766

def items_margin
  @items_margin
end

Instance Method Details

#add_item(widget) ⇒ self

Adds a new item to the end of the list.

Parameters:

  • widget (Widget)

    the item to add.

Returns:

  • (self)

    the receiver.



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

def add_item(widget); end

#clear_itemsself

Removes all items in the list.

Returns:

  • (self)

    the receiver.



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

def clear_items; end

#delete_item(index) ⇒ self

Deletes the item at the given index.

Parameters:

  • index (Integer)

    the index to look up.

Returns:

  • (self)

    the receiver.



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

def delete_item(index); end

#insert_item(index, widget) ⇒ self

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:

  • (self)

    the receiver.



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

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.



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

def item_at(index); end

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

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:

  • (self)

    the receiver.



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

def on_selection; end

#selected_itemInteger

Returns the index of the currently selected item.

Returns:

  • (Integer)

    the index of the currently selected item.



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

def selected_item; end