LCDGFX LCD display driver  1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI

Checkbox menu widget for lcdgfx. More...

#include <checkbox_menu.h>

Public Member Functions

 LcdGfxCheckboxMenu (const char **items, uint8_t count, const NanoRect &rect={})
 Creates checkbox menu object. More...
 
void down ()
 Moves selection down by one item. More...
 
void up ()
 Moves selection up by one item. More...
 
void toggle ()
 Toggles the checkbox state of the currently selected item.
 
bool isChecked (uint8_t index)
 Returns true if the item at the given index is checked. More...
 
void setChecked (uint8_t index, bool checked)
 Sets the checkbox state of a specific item. More...
 
uint16_t checkedMask ()
 Returns the full checkbox state as a bitmask. More...
 
uint8_t selection ()
 Returns currently selected menu item index.
 
void setSelection (uint8_t s)
 Sets the current selection index. More...
 
void setRect (const NanoRect &rect={})
 Sets rect area for the menu. More...
 
uint8_t size ()
 Returns total count of menu items.
 
template<typename D >
void updateSize (D &d)
 Updates size of the object if not set previously.
 
template<typename D >
void show (D &d)
 Shows the checkbox menu on the display. More...
 

Detailed Description

Checkbox menu widget for lcdgfx.

Each menu item is displayed with a checkbox indicator (filled box = checked, empty box = unchecked). Navigate with up()/down() and toggle the current item's checkbox with toggle(). Supports up to 16 items.

Includes scroll indicators (arrows and scrollbar) when items overflow.

const char *items[] = {"WiFi", "Bluetooth", "LED"};
LcdGfxCheckboxMenu menu(items, 3);
menu.setChecked(0, true); // WiFi starts checked
menu.show(display);
// On select button:
menu.toggle();
menu.show(display);

Definition at line 69 of file checkbox_menu.h.

Constructor & Destructor Documentation

◆ LcdGfxCheckboxMenu()

LcdGfxCheckboxMenu::LcdGfxCheckboxMenu ( const char **  items,
uint8_t  count,
const NanoRect rect = {} 
)

Creates checkbox menu object.

Parameters
itemsarray of null-terminated strings (in SRAM)
countcount of menu items (max 16)
rectscreen area for the menu (0,0 = auto-size to display)

Member Function Documentation

◆ checkedMask()

uint16_t LcdGfxCheckboxMenu::checkedMask ( )

Returns the full checkbox state as a bitmask.

Bit 0 = item 0, bit 1 = item 1, etc.

Returns
bitmask of checked items

◆ down()

void LcdGfxCheckboxMenu::down ( )

Moves selection down by one item.

Wraps to first item.

◆ isChecked()

bool LcdGfxCheckboxMenu::isChecked ( uint8_t  index)

Returns true if the item at the given index is checked.

Parameters
indexitem index (0-based)
Returns
true if checked

◆ setChecked()

void LcdGfxCheckboxMenu::setChecked ( uint8_t  index,
bool  checked 
)

Sets the checkbox state of a specific item.

Parameters
indexitem index (0-based)
checkedtrue to check, false to uncheck

◆ setRect()

void LcdGfxCheckboxMenu::setRect ( const NanoRect rect = {})

Sets rect area for the menu.

Parameters
rectrect area to use

◆ setSelection()

void LcdGfxCheckboxMenu::setSelection ( uint8_t  s)

Sets the current selection index.

Parameters
sitem index

◆ show()

template<typename D >
void LcdGfxCheckboxMenu::show ( D &  d)

Shows the checkbox menu on the display.

Includes scroll indicators when items overflow the visible area.

Parameters
ddisplay object

Definition at line 276 of file checkbox_menu.h.

◆ up()

void LcdGfxCheckboxMenu::up ( )

Moves selection up by one item.

Wraps to last item.


The documentation for this class was generated from the following file: