Rename locale -> lang_text

This commit is contained in:
Insality
2020-02-22 15:24:52 +03:00
parent 2c0b100ab7
commit 640753c080
7 changed files with 46 additions and 43 deletions

View File

@@ -16,6 +16,26 @@ local function on_button_hover(self, hover_state)
self.style.on_hover(self, self.anim_node, hover_state)
end
local function on_button_release(self)
if not self.disabled then
if not self.stub and self.can_action then
self.can_action = false
if self.style.on_click then
self.style.on_click(self, self.anim_node)
end
self.callback(self:get_context(), self.params, self)
end
return true
else
if self.style.on_click_disabled then
self.style.on_click_disabled(self, self.anim_node)
end
return false
end
end
--- Component init function
-- @function button:init
-- @tparam table self Component instance
@@ -44,25 +64,6 @@ function M.init(self, node, callback, params, anim_node, event)
end
local function on_button_release(self)
if not self.disabled then
if not self.stub and self.can_action then
self.can_action = false
if self.style.on_click then
self.style.on_click(self, self.anim_node)
end
self.callback(self:get_context(), self.params, self)
end
return true
else
if self.style.on_click_disabled then
self.style.on_click_disabled(self, self.anim_node)
end
return false
end
end
function M.on_input(self, action_id, action)
if action_id ~= const.ACTION_TOUCH then
return false

View File

@@ -1,12 +1,12 @@
--- Component to handle all GUI texts
-- Good working with localization system
-- @module druid.locale
-- @module druid.lang_text
local const = require("druid.const")
local settings = require("druid.system.settings")
local component = require("druid.component")
local M = component.create("locale", { const.ON_CHANGE_LANGUAGE })
local M = component.create("lang_text", { const.ON_CHANGE_LANGUAGE })
function M.init(self, node, lang_id, no_adjust)

View File

@@ -6,7 +6,7 @@
-- @see druid.back_handler
-- @see druid.input
-- @see druid.text
-- @see druid.locale
-- @see druid.lang_text
-- @see druid.timer
-- @see druid.progress
-- @see druid.grid
@@ -26,7 +26,7 @@ local blocker = require("druid.base.blocker")
local back_handler = require("druid.base.back_handler")
local hover = require("druid.base.hover")
local text = require("druid.base.text")
local locale = require("druid.base.locale")
local lang_text = require("druid.base.lang_text")
local timer = require("druid.base.timer")
local progress = require("druid.base.progress")
local grid = require("druid.base.grid")
@@ -269,12 +269,12 @@ function Druid.new_text(self, ...)
end
--- Create locale basic component
-- @function druid:new_locale
-- @tparam args ... locale init args
-- @treturn Component locale component
function Druid.new_locale(self, ...)
return Druid.create(self, locale, ...)
--- Create lang_text basic component
-- @function druid:new_lang_text
-- @tparam args ... lang_text init args
-- @treturn Component lang_text component
function Druid.new_lang_text(self, ...)
return Druid.create(self, lang_text, ...)
end