Module BaseComponent
Basic class for all Druid components.
To create you component, use `component.create`
Functions
get_childrens(self) | Return all children components, recursive (protected) |
get_context(self) | Get current component context (protected) |
get_druid(self) | Return druid with context of calling component (protected). |
get_input_priority(self) | Return component input priority |
get_name(self) | Return component name |
get_node(self, node_or_name) | Get node for component by name. |
get_parent_component(self) | Return the parent for current component (protected) |
get_parent_name(self) | Return parent component name |
get_template(self) | Get current component template name (protected) |
get_uid(self) | Return component uid (protected). |
log_message(self, message, context) | Print log information if debug mode is enabled (protected) |
reset_input_priority(self) | Reset component input priority to default value |
set_debug(self, is_debug) | Set debug logs for component enabled or disabled |
set_input_enabled(self, state) | Set component input state. |
set_input_priority(self, value) | Set component input priority |
set_nodes(self, nodes) | Set current component nodes (protected) |
set_style(self, druid_style) | Set current component style table (protected). |
set_template(self, template) | Set current component template name (protected) It will check parent template name to build full template name |
Fields
ON_INPUT | Component Interests |
Functions
- get_childrens(self)
-
Return all children components, recursive (protected)
Parameters:
- self BaseComponent BaseComponent
Returns:
-
table
Array of childrens if the Druid component instance
- get_context(self)
-
Get current component context (protected)
Parameters:
- self BaseComponent BaseComponent
Returns:
-
table
BaseComponent context
- get_druid(self)
-
Return druid with context of calling component (protected).
Use it to create component inside of other components.
Parameters:
- self BaseComponent BaseComponent
Returns:
-
Druid
Druid instance with component context
- get_input_priority(self)
-
Return component input priority
Parameters:
- self BaseComponent BaseComponent
Returns:
-
number
The component input priority
- get_name(self)
-
Return component name
Parameters:
- self BaseComponent BaseComponent
Returns:
-
string
The component name
- get_node(self, node_or_name)
-
Get node for component by name.
If component has nodes, node_or_name should be string
It auto pick node by template name or from nodes by clone_tree
if they was setup via component:set_nodes, component:set_template.
If node is not found, the exception will fired
Parameters:
- self BaseComponent BaseComponent
- node_or_name string or node Node name or node itself
Returns:
-
node
Gui node
- get_parent_component(self)
-
Return the parent for current component (protected)
Parameters:
- self BaseComponent BaseComponent
Returns:
-
BaseComponent or nil
The druid component instance or nil
- get_parent_name(self)
-
Return parent component name
Parameters:
- self BaseComponent BaseComponent
Returns:
-
string or nil
The parent component name if exist or bil
- get_template(self)
-
Get current component template name (protected)
Parameters:
- self BaseComponent BaseComponent
Returns:
-
string
Component full template name
- get_uid(self)
-
Return component uid (protected).
UID generated in component creation order
Parameters:
- self BaseComponent BaseComponent
Returns:
-
number
The component uid
- log_message(self, message, context)
-
Print log information if debug mode is enabled (protected)
Parameters:
- self BaseComponent BaseComponent
- message string
- context table
- reset_input_priority(self)
-
Reset component input priority to default value
Parameters:
- self BaseComponent BaseComponent
Returns:
-
number
The component input priority
- set_debug(self, is_debug)
-
Set debug logs for component enabled or disabled
Parameters:
- self BaseComponent BaseComponent
- is_debug bool
- set_input_enabled(self, state)
-
Set component input state. By default it enabled
You can disable any input of component by this function
Parameters:
- self BaseComponent BaseComponent
- state bool The component input state
Returns:
-
BaseComponent
BaseComponent itself
- set_input_priority(self, value)
-
Set component input priority
Parameters:
- self BaseComponent BaseComponent
- value number The new input priority value
Returns:
-
number
The component input priority
- set_nodes(self, nodes)
-
Set current component nodes (protected)
Parameters:
- self BaseComponent BaseComponent
- nodes table BaseComponent nodes table
Returns:
-
BaseComponent
BaseComponent
- set_style(self, druid_style)
-
Set current component style table (protected).
Invoke `on_style_change` on component, if exist. BaseComponent should handle
their style changing and store all style params
Parameters:
- self BaseComponent BaseComponent
- druid_style table Druid style module
- set_template(self, template)
-
Set current component template name (protected)
It will check parent template name to build full template name
Parameters:
- self BaseComponent BaseComponent
- template string BaseComponent template name
Returns:
-
BaseComponent
BaseComponent