From 0635004e2228dea0aab023d7c56b0b74633e8a3c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 2 May 2025 08:46:44 -0600 Subject: expo: Implement a box It is useful to be able to draw a box around elements in the menu. Add support for an unfilled box with a selectable thickness. Note that there is no support for selecting the colour for any expo objects yet. Signed-off-by: Simon Glass --- include/expo.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'include') diff --git a/include/expo.h b/include/expo.h index a79aa1da74f..8833dcceb7e 100644 --- a/include/expo.h +++ b/include/expo.h @@ -179,6 +179,7 @@ struct scene { * * @SCENEOBJT_NONE: Used to indicate that the type does not matter * @SCENEOBJT_IMAGE: Image data to render + * @SCENEOBJT_BOX: Rectangular box * @SCENEOBJT_TEXT: Text line to render * @SCENEOBJT_MENU: Menu containing items the user can select * @SCENEOBJT_TEXTLINE: Line of text the user can edit @@ -187,6 +188,7 @@ enum scene_obj_t { SCENEOBJT_NONE = 0, SCENEOBJT_IMAGE, SCENEOBJT_TEXT, + SCENEOBJT_BOX, /* types from here on can be highlighted */ SCENEOBJT_MENU, @@ -406,6 +408,19 @@ struct scene_obj_textline { uint pos; }; +/** + * struct scene_obj_box - information about a box in a scene + * + * A box surrounds a part of the screen with a border + * + * @obj: Basic object information + * @width: Line-width in pixels + */ +struct scene_obj_box { + struct scene_obj obj; + uint width; +}; + /** * struct expo_arrange_info - Information used when arranging a scene * @@ -670,6 +685,19 @@ int scene_menu(struct scene *scn, const char *name, uint id, int scene_textline(struct scene *scn, const char *name, uint id, uint max_chars, struct scene_obj_textline **tlinep); +/** + * scene_box() - create a box + * + * @scn: Scene to update + * @name: Name to use (this is allocated by this call) + * @id: ID to use for the new object (0 to allocate one) + * @width: Line-width in pixels + * @boxp: If non-NULL, returns the new object + * Returns: ID number for the object (typically @id), or -ve on error + */ +int scene_box(struct scene *scn, const char *name, uint id, uint width, + struct scene_obj_box **boxp); + /** * scene_txt_set_font() - Set the font for an object * -- cgit v1.3.1