Class: MG::List

Inherits:
Scroll show all
Defined in:
motion-game

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?

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

Constructor Details

- (List) initialize

Creates a new List widget.



833
# File 'motion-game', line 833

def initialize; end

Instance Attribute Details

- (Float) items_margin

Returns the margin between items in the list.

Returns:

  • (Float)

    the margin between items in the list.



879
880
881
# File 'motion-game', line 879

def items_margin
  @items_margin
end

Instance Method Details

- (List) add_item(widget)

Adds a new item to the end of the list.

Parameters:

  • widget (Widget)

    the item to add.

Returns:

  • (List)

    the receiver.



841
# File 'motion-game', line 841

def add_item(widget); end

- (List) clear_items

Removes all items in the list.

Returns:

  • (List)

    the receiver.



861
# File 'motion-game', line 861

def clear_items; end

- (List) delete_item(index)

Deletes the item at the given index.

Parameters:

  • index (Integer)

    the index to look up.

Returns:

  • (List)

    the receiver.



857
# File 'motion-game', line 857

def delete_item(index); end

- (List) insert_item(index, widget)

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.



847
# File 'motion-game', line 847

def insert_item(index, widget); end

- (Widget) item_at(index)

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.



852
# File 'motion-game', line 852

def item_at(index); end

- (List) on_selection {|Integer| ... }

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.



870
# File 'motion-game', line 870

def on_selection; end

- (Integer) selected_item

Returns the index of the currently selected item.

Returns:

  • (Integer)

    the index of the currently selected item.



873
# File 'motion-game', line 873

def selected_item; end