diff options
author | Simon Glass <sjg@chromium.org> | 2023-06-01 10:22:53 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-07-14 12:54:51 -0400 |
commit | 2e59389704cd1e46101f7ffda2dac3f44f2fa332 (patch) | |
tree | 2ec4afe667eb58b3eca7be70ec4522af44ca068c /boot/scene.c | |
parent | 699b0acb522fd808b67b745b541bacf18c275d15 (diff) | |
download | u-boot-2e59389704cd1e46101f7ffda2dac3f44f2fa332.tar.gz |
expo: Support simple themes
It is a pain to manually set the fonts of all objects to be consistent.
Some spacing settings are also better set globally than by manually
positioning each object.
Add a 'theme' to the expo, to hold this information. For now it includes
only the font size.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/scene.c')
-rw-r--r-- | boot/scene.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/boot/scene.c b/boot/scene.c index 6d5e3c1f03d..4dbe12a2b74 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -466,3 +466,31 @@ int scene_calc_dims(struct scene *scn, bool do_menus) return 0; } + +int scene_apply_theme(struct scene *scn, struct expo_theme *theme) +{ + struct scene_obj *obj; + int ret; + + /* Avoid error-checking optional items */ + scene_txt_set_font(scn, scn->title_id, NULL, theme->font_size); + + list_for_each_entry(obj, &scn->obj_head, sibling) { + switch (obj->type) { + case SCENEOBJT_NONE: + case SCENEOBJT_IMAGE: + case SCENEOBJT_MENU: + break; + case SCENEOBJT_TEXT: + scene_txt_set_font(scn, obj->id, NULL, + theme->font_size); + break; + } + } + + ret = scene_arrange(scn); + if (ret) + return log_msg_ret("arr", ret); + + return 0; +} |