# Defold Druid UI Library

# Module `component`

Basic class for all Druid components.

To create you component, use component.create

## Functions

set_style(style) | Set current component style table.
get_template() | Get current component template name
set_template(template) | Set current component template name
get_nodes() | Get current component nodes
set_nodes(nodes) | Set current component nodes
get_context() | Get current component context
set_context(context) | Set current component context
get_interests() | Get current component interests
increase_input_priority() | Increase input priority in current input stack
reset_input_priority() | Reset input priority in current input stack
get_node(node_or_name) | Get node for component by name.
get_druid() | Return druid with context of calling component.
is_child_of() | Return true, if current component is child of another component
get_name() | Return component name
setup_component(table, table, table) | Setup component context and his style table
Component.create(name[, interest={}]) | Create new component.

## Functions

set_style(style)
  Set current component style table. Invoke `on_style_change` on component, if exist. Component should handle their style changing and store all style params

  ### Parameters:

  - style table Druid style module
get_template()
  Get current component template name

  ### Returns:

  string Component template name
set_template(template)
  Set current component template name

  ### Parameters:

  - template string Component template name
get_nodes()
  Get current component nodes

  ### Returns:

  table Component nodes table
set_nodes(nodes)
  Set current component nodes

  ### Parameters:

  - nodes table Component nodes table
get_context()
  Get current component context

  ### Returns:

  table Component context
set_context(context)
  Set current component context

  ### Parameters:

  - context table Druid context. Usually it is self of script
get_interests()
  Get current component interests

  ### Returns:

  table List of component interests
increase_input_priority()
  Increase input priority in current input stack
reset_input_priority()
  Reset input priority in current input stack
get_node(node_or_name)
  Get node for component by name. If component has nodes, nodeorname should be string It auto pick node by template name or from nodes by clonetree if they was setup via component:setnodes, component:set_template

  ### Parameters:

  - node_or_name string or node Node name or node itself

  ### Returns:

  node Gui node
get_druid()
  Return druid with context of calling component. Use it to create component inside of other components.

  ### Returns:

  Druid Druid instance with component context
is_child_of()
  Return true, if current component is child of another component

  ### Returns:

  bool True, if current component is child of another
get_name()
  Return component name

  ### Returns:

  string The component name
setup_component(table, table, table)
  Setup component context and his style table

  ### Parameters:

  - table style Druid style module
  - table style Druid style module
  - table style Druid style module

  ### Returns:

  Component Component itself
Component.create(name[, interest={}])
  Create new component. It will inheritance from basic druid component.

  ### Parameters:

  - name string Component name
  - interest table List of component's interest (default {})

generated by LDoc 1.4.6 Last updated 2020-06-14 20:13:02