mirror of
https://github.com/Insality/druid
synced 2025-09-28 02:22:19 +02:00
More widgets stuff, cleaning code
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
local color = require("druid.color")
|
||||
|
||||
---@class property_button: druid.widget
|
||||
---@field root node
|
||||
---@field container druid.container
|
||||
@@ -7,11 +9,7 @@
|
||||
---@field druid druid_instance
|
||||
local M = {}
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
function M:init()
|
||||
self.root = self:get_node("root")
|
||||
self.text_name = self.druid:new_text("text_name")
|
||||
self.selected = self:get_node("selected")
|
||||
@@ -21,7 +19,9 @@ function M:init(template, nodes)
|
||||
self.text_button = self.druid:new_text("text_button")
|
||||
|
||||
self.container = self.druid:new_container(self.root)
|
||||
self.container:add_container("text_name")
|
||||
self.container:add_container("text_name", nil, function(_, size)
|
||||
self.text_button:set_size(size)
|
||||
end)
|
||||
self.container:add_container("E_Anchor")
|
||||
end
|
||||
|
||||
@@ -32,4 +32,17 @@ function M:on_click()
|
||||
end
|
||||
|
||||
|
||||
---@param text string
|
||||
---@return property_button
|
||||
function M:set_text_button(text)
|
||||
self.text_button:set_text(text)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
function M:set_color(color_value)
|
||||
color.set_color(self:get_node("button"), color_value)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user