max-ishere / grub-theme

A set of utilities for GRUB themes
0 stars 0 forks source link

Add support for nested gfxmenu components #2

Open max-ishere opened 7 months ago

max-ishere commented 7 months ago

Relevant GRUB documentation

https://www.gnu.org/software/grub/manual/grub-dev/grub-dev.html#GUI-Components

The GUI component instances are created by the theme loader in gfxmenu/theme_loader.c when a theme is loaded. Theme files specify statements such as ‘+vbox{ +label { text="Hello" } +label{ text="World" } }’ to add components to the component tree root. By nesting the component creation statements in the theme file, the instantiated components are nested the same way.

TODO

Related source files in this repo

lib: parser/theme_txt.rs examples: theme_txt.rs

max-ishere commented 7 months ago

It seems not all components should support nested components, only the container types:

Containers:

  • canvas
  • hbox
  • vbox

The other components should not allow such declarations.

Components (non-container):

  • label
  • image
  • progress_bar
  • circular_progress
  • list (currently hard coded to be a boot menu list)

It would be nice to slightly adjust the implementation of the parser and have 2 stages (the first one already exists and the second one is currently in development, I haven't pushed it yet and it will likely be in a separate branch for now)