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 <sjg@chromium.org>
diff --git a/include/expo.h b/include/expo.h
index a79aa1d..8833dcc 100644
--- a/include/expo.h
+++ b/include/expo.h
@@ -179,6 +179,7 @@
*
* @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 @@
SCENEOBJT_NONE = 0,
SCENEOBJT_IMAGE,
SCENEOBJT_TEXT,
+ SCENEOBJT_BOX,
/* types from here on can be highlighted */
SCENEOBJT_MENU,
@@ -407,6 +409,19 @@
};
/**
+ * 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
*
* @label_width: Maximum width of labels in scene
@@ -671,6 +686,19 @@
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
*
* @scn: Scene to update