Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion gui/awindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ end
function _M.AWindow:_removeWidgetChild(child)
for i, v in ipairs(self._widgetChildren) do
if (v == child) then
table.remove(self._widgetChildren, k)
self._gui:_removeWindow(v) -- Modification 2013/12/17
v:destroy()
break
end
Expand Down Expand Up @@ -424,7 +426,6 @@ function _M.AWindow:screenY()
end

function _M.AWindow:_onSetDim()

end

function _M.AWindow:_calcDim(width, height)
Expand Down Expand Up @@ -686,10 +687,12 @@ function _M.AWindow:destroy()
end

for i, v in ipairs(self._children) do
table.remove(self._children, i) -- Modification 2013/17/12
v:destroy()
end

for i, v in ipairs(self._widgetChildren) do
table.remove(self._widgetchildren, i) -- Modification 2013/17/12
v:destroy()
end

Expand All @@ -699,13 +702,25 @@ function _M.AWindow:destroy()
for i2, v2 in ipairs(v) do
v2:setTexture(nil)
end
table.remove(self._quads, k)
end

for k, v in pairs(self._props) do
for i2, v2 in ipairs(v) do
table.remove(v, i2)
self._gui:_unregisterHitObject(v2)
self._gui:_destroyProp(v2)
end
v = nil
table.remove(self._props, k)
self._gui:_destroyProp(self._rootProp -- Modification 2013/17/12
-- 2013/17/12 Next lines are probably redundant --
self._text = nil
self._children = nil
self._widgetChildren = nil
self._quads = nil
self._props = nil
self = nil
end
end

Expand Down
10 changes: 10 additions & 0 deletions gui/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,16 @@ function _M.GUI:createWindow(...)
end


function _M.GUI:_removeWindow(w)
for k,v in pairs(self._windows) do
if (v == w) then
table.remove(self._windows, k)
break
end
end
end


function _M.GUI:createLineGraph(...)
local w = self._factory:create("line graph", ...)

Expand Down
6 changes: 6 additions & 0 deletions gui/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ function _M.Text:_linkProp(parent, prop)
-- prop:setAttrLink(MOAIProp.ATTR_VISIBLE, parent, MOAIProp.ATTR_VISIBLE)
end

function _M.Text:_unlinkProp(prop) -- ADDED 2013/12/17
prop:clearAttrLink(MOAIProp.INHERIT_TRANSFORM)
-- or prop:clearNodeLink(parent) ???
end

function _M.Text:setString(s)
self._string = s
if (true == self._visible) then
Expand Down Expand Up @@ -160,6 +165,7 @@ function _M.Text:hide()
end

function _M.Text:destroy()
self:_unlinkProp(self._parent._rootProp) -- Modification 2013/12/17
self._parent._gui:partition():removeProp(self._textBox)
self._parent._gui:_unregisterHitObject(self._textBox)
end
Expand Down
12 changes: 11 additions & 1 deletion gui/textbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,17 @@ function _M.TextBox:removeLine(idx)

local text = self._lines[idx]:getText()
local f = self._fullText:find(text)
if (nil == f) then return end
if (nil == f) then
self:_removeWidgetChild(self._lines[idx])

self._scrollBar:setTopItem(1) -- update scrollBar
self._scrollBar:setNumItems(self._scrollBar:getNumItems() - 1)
table.remove(self._lines, idx) -- remove empty line
self:_displayLines() -- To erase the old lines


return
end

self._fullText = self._fullText:sub(1, f - 1) .. self._fullText:sub(f + #text)

Expand Down