From 2e59389704cd1e46101f7ffda2dac3f44f2fa332 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 1 Jun 2023 10:22:53 -0600 Subject: 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 --- include/expo.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include') diff --git a/include/expo.h b/include/expo.h index 6c45c403cf7..ea8f38913d8 100644 --- a/include/expo.h +++ b/include/expo.h @@ -7,6 +7,7 @@ #ifndef __SCENE_H #define __SCENE_H +#include #include struct udevice; @@ -42,6 +43,19 @@ struct expo_action { }; }; +/** + * struct expo_theme - theme for the expo + * + * @font_size: Default font size for all text + * @menu_inset: Inset width (on each side and top/bottom) for menu items + * @menuitem_gap_y: Gap between menu items in pixels + */ +struct expo_theme { + u32 font_size; + u32 menu_inset; + u32 menuitem_gap_y; +}; + /** * struct expo - information about an expo * @@ -57,6 +71,7 @@ struct expo_action { * type set to EXPOACT_NONE if there is no action * @text_mode: true to use text mode for the menu (no vidconsole) * @priv: Private data for the controller + * @theme: Information about fonts styles, etc. * @scene_head: List of scenes * @str_head: list of strings */ @@ -69,6 +84,7 @@ struct expo { struct expo_action action; bool text_mode; void *priv; + struct expo_theme theme; struct list_head scene_head; struct list_head str_head; }; @@ -583,4 +599,12 @@ int expo_send_key(struct expo *exp, int key); */ int expo_action_get(struct expo *exp, struct expo_action *act); +/** + * expo_apply_theme() - Apply a theme to an expo + * + * @exp: Expo to update + * @node: Node containing the theme + */ +int expo_apply_theme(struct expo *exp, ofnode node); + #endif /*__SCENE_H */ -- cgit v1.2.3