diff --git a/druid/base/checkbox_group.lua b/druid/base/checkbox_group.lua index dd9a94a..85bb211 100644 --- a/druid/base/checkbox_group.lua +++ b/druid/base/checkbox_group.lua @@ -39,7 +39,7 @@ end --- Set checkbox group state -- @function checkbox_group:set_state --- @tparam bool[] state Array of checkbox state +-- @tparam bool[] indexes Array of checkbox state function M.set_state(self, indexes) for i = 1, #indexes do if self.checkboxes[i] then diff --git a/druid/base/radio_group.lua b/druid/base/radio_group.lua index a446d02..8701ad0 100644 --- a/druid/base/radio_group.lua +++ b/druid/base/radio_group.lua @@ -48,7 +48,7 @@ end --- Set radio group state -- @function radio_group:set_state --- @tparam bool[] state Array of checkbox state +-- @tparam number index Index in radio group function M.set_state(self, index) on_checkbox_click(self, index) end @@ -56,7 +56,7 @@ end --- Return radio group state -- @function radio_group:get_state --- @treturn bool[] Array if checkboxes state +-- @treturn number Index in radio group function M.get_state(self) local result = -1 diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index 4a437c2..56a50aa 100644 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -11,7 +11,7 @@ -- @table Events -- @tfield druid_event on_scroll On scroll move callback -- @tfield druid_event on_scroll_to On scroll_to function callback --- @tfield druid_event on_point_scroll On scroll_to_index function callbck +-- @tfield druid_event on_point_scroll On scroll_to_index function callback --- Component fields -- @table Fields diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index 4f0ec68..9739803 100644 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -128,12 +128,27 @@ function Druid.create(self, component, ...) end +--- Call on final function on gui_script. It will call on_remove +-- on all druid components +-- @function druid:final +function Druid.final(self) + local components = self.components[const.ALL] + + for i = #components, 1, -1 do + if components[i].on_remove then + components[i]:on_remove() + end + end +end + + --- Remove component from druid instance. -- Component `on_remove` function will be invoked, if exist. -- @function druid:remove -- @tparam Component component Component instance function Druid.remove(self, component) local all_components = self.components[const.ALL] + for i = #all_components, 1, -1 do if all_components[i] == component then if component.on_remove then @@ -204,9 +219,11 @@ function Druid.on_message(self, message_id, message, sender) end end else - local components = self.components[const.ON_MESSAGE] or const.EMPTY_TABLE - for i = 1, #components do - components[i]:on_message(message_id, message, sender) + local components = self.components[const.ON_MESSAGE] + if components then + for i = 1, #components do + components[i]:on_message(message_id, message, sender) + end end end end diff --git a/media/scroll_outline.png b/media/scroll_outline.png new file mode 100644 index 0000000..888d9f4 Binary files /dev/null and b/media/scroll_outline.png differ diff --git a/media/scroll_scheme.png b/media/scroll_scheme.png new file mode 100644 index 0000000..64dbc7e Binary files /dev/null and b/media/scroll_scheme.png differ