Update annotations

This commit is contained in:
Insality 2020-04-09 22:07:56 +03:00
parent 9dd3a029ad
commit 48bd0da429
6 changed files with 24 additions and 7 deletions

View File

@ -39,7 +39,7 @@ end
--- Set checkbox group state --- Set checkbox group state
-- @function checkbox_group:set_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) function M.set_state(self, indexes)
for i = 1, #indexes do for i = 1, #indexes do
if self.checkboxes[i] then if self.checkboxes[i] then

View File

@ -48,7 +48,7 @@ end
--- Set radio group state --- Set radio group state
-- @function radio_group:set_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) function M.set_state(self, index)
on_checkbox_click(self, index) on_checkbox_click(self, index)
end end
@ -56,7 +56,7 @@ end
--- Return radio group state --- Return radio group state
-- @function radio_group:get_state -- @function radio_group:get_state
-- @treturn bool[] Array if checkboxes state -- @treturn number Index in radio group
function M.get_state(self) function M.get_state(self)
local result = -1 local result = -1

View File

@ -11,7 +11,7 @@
-- @table Events -- @table Events
-- @tfield druid_event on_scroll On scroll move callback -- @tfield druid_event on_scroll On scroll move callback
-- @tfield druid_event on_scroll_to On scroll_to function 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 --- Component fields
-- @table Fields -- @table Fields

View File

@ -128,12 +128,27 @@ function Druid.create(self, component, ...)
end 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. --- Remove component from druid instance.
-- Component `on_remove` function will be invoked, if exist. -- Component `on_remove` function will be invoked, if exist.
-- @function druid:remove -- @function druid:remove
-- @tparam Component component Component instance -- @tparam Component component Component instance
function Druid.remove(self, component) function Druid.remove(self, component)
local all_components = self.components[const.ALL] local all_components = self.components[const.ALL]
for i = #all_components, 1, -1 do for i = #all_components, 1, -1 do
if all_components[i] == component then if all_components[i] == component then
if component.on_remove then if component.on_remove then
@ -204,11 +219,13 @@ function Druid.on_message(self, message_id, message, sender)
end end
end end
else else
local components = self.components[const.ON_MESSAGE] or const.EMPTY_TABLE local components = self.components[const.ON_MESSAGE]
if components then
for i = 1, #components do for i = 1, #components do
components[i]:on_message(message_id, message, sender) components[i]:on_message(message_id, message, sender)
end end
end end
end
end end

BIN
media/scroll_outline.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
media/scroll_scheme.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB