From eb1ceeb390b665e24807744fc5d245249cb721bc Mon Sep 17 00:00:00 2001 From: Paul Liverman III Date: Wed, 20 Apr 2016 16:12:38 -0700 Subject: [PATCH] close #31 window ref deletion --- demo/main.lua | 5 ----- demo/pop/elements/element.lua | 1 + demo/pop/elements/window.lua | 7 +++++++ lib/pop/elements/element.lua | 1 + lib/pop/elements/window.lua | 7 +++++++ src/pop/elements/element.moon | 1 + src/pop/elements/window.moon | 8 ++++++++ 7 files changed, 25 insertions(+), 5 deletions(-) diff --git a/demo/main.lua b/demo/main.lua index f3b9ac4..18caf6d 100644 --- a/demo/main.lua +++ b/demo/main.lua @@ -59,11 +59,6 @@ function love.load() print(c.horizontal, c.vertical) local window = pop.window():align("center", "center"):setTitle("Welcome! This title is far too big!") - --window:addChild(pop.text("Welcome to Pop.Box()!")) - --window.window.clicked = function() - -- print("The proper window has been clicked!") - -- return true - --end pop.window():setClose(false):setClose(true) diff --git a/demo/pop/elements/element.lua b/demo/pop/elements/element.lua index ecfaf51..39828d5 100644 --- a/demo/pop/elements/element.lua +++ b/demo/pop/elements/element.lua @@ -243,6 +243,7 @@ do end self.parent:removeChild(self) self = nil + return nil end } _base_0.__index = _base_0 diff --git a/demo/pop/elements/window.lua b/demo/pop/elements/window.lua index 68fecd5..cd4cb31 100644 --- a/demo/pop/elements/window.lua +++ b/demo/pop/elements/window.lua @@ -214,6 +214,13 @@ do else return false end + end, + delete = function(self) + _class_0.__parent.__base.delete(self) + self.head = nil + self.title = nil + self.area = nil + self.close = nil end } _base_0.__index = _base_0 diff --git a/lib/pop/elements/element.lua b/lib/pop/elements/element.lua index ecfaf51..39828d5 100644 --- a/lib/pop/elements/element.lua +++ b/lib/pop/elements/element.lua @@ -243,6 +243,7 @@ do end self.parent:removeChild(self) self = nil + return nil end } _base_0.__index = _base_0 diff --git a/lib/pop/elements/window.lua b/lib/pop/elements/window.lua index 68fecd5..cd4cb31 100644 --- a/lib/pop/elements/window.lua +++ b/lib/pop/elements/window.lua @@ -214,6 +214,13 @@ do else return false end + end, + delete = function(self) + _class_0.__parent.__base.delete(self) + self.head = nil + self.title = nil + self.area = nil + self.close = nil end } _base_0.__index = _base_0 diff --git a/src/pop/elements/element.moon b/src/pop/elements/element.moon index 57b9667..34d7381 100644 --- a/src/pop/elements/element.moon +++ b/src/pop/elements/element.moon @@ -262,3 +262,4 @@ class element @parent\removeChild @ @ = nil + return nil diff --git a/src/pop/elements/window.moon b/src/pop/elements/window.moon index 1f7ffee..ffda59a 100644 --- a/src/pop/elements/window.moon +++ b/src/pop/elements/window.moon @@ -288,3 +288,11 @@ class window extends element return true else return false + + delete: => + super! + @head = nil + @title = nil + @area = nil + @close = nil + return