expo: Add width and height to objects

At present objects only have a position so it is not possible to determine
the amount of space they take up on the display.

Add width and height properties, using a struct to keep all the dimensions
together.

For now this is not used. Future work will set up these new properties.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2023-06-01 10:22:49 -06:00 committed by Tom Rini
parent 2d6ee92c6a
commit ae45d6cf5a
4 changed files with 43 additions and 30 deletions

View file

@ -49,9 +49,9 @@ int scene_menu_arrange(struct scene *scn, struct scene_obj_menu *menu)
int y, cur_y;
int ret;
y = menu->obj.y;
y = menu->obj.dim.y;
if (menu->title_id) {
ret = scene_obj_set_pos(scn, menu->title_id, menu->obj.x, y);
ret = scene_obj_set_pos(scn, menu->title_id, menu->obj.dim.x, y);
if (ret < 0)
return log_msg_ret("tit", ret);
@ -89,18 +89,18 @@ int scene_menu_arrange(struct scene *scn, struct scene_obj_menu *menu)
* pointer, then the key and the description
*/
if (item->label_id) {
ret = scene_obj_set_pos(scn, item->label_id, menu->obj.x,
ret = scene_obj_set_pos(scn, item->label_id, menu->obj.dim.x,
y);
if (ret < 0)
return log_msg_ret("nam", ret);
}
ret = scene_obj_set_pos(scn, item->key_id, menu->obj.x + 230,
ret = scene_obj_set_pos(scn, item->key_id, menu->obj.dim.x + 230,
y);
if (ret < 0)
return log_msg_ret("key", ret);
ret = scene_obj_set_pos(scn, item->desc_id, menu->obj.x + 280,
ret = scene_obj_set_pos(scn, item->desc_id, menu->obj.dim.x + 280,
y);
if (ret < 0)
return log_msg_ret("des", ret);
@ -134,7 +134,7 @@ int scene_menu_arrange(struct scene *scn, struct scene_obj_menu *menu)
* points to
*/
ret = scene_obj_set_pos(scn, menu->pointer_id,
menu->obj.x + 200, cur_y);
menu->obj.dim.x + 200, cur_y);
if (ret < 0)
return log_msg_ret("ptr", ret);
}