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>
This commit is contained in:
Simon Glass
2023-06-01 10:22:53 -06:00
committed by Tom Rini
parent 699b0acb52
commit 2e59389704
6 changed files with 95 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
#ifndef __SCENE_H
#define __SCENE_H
#include <dm/ofnode_decl.h>
#include <linux/list.h>
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 */