Module widgetcollection

Provides collective management of buttons.

The collection handles batch event updating and focus tracking.

Info:

  • License: GPL v3
  • Author: Wesley Werner

Functions

module:new () Returns a new widget collection instance.
button (key, parameters) Add a button to the collection.
get (key) Get the element in the collection that matches a key.
keypressed (key) Process key presses to allow navigation with the TAB key and selection with the RETURN key.
mousemoved (x, y, dx, dy, istouch) Process click/touch movement on all elements in the collection.
mousepressed (x, y, button, istouch) Process click/touch presses on all elements in the collection.
mousereleased (x, y, button, istouch) Process click/touch releases on all elements in the collection.
update (dt) Process updates on all elements in the collection.
draw () Process drawing on all elements in the collection.

Local Functions

mapkeys (instance) Creates an ordered list of keys mapped to positions.
focusFirst (instance) Moves focus to the first element.
focusNext (instance) Moves focus to the next element.
focusPrev (instance) Moves focus to the previous element.
focusByKey (instance, key) Moves focus to the element with a given key.


Functions

module:new ()
Returns a new widget collection instance.
button (key, parameters)
Add a button to the collection.

Parameters:

  • key string The key of the button to add to the collection.
  • parameters table The button parameters to pass to the button constructor.

Returns:

    button.instance The created button element.

See also:

get (key)
Get the element in the collection that matches a key.

Parameters:

  • key string The key of the element to find.

Returns:

    button.instance The element instance.
keypressed (key)
Process key presses to allow navigation with the TAB key and selection with the RETURN key.

Parameters:

  • key
mousemoved (x, y, dx, dy, istouch)
Process click/touch movement on all elements in the collection.

Parameters:

  • x
  • y
  • dx
  • dy
  • istouch
mousepressed (x, y, button, istouch)
Process click/touch presses on all elements in the collection.

Parameters:

  • x
  • y
  • button
  • istouch
mousereleased (x, y, button, istouch)
Process click/touch releases on all elements in the collection.

Parameters:

  • x
  • y
  • button
  • istouch
update (dt)
Process updates on all elements in the collection.

Parameters:

  • dt number delta time as given by Love
draw ()
Process drawing on all elements in the collection.

Local Functions

mapkeys (instance)
Creates an ordered list of keys mapped to positions. This function is used internally by the collection.

Parameters:

  • instance table The widget collection instance to work on.
focusFirst (instance)
Moves focus to the first element. This function is used internally by the collection.

Parameters:

  • instance table The widget collection instance to work on.
focusNext (instance)
Moves focus to the next element. This function is used internally by the collection.

Parameters:

  • instance table The widget collection instance to work on.
focusPrev (instance)
Moves focus to the previous element. This function is used internally by the collection.

Parameters:

  • instance table The widget collection instance to work on.
focusByKey (instance, key)
Moves focus to the element with a given key. This function is used internally by the collection.

Parameters:

  • instance table The widget collection instance to work on.
  • key string The key of the widget to get
generated by LDoc 1.4.6 Last updated 2018-01-03 16:24:23