mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
Add treenode.OnOpen and treenode.OnClose event callbacks
This commit is contained in:
parent
c1d3021590
commit
ec5d387927
@ -22,6 +22,8 @@ function newobject:initialize()
|
||||
self.internal = true
|
||||
self.internals = {}
|
||||
self.icon = nil
|
||||
self.OnOpen = nil
|
||||
self.OnClose = nil
|
||||
|
||||
end
|
||||
|
||||
|
@ -120,7 +120,19 @@ function newobject:mousepressed(x, y, button)
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
self.parent:SetOpen(not self.parent.open)
|
||||
local bool = not self.parent.open
|
||||
if bool then
|
||||
local onopen = self.parent.OnOpen
|
||||
if onopen then
|
||||
onopen(self.parent)
|
||||
end
|
||||
else
|
||||
local onclose = self.parent.OnClose
|
||||
if onclose then
|
||||
onclose(self.parent)
|
||||
end
|
||||
end
|
||||
self.parent:SetOpen(bool)
|
||||
print("!")
|
||||
print(self.parent.level)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user