blob: 0b1d944a169f47980c2df1122a449b730c90830f [file] [log] [blame]
Simon Glassd8adbe92023-01-06 08:52:36 -06001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright 2022 Google LLC
4 * Written by Simon Glass <sjg@chromium.org>
5 */
6
7#ifndef __SCENE_H
8#define __SCENE_H
9
Simon Glassc999e172023-06-01 10:22:53 -060010#include <dm/ofnode_decl.h>
Simon Glassd8adbe92023-01-06 08:52:36 -060011#include <linux/list.h>
12
13struct udevice;
Simon Glassc8925112023-06-01 10:23:02 -060014struct video_priv;
Simon Glassd8adbe92023-01-06 08:52:36 -060015
16/**
17 * enum expoact_type - types of actions reported by the expo
18 *
19 * @EXPOACT_NONE: no action
Simon Glassf0e1e8c2023-06-01 10:22:59 -060020 * @EXPOACT_POINT_OBJ: object was highlighted (@id indicates which)
Simon Glass719a3c62023-06-01 10:22:56 -060021 * @EXPOACT_POINT_ITEM: menu item was highlighted (@id indicates which)
Simon Glassd8adbe92023-01-06 08:52:36 -060022 * @EXPOACT_SELECT: menu item was selected (@id indicates which)
Simon Glassf0e1e8c2023-06-01 10:22:59 -060023 * @EXPOACT_OPEN: menu was opened, so an item can be selected (@id indicates
24 * which menu object)
25 * @EXPOACT_CLOSE: menu was closed (@id indicates which menu object)
Simon Glassd8adbe92023-01-06 08:52:36 -060026 * @EXPOACT_QUIT: request to exit the menu
27 */
28enum expoact_type {
29 EXPOACT_NONE,
Simon Glassf0e1e8c2023-06-01 10:22:59 -060030 EXPOACT_POINT_OBJ,
Simon Glass719a3c62023-06-01 10:22:56 -060031 EXPOACT_POINT_ITEM,
Simon Glassd8adbe92023-01-06 08:52:36 -060032 EXPOACT_SELECT,
Simon Glassf0e1e8c2023-06-01 10:22:59 -060033 EXPOACT_OPEN,
34 EXPOACT_CLOSE,
Simon Glassd8adbe92023-01-06 08:52:36 -060035 EXPOACT_QUIT,
36};
37
38/**
39 * struct expo_action - an action report by the expo
40 *
41 * @type: Action type (EXPOACT_NONE if there is no action)
Simon Glass719a3c62023-06-01 10:22:56 -060042 * @select: Used for EXPOACT_POINT_ITEM and EXPOACT_SELECT
Simon Glassd8adbe92023-01-06 08:52:36 -060043 * @id: ID number of the object affected.
44 */
45struct expo_action {
46 enum expoact_type type;
47 union {
48 struct {
49 int id;
50 } select;
51 };
52};
53
54/**
Simon Glassc999e172023-06-01 10:22:53 -060055 * struct expo_theme - theme for the expo
56 *
57 * @font_size: Default font size for all text
58 * @menu_inset: Inset width (on each side and top/bottom) for menu items
59 * @menuitem_gap_y: Gap between menu items in pixels
60 */
61struct expo_theme {
62 u32 font_size;
63 u32 menu_inset;
64 u32 menuitem_gap_y;
65};
66
67/**
Simon Glassd8adbe92023-01-06 08:52:36 -060068 * struct expo - information about an expo
69 *
70 * A group of scenes which can be presented to the user, typically to obtain
71 * input or to make a selection.
72 *
73 * @name: Name of the expo (allocated)
74 * @display: Display to use (`UCLASS_VIDEO`), or NULL to use text mode
Simon Glass67e2af12023-06-01 10:22:34 -060075 * @cons: Console to use (`UCLASS_VIDEO_CONSOLE`), or NULL to use text mode
Simon Glassd8adbe92023-01-06 08:52:36 -060076 * @scene_id: Current scene ID (0 if none)
77 * @next_id: Next ID number to use, for automatic allocation
78 * @action: Action selected by user. At present only one is supported, with the
79 * type set to EXPOACT_NONE if there is no action
80 * @text_mode: true to use text mode for the menu (no vidconsole)
Simon Glassd353b752023-06-01 10:22:55 -060081 * @popup: true to use popup menus, instead of showing all items
Simon Glassd8adbe92023-01-06 08:52:36 -060082 * @priv: Private data for the controller
Simon Glassc999e172023-06-01 10:22:53 -060083 * @theme: Information about fonts styles, etc.
Simon Glassd8adbe92023-01-06 08:52:36 -060084 * @scene_head: List of scenes
85 * @str_head: list of strings
86 */
87struct expo {
88 char *name;
89 struct udevice *display;
Simon Glass67e2af12023-06-01 10:22:34 -060090 struct udevice *cons;
Simon Glassd8adbe92023-01-06 08:52:36 -060091 uint scene_id;
92 uint next_id;
93 struct expo_action action;
94 bool text_mode;
Simon Glassd353b752023-06-01 10:22:55 -060095 bool popup;
Simon Glassd8adbe92023-01-06 08:52:36 -060096 void *priv;
Simon Glassc999e172023-06-01 10:22:53 -060097 struct expo_theme theme;
Simon Glassd8adbe92023-01-06 08:52:36 -060098 struct list_head scene_head;
99 struct list_head str_head;
100};
101
102/**
103 * struct expo_string - a string that can be used in an expo
104 *
105 * @id: ID number of the string
106 * @str: String
107 * @sibling: Node to link this object to its siblings
108 */
109struct expo_string {
110 uint id;
111 const char *str;
112 struct list_head sibling;
113};
114
115/**
116 * struct scene - information about a scene in an expo
117 *
118 * A collection of text/image/menu items in an expo
119 *
120 * @expo: Expo this scene is part of
121 * @name: Name of the scene (allocated)
122 * @id: ID number of the scene
Simon Glassea274b62023-06-01 10:22:27 -0600123 * @title_id: String ID of title of the scene (allocated)
Simon Glassd353b752023-06-01 10:22:55 -0600124 * @highlight_id: ID of highlighted object, if any
Simon Glassd8adbe92023-01-06 08:52:36 -0600125 * @sibling: Node to link this scene to its siblings
126 * @obj_head: List of objects in the scene
127 */
128struct scene {
129 struct expo *expo;
130 char *name;
131 uint id;
Simon Glassea274b62023-06-01 10:22:27 -0600132 uint title_id;
Simon Glassd353b752023-06-01 10:22:55 -0600133 uint highlight_id;
Simon Glassd8adbe92023-01-06 08:52:36 -0600134 struct list_head sibling;
135 struct list_head obj_head;
136};
137
138/**
139 * enum scene_obj_t - type of a scene object
140 *
141 * @SCENEOBJT_NONE: Used to indicate that the type does not matter
142 * @SCENEOBJT_IMAGE: Image data to render
143 * @SCENEOBJT_TEXT: Text line to render
144 * @SCENEOBJT_MENU: Menu containing items the user can select
145 */
146enum scene_obj_t {
147 SCENEOBJT_NONE = 0,
148 SCENEOBJT_IMAGE,
149 SCENEOBJT_TEXT,
150 SCENEOBJT_MENU,
151};
152
153/**
Simon Glass7b043952023-06-01 10:22:49 -0600154 * struct scene_dim - Dimensions of an object
155 *
156 * @x: x position, in pixels from left side
157 * @y: y position, in pixels from top
158 * @w: width, in pixels
159 * @h: height, in pixels
160 */
161struct scene_dim {
162 int x;
163 int y;
164 int w;
165 int h;
166};
167
168/**
Simon Glass6081b0f2023-06-01 10:22:50 -0600169 * enum scene_obj_flags_t - flags for objects
170 *
171 * @SCENEOF_HIDE: object should be hidden
Simon Glassd353b752023-06-01 10:22:55 -0600172 * @SCENEOF_POINT: object should be highlighted
173 * @SCENEOF_OPEN: object should be opened (e.g. menu is opened so that an option
174 * can be selected)
Simon Glass6081b0f2023-06-01 10:22:50 -0600175 */
176enum scene_obj_flags_t {
177 SCENEOF_HIDE = 1 << 0,
Simon Glassd353b752023-06-01 10:22:55 -0600178 SCENEOF_POINT = 1 << 1,
179 SCENEOF_OPEN = 1 << 2,
Simon Glass6081b0f2023-06-01 10:22:50 -0600180};
181
182/**
Simon Glassd8adbe92023-01-06 08:52:36 -0600183 * struct scene_obj - information about an object in a scene
184 *
185 * @scene: Scene that this object relates to
186 * @name: Name of the object (allocated)
187 * @id: ID number of the object
188 * @type: Type of this object
Simon Glass7b043952023-06-01 10:22:49 -0600189 * @dim: Dimensions for this object
Simon Glass6081b0f2023-06-01 10:22:50 -0600190 * @flags: Flags for this object
Simon Glassd8adbe92023-01-06 08:52:36 -0600191 * @sibling: Node to link this object to its siblings
192 */
193struct scene_obj {
194 struct scene *scene;
195 char *name;
196 uint id;
197 enum scene_obj_t type;
Simon Glass7b043952023-06-01 10:22:49 -0600198 struct scene_dim dim;
Simon Glass6081b0f2023-06-01 10:22:50 -0600199 int flags;
Simon Glassd8adbe92023-01-06 08:52:36 -0600200 struct list_head sibling;
201};
202
203/**
204 * struct scene_obj_img - information about an image object in a scene
205 *
206 * This is a rectangular image which is blitted onto the display
207 *
208 * @obj: Basic object information
209 * @data: Image data in BMP format
210 */
211struct scene_obj_img {
212 struct scene_obj obj;
213 char *data;
214};
215
216/**
217 * struct scene_obj_txt - information about a text object in a scene
218 *
219 * This is a single-line text object
220 *
221 * @obj: Basic object information
222 * @str_id: ID of the text string to display
223 * @font_name: Name of font (allocated by caller)
224 * @font_size: Nominal size of font in pixels
225 */
226struct scene_obj_txt {
227 struct scene_obj obj;
228 uint str_id;
229 const char *font_name;
230 uint font_size;
231};
232
233/**
234 * struct scene_obj_menu - information about a menu object in a scene
235 *
236 * A menu has a number of items which can be selected by the user
237 *
238 * It also has:
239 *
240 * - a text/image object (@pointer_id) which points to the current item
241 * (@cur_item_id)
242 *
243 * - a preview object which shows an image related to the current item
244 *
245 * @obj: Basic object information
246 * @title_id: ID of the title text, or 0 if none
247 * @cur_item_id: ID of the current menu item, or 0 if none
248 * @pointer_id: ID of the object pointing to the current selection
249 * @item_head: List of items in the menu
250 */
251struct scene_obj_menu {
252 struct scene_obj obj;
253 uint title_id;
254 uint cur_item_id;
255 uint pointer_id;
256 struct list_head item_head;
257};
258
259/**
260 * enum scene_menuitem_flags_t - flags for menu items
261 *
262 * @SCENEMIF_GAP_BEFORE: Add a gap before this item
263 */
264enum scene_menuitem_flags_t {
265 SCENEMIF_GAP_BEFORE = 1 << 0,
266};
267
268/**
269 * struct scene_menitem - a menu item in a menu
270 *
271 * A menu item has:
272 *
273 * - text object holding the name (short) and description (can be longer)
274 * - a text object holding the keypress
275 *
276 * @name: Name of the item (this is allocated by this call)
277 * @id: ID number of the object
278 * @key_id: ID of text object to use as the keypress to show
279 * @label_id: ID of text object to use as the label text
280 * @desc_id: ID of text object to use as the description text
281 * @preview_id: ID of the preview object, or 0 if none
282 * @flags: Flags for this item
283 * @sibling: Node to link this item to its siblings
284 */
285struct scene_menitem {
286 char *name;
287 uint id;
288 uint key_id;
289 uint label_id;
290 uint desc_id;
291 uint preview_id;
292 uint flags;
293 struct list_head sibling;
294};
295
296/**
297 * expo_new() - create a new expo
298 *
299 * Allocates a new expo
300 *
301 * @name: Name of expo (this is allocated by this call)
302 * @priv: Private data for the controller
303 * @expp: Returns a pointer to the new expo on success
304 * Returns: 0 if OK, -ENOMEM if out of memory
305 */
306int expo_new(const char *name, void *priv, struct expo **expp);
307
308/**
309 * expo_destroy() - Destroy an expo and free all its memory
310 *
311 * @exp: Expo to destroy
312 */
313void expo_destroy(struct expo *exp);
314
315/**
Simon Glass6e9e4152023-06-01 10:22:47 -0600316 * expo_set_dynamic_start() - Set the start of the 'dynamic' IDs
317 *
318 * It is common for a set of 'static' IDs to be used to refer to objects in the
319 * expo. These typically use an enum so that they are defined in sequential
320 * order.
321 *
322 * Dynamic IDs (for objects not in the enum) are intended to be used for
323 * objects to which the code does not need to refer. These are ideally located
324 * above the static IDs.
325 *
326 * Use this function to set the start of the dynamic range, making sure that the
327 * value is higher than all the statically allocated IDs.
328 *
329 * @exp: Expo to update
330 * @dyn_start: Start ID that expo should use for dynamic allocation
331 */
332void expo_set_dynamic_start(struct expo *exp, uint dyn_start);
333
334/**
Simon Glassd8adbe92023-01-06 08:52:36 -0600335 * expo_str() - add a new string to an expo
336 *
337 * @exp: Expo to update
338 * @name: Name to use (this is allocated by this call)
339 * @id: ID to use for the new object (0 to allocate one)
340 * @str: Pointer to text to display (allocated by caller)
341 * Returns: ID number for the object (typically @id), or -ve on error
342 */
343int expo_str(struct expo *exp, const char *name, uint id, const char *str);
344
345/**
346 * expo_get_str() - Get a string by ID
347 *
348 * @exp: Expo to use
349 * @id: String ID to look up
350 * @returns string, or NULL if not found
351 */
352const char *expo_get_str(struct expo *exp, uint id);
353
354/**
355 * expo_set_display() - set the display to use for a expo
356 *
357 * @exp: Expo to update
358 * @dev: Display to use (`UCLASS_VIDEO`), NULL to use text mode
359 * Returns: 0 (always)
360 */
361int expo_set_display(struct expo *exp, struct udevice *dev);
362
363/**
Simon Glass7a960052023-06-01 10:22:52 -0600364 * expo_calc_dims() - Calculate the dimensions of the objects
365 *
366 * Updates the width and height of all objects based on their contents
367 *
368 * @exp: Expo to update
369 * Returns 0 if OK, -ENOTSUPP if there is no graphical console
370 */
371int expo_calc_dims(struct expo *exp);
372
373/**
Simon Glassd8adbe92023-01-06 08:52:36 -0600374 * expo_set_scene_id() - Set the current scene ID
375 *
376 * @exp: Expo to update
377 * @scene_id: New scene ID to use (0 to select no scene)
378 * Returns: 0 if OK, -ENOENT if there is no scene with that ID
379 */
380int expo_set_scene_id(struct expo *exp, uint scene_id);
381
382/**
Simon Glassc8925112023-06-01 10:23:02 -0600383 * expo_first_scene_id() - Get the ID of the first scene
384 *
385 * @exp: Expo to check
386 * Returns: Scene ID of first scene, or -ENOENT if there are no scenes
387 */
388int expo_first_scene_id(struct expo *exp);
389
390/**
Simon Glassd8adbe92023-01-06 08:52:36 -0600391 * expo_render() - render the expo on the display / console
392 *
393 * @exp: Expo to render
394 *
395 * Returns: 0 if OK, -ECHILD if there is no current scene, -ENOENT if the
396 * current scene is not found, other error if something else goes wrong
397 */
398int expo_render(struct expo *exp);
399
400/**
Simon Glassb2c40342023-06-01 10:22:37 -0600401 * expo_set_text_mode() - Controls whether the expo renders in text mode
Simon Glassd8adbe92023-01-06 08:52:36 -0600402 *
403 * @exp: Expo to update
404 * @text_mode: true to use text mode, false to use the console
405 */
Simon Glassb2c40342023-06-01 10:22:37 -0600406void expo_set_text_mode(struct expo *exp, bool text_mode);
Simon Glassd8adbe92023-01-06 08:52:36 -0600407
408/**
409 * scene_new() - create a new scene in a expo
410 *
411 * The scene is given the ID @id which must be unique across all scenes, objects
412 * and items. The expo's @next_id is updated to at least @id + 1
413 *
414 * @exp: Expo to update
415 * @name: Name to use (this is allocated by this call)
416 * @id: ID to use for the new scene (0 to allocate one)
417 * @scnp: Returns a pointer to the new scene on success
418 * Returns: ID number for the scene (typically @id), or -ve on error
419 */
420int scene_new(struct expo *exp, const char *name, uint id, struct scene **scnp);
421
422/**
423 * expo_lookup_scene_id() - Look up a scene by ID
424 *
425 * @exp: Expo to check
426 * @scene_id: Scene ID to look up
427 * @returns pointer to scene if found, else NULL
428 */
429struct scene *expo_lookup_scene_id(struct expo *exp, uint scene_id);
430
431/**
Simon Glass01922ec2023-06-01 10:22:57 -0600432 * scene_highlight_first() - Highlight the first item in a scene
433 *
434 * This highlights the first item, so that the user can see that it is pointed
435 * to
436 *
437 * @scn: Scene to update
438 */
439void scene_highlight_first(struct scene *scn);
440
441/**
442 * scene_set_highlight_id() - Set the object which is highlighted
443 *
444 * Sets a new object to highlight in the scene
445 *
446 * @scn: Scene to update
447 * @id: ID of object to highlight
448 */
449void scene_set_highlight_id(struct scene *scn, uint id);
450
451/**
452 * scene_set_open() - Set whether an item is open or not
453 *
454 * @scn: Scene to update
455 * @id: ID of object to update
456 * @open: true to open the object, false to close it
457 * Returns: 0 if OK, -ENOENT if @id is invalid
458 */
459int scene_set_open(struct scene *scn, uint id, bool open);
460
461/**
Simon Glassd8adbe92023-01-06 08:52:36 -0600462 * scene_title_set() - set the scene title
463 *
464 * @scn: Scene to update
Simon Glassea274b62023-06-01 10:22:27 -0600465 * @title_id: Title ID to set
466 * Returns: 0 if OK
Simon Glassd8adbe92023-01-06 08:52:36 -0600467 */
Simon Glassea274b62023-06-01 10:22:27 -0600468int scene_title_set(struct scene *scn, uint title_id);
Simon Glassd8adbe92023-01-06 08:52:36 -0600469
470/**
471 * scene_obj_count() - Count the number of objects in a scene
472 *
473 * @scn: Scene to check
474 * Returns: number of objects in the scene, 0 if none
475 */
476int scene_obj_count(struct scene *scn);
477
478/**
479 * scene_img() - add a new image to a scene
480 *
481 * @scn: Scene to update
482 * @name: Name to use (this is allocated by this call)
483 * @id: ID to use for the new object (0 to allocate one)
484 * @data: Pointer to image data
485 * @imgp: If non-NULL, returns the new object
486 * Returns: ID number for the object (typically @id), or -ve on error
487 */
488int scene_img(struct scene *scn, const char *name, uint id, char *data,
489 struct scene_obj_img **imgp);
490
491/**
492 * scene_txt() - add a new text object to a scene
493 *
494 * @scn: Scene to update
495 * @name: Name to use (this is allocated by this call)
496 * @id: ID to use for the new object (0 to allocate one)
497 * @str_id: ID of the string to use
498 * @txtp: If non-NULL, returns the new object
499 * Returns: ID number for the object (typically @id), or -ve on error
500 */
501int scene_txt(struct scene *scn, const char *name, uint id, uint str_id,
502 struct scene_obj_txt **txtp);
503
504/**
505 * scene_txt_str() - add a new string to expr and text object to a scene
506 *
507 * @scn: Scene to update
508 * @name: Name to use (this is allocated by this call)
509 * @id: ID to use for the new object (0 to allocate one)
510 * @str_id: ID of the string to use
511 * @str: Pointer to text to display (allocated by caller)
512 * @txtp: If non-NULL, returns the new object
513 * Returns: ID number for the object (typically @id), or -ve on error
514 */
515int scene_txt_str(struct scene *scn, const char *name, uint id, uint str_id,
516 const char *str, struct scene_obj_txt **txtp);
517
518/**
519 * scene_menu() - create a menu
520 *
521 * @scn: Scene to update
522 * @name: Name to use (this is allocated by this call)
523 * @id: ID to use for the new object (0 to allocate one)
524 * @menup: If non-NULL, returns the new object
525 * Returns: ID number for the object (typically @id), or -ve on error
526 */
527int scene_menu(struct scene *scn, const char *name, uint id,
528 struct scene_obj_menu **menup);
529
530/**
531 * scene_txt_set_font() - Set the font for an object
532 *
533 * @scn: Scene to update
534 * @id: ID of object to update
535 * @font_name: Font name to use (allocated by caller)
536 * @font_size: Font size to use (nominal height in pixels)
537 */
538int scene_txt_set_font(struct scene *scn, uint id, const char *font_name,
539 uint font_size);
540
541/**
542 * scene_obj_set_pos() - Set the postion of an object
543 *
544 * @scn: Scene to update
545 * @id: ID of object to update
546 * @x: x position, in pixels from left side
547 * @y: y position, in pixels from top
548 * Returns: 0 if OK, -ENOENT if @id is invalid
549 */
550int scene_obj_set_pos(struct scene *scn, uint id, int x, int y);
551
552/**
Simon Glass7a960052023-06-01 10:22:52 -0600553 * scene_obj_set_size() - Set the size of an object
554 *
555 * @scn: Scene to update
556 * @id: ID of object to update
557 * @w: width in pixels
558 * @h: height in pixels
559 * Returns: 0 if OK, -ENOENT if @id is invalid
560 */
561int scene_obj_set_size(struct scene *scn, uint id, int w, int h);
562
563/**
Simon Glassd8adbe92023-01-06 08:52:36 -0600564 * scene_obj_set_hide() - Set whether an object is hidden
565 *
566 * The update happens when the expo is next rendered.
567 *
568 * @scn: Scene to update
569 * @id: ID of object to update
570 * @hide: true to hide the object, false to show it
571 * Returns: 0 if OK, -ENOENT if @id is invalid
572 */
573int scene_obj_set_hide(struct scene *scn, uint id, bool hide);
574
575/**
576 * scene_menu_set_title() - Set the title of a menu
577 *
578 * @scn: Scene to update
579 * @id: ID of menu object to update
580 * @title_id: ID of text object to use as the title
581 * Returns: 0 if OK, -ENOENT if @id is invalid, -EINVAL if @title_id is invalid
582 */
583int scene_menu_set_title(struct scene *scn, uint id, uint title_id);
584
585/**
586 * scene_menu_set_pointer() - Set the item pointer for a menu
587 *
588 * This is a visual indicator of the current item, typically a ">" character
589 * which sits next to the current item and moves when the user presses the
590 * up/down arrow keys
591 *
592 * @scn: Scene to update
593 * @id: ID of menu object to update
594 * @cur_item_id: ID of text or image object to use as a pointer to the current
595 * item
596 * Returns: 0 if OK, -ENOENT if @id is invalid, -EINVAL if @cur_item_id is invalid
597 */
598int scene_menu_set_pointer(struct scene *scn, uint id, uint cur_item_id);
599
600/**
601 * scene_obj_get_hw() - Get width and height of an object in a scene
602 *
603 * @scn: Scene to check
604 * @id: ID of menu object to check
605 * @widthp: If non-NULL, returns width of object in pixels
606 * Returns: Height of object in pixels
607 */
608int scene_obj_get_hw(struct scene *scn, uint id, int *widthp);
609
610/**
611 * scene_menuitem() - Add an item to a menu
612 *
613 * @scn: Scene to update
614 * @menu_id: ID of menu object to update
615 * @name: Name to use (this is allocated by this call)
616 * @id: ID to use for the new object (0 to allocate one)
617 * @key_id: ID of text object to use as the keypress to show
618 * @label_id: ID of text object to use as the label text
619 * @desc_id: ID of text object to use as the description text
620 * @preview_id: ID of object to use as the preview (text or image)
621 * @flags: Flags for this item (enum scene_menuitem_flags_t)
622 * @itemp: If non-NULL, returns the new object
623 * Returns: ID number for the item (typically @id), or -ve on error
624 */
625int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id,
626 uint key_id, uint label_id, uint desc_id, uint preview_id,
627 uint flags, struct scene_menitem **itemp);
628
629/**
630 * scene_arrange() - Arrange the scene to deal with object sizes
631 *
632 * Updates any menus in the scene so that their objects are in the right place.
633 *
634 * @scn: Scene to arrange
635 * Returns: 0 if OK, -ve on error
636 */
637int scene_arrange(struct scene *scn);
638
639/**
640 * expo_send_key() - set a keypress to the expo
641 *
642 * @exp: Expo to receive the key
643 * @key: Key to send (ASCII or enum bootmenu_key)
644 * Returns: 0 if OK, -ECHILD if there is no current scene
645 */
646int expo_send_key(struct expo *exp, int key);
647
648/**
649 * expo_action_get() - read user input from the expo
650 *
651 * @exp: Expo to check
652 * @act: Returns action
653 * Returns: 0 if OK, -EAGAIN if there was no action to return
654 */
655int expo_action_get(struct expo *exp, struct expo_action *act);
656
Simon Glassc999e172023-06-01 10:22:53 -0600657/**
658 * expo_apply_theme() - Apply a theme to an expo
659 *
660 * @exp: Expo to update
661 * @node: Node containing the theme
662 */
663int expo_apply_theme(struct expo *exp, ofnode node);
664
Simon Glass61300722023-06-01 10:23:01 -0600665/**
666 * expo_build() - Build an expo from an FDT description
667 *
668 * Build a complete expo from a description in the provided devicetree.
669 *
670 * See doc/developer/expo.rst for a description of the format
671 *
672 * @root: Root node for expo description
673 * @expp: Returns the new expo
674 * Returns: 0 if OK, -ENOMEM if out of memory, -EINVAL if there is a format
675 * error, -ENOENT if there is a references to a non-existent string
676 */
677int expo_build(ofnode root, struct expo **expp);
678
Simon Glassc8925112023-06-01 10:23:02 -0600679/**
680 * cedit_arange() - Arrange objects in a configuration-editor scene
681 *
682 * @exp: Expo to update
683 * @vid_priv: Private info of the video device
684 * @scene_id: scene ID to arrange
685 * Returns: 0 if OK, -ve on error
686 */
687int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id);
688
689/**
690 * cedit_run() - Run a configuration editor
691 *
692 * This accepts input until the user quits with Escape
693 *
694 * @exp: Expo to use
695 * Returns: 0 if OK, -ve on error
696 */
697int cedit_run(struct expo *exp);
698
Simon Glassd8adbe92023-01-06 08:52:36 -0600699#endif /*__SCENE_H */