]> git.sesse.net Git - nageru-docs/commitdiff
Document new 1.9.0 menu features.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 19 Jul 2019 20:23:45 +0000 (22:23 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 19 Jul 2019 20:23:45 +0000 (22:23 +0200)
theme.rst

index e45d63683efaba9a36975c53a6c4d4723a79b61e..7667a6087ddbadb88a5ce4c686e9baa787c2f5db 100644 (file)
--- a/theme.rst
+++ b/theme.rst
@@ -375,7 +375,28 @@ labels and function references::
 When the user chooses a menu entry, the given Lua function will
 automatically be called. There are no arguments nor return values.
 
 When the user chooses a menu entry, the given Lua function will
 automatically be called. There are no arguments nor return values.
 
-There currently is no support for checkboxes, submenus, input boxes
+Menus can contain submenus, by giving an array instead of a function::
+
+  ThemeMenu.set(
+    { "Overlay", {
+       { "Version A", select_overlay_a },
+       { "Version B", select_overlay_b }
+    },
+    { "&Reload overlay", reload_html }
+  )
+
+They can also be checkable, or have checkboxes, by adding a third
+array element containing flags for that::
+
+  ThemeMenu.set(
+    { "Enable overlay",  enable_overlay,  Nageru.CHECKED },    -- Currently checked.
+    { "Enable crashing", make_unstable,   Nageru.CHECKABLE }   -- Can be checked, but isn't currently.
+  )
+
+When such an option is selected, you probably want to rebuild the menu to
+reflect the new state.
+
+There currently is no support for input boxes, sliders,
 or the likes. However, do note that since the theme is written in unrestricted
 Lua, so you can use e.g. `lua-http <https://github.com/daurnimator/lua-http>`_
 to listen for external connections and accept more complicated inputs
 or the likes. However, do note that since the theme is written in unrestricted
 Lua, so you can use e.g. `lua-http <https://github.com/daurnimator/lua-http>`_
 to listen for external connections and accept more complicated inputs