Topmenu fix

* Will no longer duplicate topmenu buttons (no need to destroy in the module now)
* Menu items will no longer change position when reloaded.
This commit is contained in:
BeniS
2013-02-01 14:47:15 +13:00
parent b34cc18f98
commit 35e5dd8af8
15 changed files with 8 additions and 32 deletions

View File

@@ -14,11 +14,14 @@ local function addButton(id, description, icon, callback, panel, toggle, front)
class = 'TopButton'
end
local button = g_ui.createWidget(class)
if front then
panel:insertChild(1, button)
else
panel:addChild(button)
local button = panel:getChildById(id)
if not button then
button = g_ui.createWidget(class)
if front then
panel:insertChild(1, button)
else
panel:addChild(button)
end
end
button:setId(id)
button:setTooltip(description)