Add a button to show the top menu when it's hidden

This commit is contained in:
Kamil Chojnowski 2017-11-19 02:00:02 +01:00
parent 483988f814
commit 68371c98d4
3 changed files with 20 additions and 0 deletions

View File

@ -177,9 +177,11 @@ function toggle()
menu:hide()
modules.client_background.getBackground():addAnchor(AnchorTop, 'parent', AnchorTop)
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'parent', AnchorTop)
modules.game_interface.getShowTopMenuButton():show()
else
menu:show()
modules.client_background.getBackground():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
modules.game_interface.getShowTopMenuButton():hide()
end
end

View File

@ -5,6 +5,7 @@ gameMapPanel = nil
gameRightPanel = nil
gameLeftPanel = nil
gameBottomPanel = nil
showTopMenuButton = nil
logoutButton = nil
mouseGrabberWidget = nil
countWindow = nil
@ -55,6 +56,11 @@ function init()
logoutButton = modules.client_topmenu.addLeftButton('logoutButton', tr('Exit'),
'/images/topbuttons/logout', tryLogout, true)
showTopMenuButton = gameMapPanel:getChildById('showTopMenuButton')
showTopMenuButton.onClick = function()
modules.client_topmenu.toggle()
end
setupViewMode(0)
bindKeys()
@ -800,6 +806,10 @@ function getBottomPanel()
return gameBottomPanel
end
function getShowTopMenuButton()
return showTopMenuButton
end
function onLeftPanelVisibilityChange(leftPanel, visible)
if not visible and g_game.isOnline() then
local children = leftPanel:getChildren()

View File

@ -32,6 +32,14 @@ UIWidget
anchors.bottom: gameBottomPanel.top
focusable: false
Button
id: showTopMenuButton
anchors.top: parent.top
anchors.left: parent.left
!text: tr('Show Top Menu')
height: 32
visible: false
GameBottomPanel
id: gameBottomPanel
anchors.left: gameLeftPanel.right