A menu page for small screens. More...
A menu page for small screens.
This class builds upon the menu logic of AbstractMenu and adds drawing routines that are suitable for small screens.
By default, it will paint to the canvas returned by UI::GetPrimaryOneBitGraphicsDisplayId()
. It can also be configured to paint to a different canvas.
Each item will occupy the entire display. FullScreenItemMenu uses the LookAndFeel system to draw draw the items. This means that you can create your own graphics design by creating your own LookAndFeel based on the OneBitGraphicsLookAndFeel class and apply that either globally (UI::SetOneBitGraphicsLookAndFeel()) or to this page only (UiPage::SetOneBitGraphicsLookAndFeel()).
#include <FullScreenItemMenu.h>
Additional Inherited Members | |
Public Types inherited from daisy::AbstractMenu | |
enum class | Orientation { leftRightSelectUpDownModify , upDownSelectLeftRightModify } |
enum class | ItemType { callbackFunctionItem , checkboxItem , valueItem , openUiPageItem , closeMenuItem , customItem } |
Protected Member Functions inherited from daisy::AbstractMenu | |
void | Init (const ItemConfig *items, uint16_t numItems, Orientation orientation, bool allowEntering) |
bool | IsFunctionButtonDown () const |
Protected Attributes inherited from daisy::AbstractMenu | |
Orientation | orientation_ = Orientation::upDownSelectLeftRightModify |
const ItemConfig * | items_ = nullptr |
uint16_t | numItems_ = 0 |
int16_t | selectedItemIdx_ = -1 |
bool | allowEntering_ = true |
bool | isEditing_ = false |
|
overridevirtual |
Called to make the UIPage repaint everything on a canvas. Check the ID to determine which display this corresponds to. Cast the handle to the corresponding type and do your draw operations on it.
Implements daisy::UiPage.
void daisy::FullScreenItemMenu::Init | ( | const AbstractMenu::ItemConfig * | items, |
uint16_t | numItems, | ||
AbstractMenu::Orientation | orientation = AbstractMenu::Orientation::leftRightSelectUpDownModify , |
||
bool | allowEntering = true |
||
) |
Call this to initialize the menu. It's okay to re-initialize a FullScreenItemMenu multiple times, even while it's displayed on the UI.
items | An array of ItemConfig that determine which items are available in the menu. |
numItems | The number of items in the items array. |
orientation | Controls which pair of arrow buttons are used for selection / editing |
allowEntering | Globally controls if the Ok button can enter items for editing. If you have a physical controls that can edit selected items directly (value slider, a second arrow button pair, value encoder) you can set this to false, otherwise you set it to true so that the controls used for selecting items can now also be used to edit the values. |
Call this to change which canvas this menu will draw to. The canvas must be a OneBitGraphicsDisplay
, e.g. the OledDisplay
class. If canvasId == UI::invalidCanvasId
then this menu will draw to the canvas returned by UI::GetPrimaryOneBitGraphicsDisplayId()
. This is also the default behaviour.