Browse Source

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

Kamil Chojnowski 3 years ago
parent
commit
68371c98d4

+ 2
- 0
modules/client_topmenu/topmenu.lua View File

@@ -177,9 +177,11 @@ function toggle()
177 177
     menu:hide()
178 178
     modules.client_background.getBackground():addAnchor(AnchorTop, 'parent', AnchorTop)
179 179
     modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'parent', AnchorTop)
180
+    modules.game_interface.getShowTopMenuButton():show()
180 181
   else
181 182
     menu:show()
182 183
     modules.client_background.getBackground():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
183 184
     modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
185
+    modules.game_interface.getShowTopMenuButton():hide()
184 186
   end
185 187
 end

+ 10
- 0
modules/game_interface/gameinterface.lua View File

@@ -5,6 +5,7 @@ gameMapPanel = nil
5 5
 gameRightPanel = nil
6 6
 gameLeftPanel = nil
7 7
 gameBottomPanel = nil
8
+showTopMenuButton = nil
8 9
 logoutButton = nil
9 10
 mouseGrabberWidget = nil
10 11
 countWindow = nil
@@ -55,6 +56,11 @@ function init()
55 56
   logoutButton = modules.client_topmenu.addLeftButton('logoutButton', tr('Exit'),
56 57
     '/images/topbuttons/logout', tryLogout, true)
57 58
 
59
+  showTopMenuButton = gameMapPanel:getChildById('showTopMenuButton')
60
+  showTopMenuButton.onClick = function()
61
+    modules.client_topmenu.toggle()
62
+  end
63
+
58 64
   setupViewMode(0)
59 65
 
60 66
   bindKeys()
@@ -800,6 +806,10 @@ function getBottomPanel()
800 806
   return gameBottomPanel
801 807
 end
802 808
 
809
+function getShowTopMenuButton()
810
+  return showTopMenuButton
811
+end
812
+
803 813
 function onLeftPanelVisibilityChange(leftPanel, visible)
804 814
   if not visible and g_game.isOnline() then
805 815
     local children = leftPanel:getChildren()

+ 8
- 0
modules/game_interface/gameinterface.otui View File

@@ -32,6 +32,14 @@ UIWidget
32 32
     anchors.bottom: gameBottomPanel.top
33 33
     focusable: false
34 34
 
35
+    Button
36
+      id: showTopMenuButton
37
+      anchors.top: parent.top
38
+      anchors.left: parent.left
39
+      !text: tr('Show Top Menu')
40
+      height: 32
41
+      visible: false
42
+
35 43
   GameBottomPanel
36 44
     id: gameBottomPanel
37 45
     anchors.left: gameLeftPanel.right

Loading…
Cancel
Save