diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-08-08 13:26:26 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-08-29 08:04:47 +0200 |
commit | 6d4df573936e16fa3366f670269538aebef35276 (patch) | |
tree | 730dafa0746d22bf3306e15c2341a412511c66bf /pkg/gui/types | |
parent | 3df01aaff08b68a860b52aee5acee411c8ad63d5 (diff) |
Add option to add sections to menus
Diffstat (limited to 'pkg/gui/types')
-rw-r--r-- | pkg/gui/types/common.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/gui/types/common.go b/pkg/gui/types/common.go index 919c15b0e..0b6a8e430 100644 --- a/pkg/gui/types/common.go +++ b/pkg/gui/types/common.go @@ -177,6 +177,11 @@ type PromptOpts struct { Mask bool } +type MenuSection struct { + Title string + Column int // The column that this section title should be aligned with +} + type MenuItem struct { Label string @@ -194,6 +199,14 @@ type MenuItem struct { // The tooltip will be displayed upon highlighting the menu item Tooltip string + + // Can be used to group menu items into sections with headers. MenuItems + // with the same Section should be contiguous, and will automatically get a + // section header. If nil, the item is not part of a section. + // Note that pointer comparison is used to determine whether two menu items + // belong to the same section, so make sure all your items in a given + // section point to the same MenuSection instance. + Section *MenuSection } type Model struct { |