Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/The-Young-Maker/OpenMenuOS/llms.txt

Use this file to discover all available pages before exploring further.

This page documents every enum, struct, and typedef that OpenMenuOS.h exposes to your sketch. These types are the building blocks you pass to constructors and methods across the library. Understanding the defaults here lets you customize the look and behavior of your menu system with minimal boilerplate.

PopupType

Controls the color scheme, default icon, and default title of a popup. Pass one of these values to PopupConfig::type, or rely on the matching PopupManager::show*() convenience method which sets the type automatically.
enum class PopupType {
  INFO,     // Informational message (blue theme)
  SUCCESS,  // Success confirmation (green theme)
  WARNING,  // Warning message (orange theme)
  ERROR,    // Error message (red theme)
  QUESTION  // Question requiring user response (cyan theme)
};
INFO
PopupType
Blue header. Used for neutral informational messages. Default title: "Information". Requires manual dismissal.
SUCCESS
PopupType
Green header. Used to confirm a completed action. Default title: "Success". Auto-closes by default when called via PopupManager::showSuccess().
WARNING
PopupType
Orange header. Used to alert the user before a potentially risky action. Default title: "Warning". Requires manual dismissal.
ERROR
PopupType
Red header. Used to report a failure. Default title: "Error". Requires manual dismissal.
QUESTION
PopupType
Cyan header. Renders Yes and No buttons. Default title: "Question". Returns PopupResult::OK (Yes) or PopupResult::CANCEL (No).

PopupResult

Returned by PopupManager::update() and by all show* methods (immediately returning NONE on the call that opens the popup). Poll update() in loop() to detect when the user acts.
enum class PopupResult {
  NONE,   // No user interaction yet
  OK,     // User clicked OK/Yes button
  CANCEL, // User clicked Cancel/No button
  YES,    // Alias for OK in question dialogs
  NO      // Alias for CANCEL in question dialogs
};
NONE
PopupResult
The popup is still open and the user has not interacted yet. This is also what every show* method returns on the frame it is called.
OK
PopupResult
The user pressed the OK or Yes button, or the popup was dismissed by auto-close.
CANCEL
PopupResult
The user pressed the Cancel or No button.
YES
PopupResult
Alias for OK. Provided for readability in question-dialog branches.
NO
PopupResult
Alias for CANCEL. Provided for readability in question-dialog branches.

PopupConfig

A plain struct that describes everything about a popup before it is shown. Pass a configured instance to PopupManager::show() when the showInfo() / showWarning() / etc. convenience methods do not give you enough control.
struct PopupConfig {
  const char*     title           = nullptr;
  const char*     message         = nullptr;
  PopupType       type            = PopupType::INFO;
  bool            showButtons     = true;
  bool            showCancelButton = false;
  bool            autoClose       = false;
  uint32_t        autoCloseDelay  = 3000;
  uint16_t        customColor     = 0;
  const uint16_t* customIcon      = nullptr;
  uint16_t        customIconWidth  = 0;
  uint16_t        customIconHeight = 0;
};
title
const char*
default:"nullptr"
Header title text. When nullptr, a type-appropriate default is used ("Information", "Success", "Warning", "Error", or "Question").
message
const char*
default:"nullptr"
Required. Main body text. Long strings are word-wrapped automatically.
type
PopupType
default:"PopupType::INFO"
Selects the built-in color scheme and default icon. See PopupType above.
showButtons
bool
default:"true"
When true, action buttons are rendered. Set to false for a purely informational overlay that relies on autoClose.
showCancelButton
bool
default:"false"
When true, a Cancel/No button is shown alongside OK. Automatically true for PopupType::QUESTION.
autoClose
bool
default:"false"
When true, the popup closes automatically after autoCloseDelay milliseconds without user interaction.
autoCloseDelay
uint32_t
default:"3000"
Milliseconds before auto-close fires. Only relevant when autoClose is true.
customColor
uint16_t
default:"0"
RGB565 header color override. When 0, the color defined by type is used.
customIcon
const uint16_t*
default:"nullptr"
Pointer to raw RGB565 image data used as the popup icon. When nullptr, the built-in icon for the selected type is used.
customIconWidth
uint16_t
default:"0"
Width in pixels of the customIcon bitmap.
customIconHeight
uint16_t
default:"0"
Height in pixels of the customIcon bitmap.

ScreenConfig

A global configuration struct that controls the visual appearance and behavior of all screens managed by OpenMenuOS. Access it via Screen::config. Color values use 16-bit RGB565 format, matching the TFT_eSPI convention.
struct ScreenConfig {
  uint16_t scrollbarColor        = TFT_WHITE;
  uint16_t selectionBorderColor  = TFT_WHITE;
  uint16_t selectionFillColor    = TFT_BLACK;
  uint16_t selectedItemColor     = TFT_WHITE;

  bool scrollbar       = true;
  bool buttonAnimation = true;
  bool textScroll      = true;
  bool showImages      = false;
  bool animation       = true;

  int menuStyle      = 1;
  int scrollbarStyle = 1;
  int textShift      = -4;

  const float itemHeightRatio        = 0.30f;
  const float marginRatioX           = 0.05f;
  const float marginRatioY           = 0.01f;
  const float toggleSwitchHeightRatio = 0.26f;
  const float iconSizeRatio          = 0.06f;
};

Color fields

scrollbarColor
uint16_t
default:"TFT_WHITE"
RGB565 color of the scrollbar track and thumb.
selectionBorderColor
uint16_t
default:"TFT_WHITE"
RGB565 border color of the selection rectangle drawn around the active menu item.
selectionFillColor
uint16_t
default:"TFT_BLACK"
RGB565 fill color inside the selection rectangle.
selectedItemColor
uint16_t
default:"TFT_WHITE"
RGB565 text color used for the currently selected menu item label.

Feature toggles

scrollbar
bool
default:"true"
Show or hide the scrollbar when menu items overflow the screen.
buttonAnimation
bool
default:"true"
Animate the selection rectangle when the user presses a button.
textScroll
bool
default:"true"
Enable horizontal text scrolling for menu item labels that are wider than the available area.
showImages
bool
default:"false"
Render images (icons) associated with menu items via addItem(..., image).
animation
bool
default:"true"
Master switch for all general animations including transitions and easing.

Style fields

menuStyle
int
default:"1"
Visual style of the selection rectangle. 0 = outlined, 1 = filled.
scrollbarStyle
int
default:"1"
Scrollbar appearance variant. 0 = default, 1 = modern.
textShift
int
default:"-4"
Vertical pixel offset applied to menu item text for optical centering.

Layout ratio fields

These fields are const — they define proportions relative to screen dimensions and cannot be changed at runtime.
itemHeightRatio
const float
default:"0.30"
Height of the selection rectangle as a fraction of the screen height (30%).
marginRatioX
const float
default:"0.05"
Horizontal text margin as a fraction of the screen width (5%).
marginRatioY
const float
default:"0.01"
Vertical cleaning margin as a fraction of the screen height (1%).
toggleSwitchHeightRatio
const float
default:"0.26"
Toggle switch height as a fraction of the screen height (26%).
iconSizeRatio
const float
default:"0.06"
Icon size as a fraction of the screen height (6%).

Setting::Type

Defines the kind of interactive control rendered for a setting inside a SettingsScreen. The type determines both how the value is displayed and how the user edits it.
enum Type {
  BOOLEAN,  // On/off toggle switch
  RANGE,    // Numeric value with min/max bounds
  OPTION,   // Selection from a list of strings
  SUBSCREEN // Navigates to another Screen
};
BOOLEAN
Setting::Type
Renders an animated toggle switch. The value is true (on) or false (off). Create with SettingsScreen::addBooleanSetting().
RANGE
Setting::Type
Renders a numeric range control. The value is a uint8_t between min and max. Supports an optional unit label (e.g. "%", "dB"). Create with SettingsScreen::addRangeSetting().
OPTION
Setting::Type
Renders a selection list. The value is the index of the selected option string. Create with SettingsScreen::addOptionSetting().
SUBSCREEN
Setting::Type
Navigates to a linked Screen when selected. Use for nested settings menus. Create with SettingsScreen::addSubscreenSetting().

A plain struct that holds the data for one entry in a MenuScreen. Items are added via MenuScreen::addItem() — direct construction of MenuItem is not normally needed.
struct MenuItem {
  const char*     label;      // Display label
  Screen*         nextScreen; // Screen to push when selected
  ActionCallback  action;     // Callback to invoke when selected
  const uint16_t* image;      // Optional RGB565 icon bitmap
};
label
const char*
Text shown for this menu entry. When addItem(Screen* nextScreen) is used, label is set to the title returned by nextScreen->getTitle().
nextScreen
Screen*
Pointer to the screen that is pushed onto the navigation stack when this item is selected. Set to nullptr if the item only triggers an action.
action
ActionCallback
A void(*)() callback invoked when this item is selected. Set to nullptr when nextScreen handles the interaction. See ActionCallback.
image
const uint16_t*
Pointer to raw RGB565 bitmap data used as an icon. Only rendered when ScreenConfig::showImages is true. Set to nullptr for no icon.

ActionCallback

A typedef for a plain function pointer with no parameters and no return value. Used as the action field in MenuItem and as the action argument to MenuScreen::addItem().
typedef void (*ActionCallback)();
void showAbout() {
  PopupManager::showInfo("OpenMenuOS v3.1.0", "About");
}

// Register the callback when building the menu
mainMenu.addItem("About", nullptr, showAbout);
ActionCallback is a bare function pointer. Lambda expressions that capture variables cannot be assigned to it. For stateless lambdas (no captures) the compiler can convert them implicitly, but a named free function is the most portable option.

Build docs developers (and LLMs) love