Module component
Basic class for all Druid components.
To create you component, use component.create
Functions
set_style(style) | Set current component style table. |
set_template(template) | Set current component template name |
set_nodes(nodes) | Set current component nodes |
get_context() | Get current component context |
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. |
get_name() | Return component name |
set_input_enabled(state) | Set component input state. |
get_parent_component() | Return the parent for current component |
setup_component(table, table, table) | Setup component context and his style table |
__set_context(context) | Set current component context |
__get_interests() | Get current component interests |
__get_template() | Get current component template name |
__get_nodes() | Get current component nodes |
__add_children(children) | Add child to component children list |
__remove_children(children) | Remove child from component children list |
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 paramsParameters:
- style table Druid style module
- set_template(template)
-
Set current component template name
Parameters:
- template string Component template name
- set_nodes(nodes)
-
Set current component nodes
Parameters:
- nodes table Component nodes table
- get_context()
-
Get current component context
Returns:
-
table
Component context
- 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
- get_name()
-
Return component name
Returns:
-
string
The component name
- set_input_enabled(state)
-
Set component input state. By default it enabled
You can disable any input of component by this function
Parameters:
- state bool The component input state
Returns:
-
Component
Component itself
- get_parent_component()
-
Return the parent for current component
Returns:
-
Component or nil
The druid component instance or nil
- 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
- __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
- __get_template()
-
Get current component template name
Returns:
-
string
Component template name
- __get_nodes()
-
Get current component nodes
Returns:
-
table
Component nodes table
- __add_children(children)
-
Add child to component children list
Parameters:
- children component The druid component instance
- __remove_children(children)
-
Remove child from component children list
Parameters:
- children component The druid component instance
- Component.create(name[, interest={}])
-
Create new component. It will inheritance from basic
druid component.
Parameters: