@@ -316,7 +316,7 @@ int scene_obj_set_size(struct scene *scn, uint id, int w, int h)
return 0;
}
-int scene_obj_set_width(struct scene *scn, uint id, int w)
+int scene_obj_set_width_flags(struct scene *scn, uint id, int w, uint flags)
{
struct scene_obj *obj;
@@ -324,11 +324,16 @@ int scene_obj_set_width(struct scene *scn, uint id, int w)
if (!obj)
return log_msg_ret("find", -ENOENT);
obj->req_bbox.x1 = obj->req_bbox.x0 + w;
- obj->flags |= SCENEOF_SYNC_WIDTH;
+ obj->flags |= flags;
return 0;
}
+int scene_obj_set_width(struct scene *scn, uint id, int w)
+{
+ return scene_obj_set_width_flags(scn, id, w, SCENEOF_SYNC_WIDTH);
+}
+
int scene_obj_set_bbox(struct scene *scn, uint id, int x0, int y0, int x1,
int y1)
{
@@ -359,13 +359,14 @@ int scene_menu_arrange(struct scene *scn, struct expo_arrange_info *arr,
y += height + theme->menuitem_gap_y;
}
+ /* line up the right size of each set of items */
list_for_each_entry(item, &menu->item_head, sibling) {
- scene_obj_set_width(menu->obj.scene, item->label_id,
- dims[SCENEBB_label].x);
- scene_obj_set_width(menu->obj.scene, item->key_id,
- dims[SCENEBB_key].x);
- scene_obj_set_width(menu->obj.scene, item->desc_id,
- dims[SCENEBB_desc].x);
+ scene_obj_set_width_flags(menu->obj.scene, item->label_id,
+ dims[SCENEBB_label].x, 0);
+ scene_obj_set_width_flags(menu->obj.scene, item->key_id,
+ dims[SCENEBB_key].x, 0);
+ scene_obj_set_width_flags(menu->obj.scene, item->desc_id,
+ dims[SCENEBB_desc].x, 0);
}
if (sel_id)
@@ -943,6 +943,20 @@ int scene_obj_set_pos(struct scene *scn, uint id, int x, int y);
*/
int scene_obj_set_size(struct scene *scn, uint id, int w, int h);
+/**
+ * scene_obj_set_width_flags() - Set the width of an object, with flags
+ *
+ * The given width is marked as 'requested' and will be applied when the scene
+ * is next arranged. The object flags are ORed with @flags
+ *
+ * @scn: Scene to update
+ * @id: ID of object to update
+ * @w: width in pixels
+ * @flags: Flags to OR with the current flags
+ * Returns: 0 if OK, -ENOENT if @id is invalid
+ */
+int scene_obj_set_width_flags(struct scene *scn, uint id, int w, uint flags);
+
/**
* scene_obj_set_width() - Set the width of an object
*