Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / common / screen-framework / README.md
1 # Simple Screen UI Framework
2
3 ## Overview
4
5 This is a framework for creating simple user interfaces for devices with tiny
6 screens and just a few buttons.
7
8 For example, the [M5Stack](http://m5stack.com/) ESP32 Basic Core IoT device has
9 a 320x240 TFT display and three push buttons.
10
11 This framework enables a UI such as the following, where focus is indicated by
12 color, the left and middle buttons function as a single axis navpad, the right
13 button function as an action button, and the back button is provided by the
14 framework onscreen:
15
16     +--------------------------------------+
17     |  <  SCREEN TITLE                     |
18     |     ------------                     |
19     |                                      |
20     |     ITEM 1                           |
21     |     ITEM 2                           |
22     |     ITEM 3                           |
23     |                                      |
24     |                                      |
25     |                                      |
26     |                                      |
27     |   PREVIOUS      NEXT       ACTION    |
28     +--------------------------------------+
29
30 ## Features
31
32 -   stack of screens with system back button
33 -   labeled buttons for navigation and action
34 -   focus handling
35 -   custom screen content
36 -   virtual LEDs (VLEDs)
37
38 ## Screen Manager
39
40 The screen manager maintains a stack of screens that are pushed and popped for
41 interaction. Each is drawn with a title, system back button, three button
42 labels, and custom screen content. The screen manager dispatches events to the
43 topmost screen, such as:
44
45 -   enter/exit events (including whether the screen was pushed or popped)
46 -   focus events (for navigation)
47 -   action events
48 -   display events (lazily)
49
50 If configured, virtual LEDs (VLEDs) are omnipresent and can be toggled at will.
51
52 ## Screen
53
54 Screens provide a title and three button labels to the screen manager. They
55 handle events from the screen manager, and cooperate to ensure focus behaves
56 nicely.
57
58 ## Focus Handling
59
60 Screens are created without focus, and indicate to the screen manager whether
61 they can receive focus. If so, the screen manager focuses them when they are
62 pushed, and subsequently dispatches focus next/previous events which the screen
63 can use for navigation before any action is performed.
64
65 The screen can request the screen manager to focus the system back button, which
66 is always available except when there are no covered screens on the stack. In
67 this way, a list screen can wrap its focus of list items through the system back
68 button if it is available, while skipping it otherwise.
69
70 Blur and unblur focus events allow a screen's focus state to be preserved when
71 it is covered by a pushed screen and restored when it is subsequently uncovered.
72
73 In summary, screens collaborate with the screen manager to handle focus via the
74 following focus event types:
75
76 -   NONE: remove focus from screen completely
77 -   BLUR: unfocus screen (but retain focus state)
78 -   UNBLUR: restore focus state (that was retained when blurred)
79 -   NEXT: navigate focus forward in screen (possibly requesting focus back
80     button)
81 -   PREVIOUS: navigate focus forward (possibly requesting back button focus)
82
83 ## Typical Usage
84
85 A list screen can provide multiple options to the user. Each list item can push
86 another screen on the stack with more items. In this way a hierarchy of screens
87 can be formed.
88
89 The back button dismisses a screen much as "escape" or "cancel" would. It's
90 possible to push an informational screen that is not focusable and has no
91 interaction, such that the only action available is back.