mirror of
https://github.com/Insality/druid
synced 2025-09-28 10:32:20 +02:00
Move bindings to druid, update widgets
This commit is contained in:
@@ -11,6 +11,7 @@ function M:init()
|
||||
self.root = self:get_node("root")
|
||||
self.text_header = self.druid:new_text("text_header")
|
||||
|
||||
self.icon_drag = self:get_node("icon_drag")
|
||||
self.druid:new_drag("header", self.on_drag_widget)
|
||||
self.druid:new_button("icon_drag", self.toggle_hide)
|
||||
:set_style(nil)
|
||||
@@ -34,7 +35,11 @@ function M:init()
|
||||
self.values = {}
|
||||
|
||||
self.container = self.druid:new_container(self.root)
|
||||
self.container:add_container("header")
|
||||
local container_header = self.container:add_container("header", "stretch_x")
|
||||
container_header:add_container("text_header")
|
||||
container_header:add_container("icon_drag")
|
||||
|
||||
self.container:add_container("content", "stretch_x")
|
||||
self.default_size = self.container:get_size()
|
||||
end
|
||||
|
||||
@@ -141,6 +146,10 @@ end
|
||||
|
||||
|
||||
function M:on_drag_widget(dx, dy)
|
||||
if not gui.is_enabled(self.icon_drag) then
|
||||
return
|
||||
end
|
||||
|
||||
local position = self.container:get_position()
|
||||
self.container:set_position(position.x + dx, position.y + dy)
|
||||
end
|
||||
@@ -159,4 +168,4 @@ function M:toggle_hide()
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
return M
|
||||
|
Reference in New Issue
Block a user