diff --git a/druid/base/back_handler.lua b/druid/base/back_handler.lua index daabd9a..d6711df 100644 --- a/druid/base/back_handler.lua +++ b/druid/base/back_handler.lua @@ -1,13 +1,14 @@ --- Component to handle back key (android, backspace) --- @module druid.back_handler +-- @module BackHandler +-- @within BaseComponent +-- @alias druid.back_handler ---- Component events --- @table Events --- @tfield druid_event on_back On back handler callback +--- On back handler callback(self, params) +-- @tfield druid_event on_back + +--- Params to back callback +-- @tfield any params ---- Component fields --- @table Fields --- @tfield any params Params to click callbacks local Event = require("druid.event") local const = require("druid.const") @@ -17,21 +18,20 @@ local BackHandler = component.create("back_handler", { const.ON_INPUT }) --- Component init function --- @function back_handler:init +-- @tparam BackHandler self -- @tparam callback callback On back button --- @tparam[opt] params Callback argument -function BackHandler:init(callback, params) +-- @tparam[opt] any params Callback argument +function BackHandler.init(self, callback, params) self.params = params - self.on_back = Event(callback) end --- Input handler for component --- @function back_handler:on_input +-- @tparam BackHandler self -- @tparam string action_id on_input action id -- @tparam table action on_input action -function BackHandler:on_input(action_id, action) +function BackHandler.on_input(self, action_id, action) if not action[const.RELEASED] then return false end diff --git a/druid/base/blocker.lua b/druid/base/blocker.lua index 4f36ae8..1017db9 100644 --- a/druid/base/blocker.lua +++ b/druid/base/blocker.lua @@ -1,16 +1,12 @@ --- Component to block input on specify zone by node --- @module druid.blocker +-- @module Blocker +-- @within BaseComponent +-- @alias druid.blocker ---- Component events --- @table Events --- @tfield druid_event on_click On release button callback --- @tfield druid_event on_enable_change On enable/disable callback +---Trigger node +-- @tfield node node ---- Component fields --- @table Fields --- @tfield node node Trigger node -local Event = require("druid.event") local const = require("druid.const") local component = require("druid.component") @@ -18,17 +14,14 @@ local Blocker = component.create("blocker", { const.ON_INPUT }) --- Component init function --- @function blocker:init +-- @tparam Blocker self -- @tparam node node Gui node -function Blocker:init(node) +function Blocker.init(self, node) self.node = self:get_node(node) - - self.on_click = Event() - self.on_enable_change = Event() end -function Blocker:on_input(action_id, action) +function Blocker.on_input(self, action_id, action) if action_id ~= const.ACTION_TOUCH and action_id ~= const.ACTION_MULTITOUCH and action_id ~= nil then @@ -48,17 +41,17 @@ end --- Set enabled blocker component state --- @function blocker:set_enabled +-- @tparam Blocker self -- @tparam bool state Enabled state -function Blocker:set_enabled(state) +function Blocker.set_enabled(self, state) gui.set_enabled(self.node, state) end --- Return blocked enabled state --- @function blocker:is_enabled +-- @tparam Blocker self -- @treturn bool True, if blocker is enabled -function Blocker:is_enabled(state) +function Blocker.is_enabled(self) return gui.is_enabled(self.node) end diff --git a/druid/base/drag.lua b/druid/base/drag.lua index bef0b7a..6e3e17e 100644 --- a/druid/base/drag.lua +++ b/druid/base/drag.lua @@ -3,6 +3,8 @@ -- touched while dragging. Drag will be processed even -- the cursor is outside of node, if drag is already started -- @module druid.drag +-- @within BaseComponent +-- @alias druid.drag --- Component events -- @table Events diff --git a/druid/base/hover.lua b/druid/base/hover.lua index 221c7b6..bb13273 100644 --- a/druid/base/hover.lua +++ b/druid/base/hover.lua @@ -1,5 +1,7 @@ --- Component to handle hover node interaction -- @module druid.hover +-- @within BaseComponent +-- @alias druid.hover --- Component events -- @table Events diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index bd7139a..c466c48 100644 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -6,6 +6,8 @@ -- size will be less than scroll_input size, no scroll is available. For scroll -- parent size should be more than input size -- @module druid.scroll +-- @within BaseComponent +-- @alias druid.scroll --- Component events -- @table Events diff --git a/druid/base/static_grid.lua b/druid/base/static_grid.lua index 2dd9a42..05e06c9 100644 --- a/druid/base/static_grid.lua +++ b/druid/base/static_grid.lua @@ -1,6 +1,8 @@ --- Component to handle placing components by row and columns. -- Grid can anchor your elements, get content size and other -- @module druid.static_grid +-- @within BaseComponent +-- @alias druid.static_grid --- Component events -- @table Events diff --git a/druid/base/swipe.lua b/druid/base/swipe.lua index 09a9eae..396d0a9 100644 --- a/druid/base/swipe.lua +++ b/druid/base/swipe.lua @@ -2,6 +2,8 @@ -- Swipe will be triggered, if swipe was started and -- ended on one node -- @module druid.swipe +-- @within BaseComponent +-- @alias druid.swipe --- Components fields -- @table Fields diff --git a/druid/base/text.lua b/druid/base/text.lua index c5018cd..15ccb54 100644 --- a/druid/base/text.lua +++ b/druid/base/text.lua @@ -2,6 +2,8 @@ -- Druid text can adjust itself for text node size -- Text will never will be outside of his text size (even multiline) -- @module druid.text +-- @within BaseComponent +-- @alias druid.text --- Component events -- @table Events diff --git a/druid/extended/checkbox.lua b/druid/extended/checkbox.lua index bfe7c6e..4a5cc07 100644 --- a/druid/extended/checkbox.lua +++ b/druid/extended/checkbox.lua @@ -1,5 +1,7 @@ --- Druid checkbox component -- @module druid.checkbox +-- @within BaseComponent +-- @alias druid.checkbox --- Component events -- @table Events diff --git a/druid/extended/checkbox_group.lua b/druid/extended/checkbox_group.lua index 376c712..cfaeb09 100644 --- a/druid/extended/checkbox_group.lua +++ b/druid/extended/checkbox_group.lua @@ -1,5 +1,7 @@ --- Checkbox group module -- @module druid.checkbox_group +-- @within BaseComponent +-- @alias druid.checkbox_group --- Component events -- @table Events diff --git a/druid/extended/dynamic_grid.lua b/druid/extended/dynamic_grid.lua index e009459..8e88ce5 100644 --- a/druid/extended/dynamic_grid.lua +++ b/druid/extended/dynamic_grid.lua @@ -1,5 +1,7 @@ --- Component to handle placing components in row -- @module druid.dynamic_grid +-- @within BaseComponent +-- @alias druid.dynamic_grid --- Component events -- @table Events diff --git a/druid/extended/input.lua b/druid/extended/input.lua index b70608c..0bc783c 100644 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -2,6 +2,8 @@ -- Carry on user text input -- @author Part of code from Britzl gooey input component -- @module druid.input +-- @within BaseComponent +-- @alias druid.input --- Component events -- @table Events diff --git a/druid/extended/lang_text.lua b/druid/extended/lang_text.lua index 61d345f..04f82ef 100644 --- a/druid/extended/lang_text.lua +++ b/druid/extended/lang_text.lua @@ -1,6 +1,8 @@ --- Component to handle all GUI texts -- Good working with localization system -- @module druid.lang_text +-- @within BaseComponent +-- @alias druid.lang_text --- Component events -- @table Events diff --git a/druid/extended/progress.lua b/druid/extended/progress.lua index 2a343ba..87171fe 100644 --- a/druid/extended/progress.lua +++ b/druid/extended/progress.lua @@ -1,6 +1,8 @@ --- Basic progress bar component. -- For correct progress bar init it should be in max size from gui -- @module druid.progress +-- @within BaseComponent +-- @alias druid.progress --- Component events -- @table Events diff --git a/druid/extended/radio_group.lua b/druid/extended/radio_group.lua index 75be888..c5345dd 100644 --- a/druid/extended/radio_group.lua +++ b/druid/extended/radio_group.lua @@ -1,5 +1,7 @@ --- Radio group module -- @module druid.radio_group +-- @within BaseComponent +-- @alias druid.radio_group --- Component events -- @table Events diff --git a/druid/extended/slider.lua b/druid/extended/slider.lua index 2661927..30ccaf6 100644 --- a/druid/extended/slider.lua +++ b/druid/extended/slider.lua @@ -1,5 +1,7 @@ --- Druid slider component -- @module druid.slider +-- @within BaseComponent +-- @alias druid.slider --- Component events -- @table Events diff --git a/druid/extended/timer.lua b/druid/extended/timer.lua index 34b6b98..7f50cf7 100644 --- a/druid/extended/timer.lua +++ b/druid/extended/timer.lua @@ -2,6 +2,8 @@ -- Timer updating by game delta time. If game is not focused - -- timer will be not updated. -- @module druid.timer +-- @within BaseComponent +-- @alias druid.timer --- Component events -- @table Events diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index 8175798..4f0a6b2 100644 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -9,8 +9,8 @@ -- Learn Druid instance function here -- @module druid_instance -- @see Button --- @see druid.blocker --- @see druid.back_handler +-- @see Blocker +-- @see BackHandler -- @see druid.input -- @see druid.text -- @see druid.lang_text