Merge pull request #907 from diath/topbar_visibility_toggle

Add a keyboard shortcut to toggle topmenu visibility
This commit is contained in:
Eduardo Bart
2017-11-20 12:04:11 -02:00
committed by GitHub
3 changed files with 40 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ gameMapPanel = nil
gameRightPanel = nil
gameLeftPanel = nil
gameBottomPanel = nil
showTopMenuButton = nil
logoutButton = nil
mouseGrabberWidget = nil
countWindow = nil
@@ -56,6 +57,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()
@@ -815,6 +821,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

@@ -1,4 +1,3 @@
GameSidePanel < UIMiniWindowContainer
image-source: /images/ui/panel_side
image-border: 4
@@ -33,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
@@ -73,4 +80,4 @@ UIWidget
UIWidget
id: mouseGrabber
focusable: false
visible: false
visible: false