Graphical user interface#
A physical calculator is constrained to fixed labels for the keys as these can’t be updated when the calculator mode changes. A graphical user interface representation of the calculator doesn’t have these restrictions. The hardware abstraction layer supports the ability to change the labels on the keys dependent on the mode.
For the implementer of this function, there is no need to keep mode state since the function will be called everytime the layout should change. There is also no need to send any different values for callbacks when keys are pressed. Physical calculators will have an empty implementation for this function.
For the caller of this function, every time the mode changes in a way that the keys should be displayed differently the appropriate layout should be selected.
Functions#
Defines
-
MAX_GUI_LAYOUTS#
Enums
Functions
-
void guiSetLayout(guiLayout_t layout)#
Show the keys associated with the specified layout.
The graphical user interface should update the labels on the keys to show the outcome of pressing the key in the given layout.
- Parameters
layout – [in] the layout for the key labels
Example#
When the mode changes the appropriate layout should be used as an argument to
the guiSetLayout function to ensure the labels on the keys are correct.
switch(newMode) {
case cmNormal:
guiSetLayout(glNormal);
...
break;
case cmAim:
guiSetLayout(glAim);
...
break;
}