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

@ -136,17 +136,11 @@ function EnterGame.terminate()
removeEvent(autoLoginEvent)
enterGame:destroy()
enterGame = nil
enterGameButton:destroy()
enterGameButton = nil
protocolBox = nil
if motdWindow then
motdWindow:destroy()
motdWindow = nil
end
if motdButton then
motdButton:destroy()
motdButton = nil
end
if loadBox then
loadBox:destroy()
loadBox = nil

View File

@ -23,8 +23,6 @@ end
function terminate()
moduleManagerWindow:destroy()
moduleManagerWindow = nil
moduleManagerButton:destroy()
moduleManagerButton = nil
moduleList = nil
end

View File

@ -119,15 +119,11 @@ function terminate()
g_keyboard.unbindKeyDown('Ctrl+Shift+F')
optionsWindow:destroy()
optionsWindow = nil
optionsButton:destroy()
optionsButton = nil
optionsTabBar = nil
generalPanel = nil
consolePanel = nil
graphicsPanel = nil
audioPanel = nil
audioButton:destroy()
audioButton = nil
end
function toggle()

View File

@ -150,8 +150,6 @@ function terminate()
g_settings.setList('terminal-history', commandHistory)
g_keyboard.unbindKeyDown('Ctrl+T')
g_logger.setOnLog(nil)
terminalButton:destroy()
terminalButton = nil
commandTextEdit = nil
terminalBuffer = nil
terminalWindow:destroy()

View File

@ -14,12 +14,15 @@ local function addButton(id, description, icon, callback, panel, toggle, front)
class = 'TopButton'
end
local button = g_ui.createWidget(class)
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)
button:setIcon(resolvepath(icon, 3))

View File

@ -50,7 +50,6 @@ function terminate()
end
fightModeRadioGroup:destroy()
combatControlsButton:destroy()
combatControlsWindow:destroy()
disconnect(g_game, {

View File

@ -35,7 +35,6 @@ function terminate()
onSpellGroupCooldown = onSpellGroupCooldown,
onSpellCooldown = onSpellCooldown })
cooldownButton:destroy()
cooldownWindow:destroy()
end

View File

@ -70,7 +70,6 @@ function terminate()
disconnect(g_game, { onGameEnd = offline })
healthInfoWindow:destroy()
healthInfoButton:destroy()
healthInfoWindow = nil
healthInfoButton = nil

View File

@ -88,7 +88,6 @@ function terminate()
unload()
hotkeysWindow:destroy()
hotkeysButton:destroy()
mouseGrabberWidget:destroy()
end

View File

@ -123,7 +123,6 @@ function terminate()
disconnect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
logoutButton:destroy()
gameRootPanel:destroy()
end

View File

@ -39,7 +39,6 @@ function terminate()
g_keyboard.unbindKeyDown('Ctrl+I')
inventoryWindow:destroy()
inventoryButton:destroy()
end
function refresh()

View File

@ -48,7 +48,6 @@ function terminate()
g_keyboard.unbindKeyPress('Alt+Down', gameRootPanel)
g_keyboard.unbindKeyDown('Ctrl+M')
minimapButton:destroy()
minimapWindow:destroy()
end

View File

@ -17,9 +17,6 @@ function terminate()
onQuestLine = onGameQuestLine,
onGameEnd = destroyWindows})
if questLogButton then
questLogButton:destroy()
end
destroyWindows()
end

View File

@ -60,7 +60,6 @@ function terminate()
})
g_keyboard.unbindKeyDown('Ctrl+S')
skillsButton:destroy()
skillsWindow:destroy()
end

View File

@ -172,8 +172,6 @@ function terminate()
updateSpellInformation(focusedChild)
end })
spelllistButton:destroy()
spelllistButton = nil
spelllistWindow:destroy()
spelllistWindow = nil