# Module `DruidInstance`

Instance of Druid.

Make one instance per gui_script with next code:

local druid = require("druid.druid") function init(self) self.druid = druid.new(self) local button = self.druid:new_button(...) end

Learn Druid instance function here

### See also:

- Button
- Blocker
- BackHandler
- Input
- Text
- LangText
- Timer
- Progress
- StaticGrid
- DynamicGrid
- Scroll
- Slider
- Checkbox
- CheckboxGroup
- RadioGroup
- Swipe
- Drag
- Hover

## Functions

initialize(self, context, style) | Druid class constructor
create(self, component, ...) | Create new druid component
final(self) | Call on final function on gui_script.
remove(self, component) | Remove component from druid instance.
update(self, dt) | Druid update function
on_input(self, action_id, action) | Druid on_input function
on_message(self, message_id, message, sender) | Druid on_message function
on_focus_lost(self) | Druid on focus lost interest function.
on_focus_gained(self) | Druid on focus gained interest function.
on_layout_change(self) | Druid on layout change function.
druid.on_language_change() | Druid on language change.
new_button(self, ...) | Create button basic component
new_blocker(self, ...) | Create blocker basic component
new_back_handler(self, ...) | Create back_handler basic component
new_hover(self, ...) | Create hover basic component
new_text(self, ...) | Create text basic component
new_grid(self, ...) | Create grid basic component Deprecated
new_static_grid(self, ...) | Create static grid basic component
new_scroll(self, ...) | Create scroll basic component
new_swipe(self, ...) | Create swipe basic component
new_drag(self, ...) | Create drag basic component
new_dynamic_grid(self, ...) | Create dynamic grid component
new_lang_text(self, ...) | Create lang_text component
new_slider(self, ...) | Create slider component
new_checkbox(self, ...) | Create checkbox component
new_input(self, ...) | Create input component
new_checkbox_group(self, ...) | Create checkbox_group component
new_radio_group(self, ...) | Create radio_group component
new_timer(self, ...) | Create timer component
new_progress(self, ...) | Create progress component

## Functions

initialize(self, context, style)
  Druid class constructor

  ### Parameters:

  - self DruidInstance
  - context table Druid context. Usually it is self of script
  - style table Druid style module
create(self, component, ...)
  Create new druid component

  ### Parameters:

  - self DruidInstance
  - component Component Component module
  - ... args Other component params to pass it to component:init function
final(self)
  Call on final function on gui_script. It will call on_remove on all druid components

  ### Parameters:

  - self DruidInstance
remove(self, component)
  Remove component from druid instance. Component `on_remove` function will be invoked, if exist.

  ### Parameters:

  - self DruidInstance
  - component Component Component instance
update(self, dt)
  Druid update function

  ### Parameters:

  - self DruidInstance
  - dt number Delta time
on_input(self, action_id, action)
  Druid on_input function

  ### Parameters:

  - self DruidInstance
  - action_id hash Action_id from on_input
  - action table Action from on_input
on_message(self, message_id, message, sender)
  Druid on_message function

  ### Parameters:

  - self DruidInstance
  - message_id hash Message_id from on_message
  - message table Message from on_message
  - sender hash Sender from on_message
on_focus_lost(self)
  Druid on focus lost interest function. This one called by on_window_callback by global window listener

  ### Parameters:

  - self DruidInstance
on_focus_gained(self)
  Druid on focus gained interest function. This one called by on_window_callback by global window listener

  ### Parameters:

  - self DruidInstance
on_layout_change(self)
  Druid on layout change function. Called on update gui layout

  ### Parameters:

  - self DruidInstance
druid.on_language_change()
  Druid on language change. This one called by global gruid.on_language_change, but can be call manualy to update all translations
new_button(self, ...)
  Create button basic component

  ### Parameters:

  - self DruidInstance
  - ... args button init args

  ### Returns:

  Button button component
new_blocker(self, ...)
  Create blocker basic component

  ### Parameters:

  - self DruidInstance
  - ... args blocker init args

  ### Returns:

  Blocker blocker component
new_back_handler(self, ...)
  Create back_handler basic component

  ### Parameters:

  - self DruidInstance
  - ... args back_handler init args

  ### Returns:

  BackHandler back_handler component
new_hover(self, ...)
  Create hover basic component

  ### Parameters:

  - self DruidInstance
  - ... args hover init args

  ### Returns:

  Hover hover component
new_text(self, ...)
  Create text basic component

  ### Parameters:

  - self DruidInstance
  - ... args text init args

  ### Returns:

  Tet text component
new_grid(self, ...)
  Create grid basic component Deprecated

  ### Parameters:

  - self DruidInstance
  - ... args grid init args

  ### Returns:

  StaticGrid grid component
new_static_grid(self, ...)
  Create static grid basic component

  ### Parameters:

  - self DruidInstance
  - ... args grid init args

  ### Returns:

  StaticGrid grid component
new_scroll(self, ...)
  Create scroll basic component

  ### Parameters:

  - self DruidInstance
  - ... args scroll init args

  ### Returns:

  Scroll scroll component
new_swipe(self, ...)
  Create swipe basic component

  ### Parameters:

  - self DruidInstance
  - ... args swipe init args

  ### Returns:

  Swipe swipe component
new_drag(self, ...)
  Create drag basic component

  ### Parameters:

  - self DruidInstance
  - ... args drag init args

  ### Returns:

  Drag drag component
new_dynamic_grid(self, ...)
  Create dynamic grid component

  ### Parameters:

  - self DruidInstance
  - ... args grid init args

  ### Returns:

  DynamicGrid grid component
new_lang_text(self, ...)
  Create lang_text component

  ### Parameters:

  - self DruidInstance
  - ... args lang_text init args

  ### Returns:

  LangText lang_text component
new_slider(self, ...)
  Create slider component

  ### Parameters:

  - self DruidInstance
  - ... args slider init args

  ### Returns:

  Slider slider component
new_checkbox(self, ...)
  Create checkbox component

  ### Parameters:

  - self DruidInstance
  - ... args checkbox init args

  ### Returns:

  Checkbox checkbox component
new_input(self, ...)
  Create input component

  ### Parameters:

  - self DruidInstance
  - ... args input init args

  ### Returns:

  Input input component
new_checkbox_group(self, ...)
  Create checkbox_group component

  ### Parameters:

  - self DruidInstance
  - ... args checkbox_group init args

  ### Returns:

  CheckboxGroup checkbox_group component
new_radio_group(self, ...)
  Create radio_group component

  ### Parameters:

  - self DruidInstance
  - ... args radio_group init args

  ### Returns:

  RadioGroup radio_group component
new_timer(self, ...)
  Create timer component

  ### Parameters:

  - self DruidInstance
  - ... args timer init args

  ### Returns:

  Timer timer component
new_progress(self, ...)
  Create progress component

  ### Parameters:

  - self DruidInstance
  - ... args progress init args

  ### Returns:

  Progress progress component

generated by LDoc 1.4.6 Last updated 2020-10-12 00:44:30