mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Add class component and druid_instance
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("back_handler", { const.ON_INPUT })
|
||||
local M = component.create("back_handler", { const.ON_INPUT })
|
||||
|
||||
|
||||
--- Component init function
|
||||
|
@@ -5,7 +5,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("blocker", { const.ON_SWIPE })
|
||||
local M = component.create("blocker", { const.ON_SWIPE })
|
||||
|
||||
|
||||
function M.init(self, node)
|
||||
|
@@ -9,7 +9,8 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("button", { const.ON_INPUT })
|
||||
local M = component.create("button", { const.ON_INPUT })
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @function button:init
|
||||
@@ -21,6 +22,7 @@ local M = component.new("button", { const.ON_INPUT })
|
||||
-- @tparam[opt] string event Button react event, const.ACTION_TOUCH by default
|
||||
function M.init(self, node, callback, params, anim_node, event)
|
||||
assert(callback, "Button should have callback. To block input on zone use blocker component")
|
||||
|
||||
self.style = self:get_style()
|
||||
self.node = helper.get_node(node)
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("checkbox")
|
||||
local M = component.create("checkbox")
|
||||
|
||||
|
||||
function M.set_state(self, state, is_silence)
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("checkbox_group")
|
||||
local M = component.create("checkbox_group")
|
||||
|
||||
|
||||
local function on_checkbox_click(self, index)
|
||||
|
@@ -5,7 +5,7 @@
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("grid")
|
||||
local M = component.create("grid")
|
||||
|
||||
|
||||
function M.init(self, parent, element, in_row)
|
||||
|
@@ -6,7 +6,7 @@ local const = require("druid.const")
|
||||
local settings = require("druid.system.settings")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("locale", { const.ON_CHANGE_LANGUAGE })
|
||||
local M = component.create("locale", { const.ON_CHANGE_LANGUAGE })
|
||||
|
||||
|
||||
function M.init(self, node, lang_id, no_adjust)
|
||||
|
@@ -5,7 +5,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("progress", { const.ON_UPDATE })
|
||||
local M = component.create("progress", { const.ON_UPDATE })
|
||||
|
||||
|
||||
--- Component init function
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("radio_group")
|
||||
local M = component.create("radio_group")
|
||||
|
||||
|
||||
local function on_checkbox_click(self, index)
|
||||
|
@@ -5,7 +5,7 @@ local helper = require("druid.helper")
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("scroll", { const.ON_UPDATE, const.ON_SWIPE })
|
||||
local M = component.create("scroll", { const.ON_UPDATE, const.ON_SWIPE })
|
||||
|
||||
|
||||
-- Global on all scrolls
|
||||
|
@@ -5,7 +5,7 @@ local helper = require("druid.helper")
|
||||
local const = require("druid.const")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("slider", { const.ON_SWIPE })
|
||||
local M = component.create("slider", { const.ON_SWIPE })
|
||||
|
||||
|
||||
local function on_change_value(self)
|
||||
|
@@ -6,7 +6,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("text")
|
||||
local M = component.create("text")
|
||||
|
||||
|
||||
function M.init(self, node, value, no_adjust)
|
||||
|
@@ -6,7 +6,7 @@ local formats = require("druid.helper.formats")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.system.component")
|
||||
|
||||
local M = component.new("timer", { const.ON_UPDATE })
|
||||
local M = component.create("timer", { const.ON_UPDATE })
|
||||
|
||||
|
||||
function M.init(self, node, seconds_from, seconds_to, callback)
|
||||
|
Reference in New Issue
Block a user