CheeseBoard
A library for use with the CheeseBoard Cheddar platform
|
#include <GfxStringListBox.h>
Public Member Functions | |
GfxStringListBox (uint16_t width) | |
int16_t | add (const String s) |
bool | remove (const uint8_t idx, bool compactAfter=true) |
void | draw (uint16_t xOffset=0, uint16_t yOffset=0) |
uint16_t | width () |
uint16_t | height () |
int16_t | find (const String s, uint8_t n=1) |
bool | select (int16_t idx) |
int16_t | selected () |
uint8_t | scrollDown (uint8_t rows) |
uint8_t | scrollUp (uint8_t rows) |
bool | scrollTo (uint8_t idx) |
Static Public Attributes | |
static const uint8_t | MaxItems = 10 |
Protected Member Functions | |
int16_t | findGap (uint8_t startAt=0) |
int16_t | findNext (uint8_t from=0) |
int16_t | findPreceding (uint8_t from=MaxItems) |
bool | isCompacted () |
Sort the items contained in the list box using quicksort. More... | |
void | compact () |
Make used items contiguous (remove gaps) More... | |
bool | isOnScreen (uint8_t idx) |
uint8_t | rowsFrom (uint8_t idx) |
Protected Attributes | |
String * | _items [MaxItems] |
uint16_t | _width |
uint16_t | _lineHeight |
int16_t | _selected |
uint8_t | _screenLines |
uint8_t | _screenStart |
Scrollable list box of strings [experimental].
Definition at line 9 of file GfxStringListBox.h.
int16_t GfxStringListBox::add | ( | const String | s | ) |
Adds a string item to the list box at the first free entry.
s | the string to add to the list box. |
Definition at line 31 of file GfxStringListBox.cpp.
|
protected |
Make used items contiguous (remove gaps)
Make used items contiguous (remove gaps).
Definition at line 153 of file GfxStringListBox.cpp.
|
virtual |
Draw the GfxStringListBox (do not send buffer to CbOledDisplay).
Items contains NULL strings will not be displayed.
Implements GfxItem.
Definition at line 63 of file GfxStringListBox.cpp.
int16_t GfxStringListBox::find | ( | const String | s, |
uint8_t | n = 1 |
||
) |
s | the string to add. |
n | the nth instance to search for. |
Definition at line 123 of file GfxStringListBox.cpp.
|
protected |
startAt | index to start looking for gaps at. |
Definition at line 88 of file GfxStringListBox.cpp.
|
protected |
from | the index to search from. |
Definition at line 99 of file GfxStringListBox.cpp.
|
protected |
from | the index to search from. |
Definition at line 109 of file GfxStringListBox.cpp.
|
virtual |
Get object height.
Implements GfxItem.
Definition at line 83 of file GfxStringListBox.cpp.
|
protected |
Sort the items contained in the list box using quicksort.
Sort the items contained in the list box using quicksort.
Definition at line 139 of file GfxStringListBox.cpp.
|
protected |
Find out if idx is currently visible on screen.
Definition at line 186 of file GfxStringListBox.cpp.
bool GfxStringListBox::remove | ( | const uint8_t | idx, |
bool | compactAfter = true |
||
) |
Remove item at index idx.
idx | the index of the item to remove. |
compactAfter | if true, compact() will be called after the item is removed. |
Definition at line 42 of file GfxStringListBox.cpp.
|
protected |
Find out how many rows after there from idx on (which are non-NULL).
Definition at line 200 of file GfxStringListBox.cpp.
uint8_t GfxStringListBox::scrollDown | ( | uint8_t | rows | ) |
Scroll down the display a number of rows.
Definition at line 211 of file GfxStringListBox.cpp.
bool GfxStringListBox::scrollTo | ( | uint8_t | idx | ) |
scrolls the displayed items until idx is displayed.
Note: if idx is currently displayed, no scrolling is performed.
Definition at line 245 of file GfxStringListBox.cpp.
uint8_t GfxStringListBox::scrollUp | ( | uint8_t | rows | ) |
Scroll up the display a number of rows.
Definition at line 230 of file GfxStringListBox.cpp.
bool GfxStringListBox::select | ( | int16_t | idx | ) |
Select item at index idx.
idx | the index of the item to select, or -1 to de-select. |
Definition at line 169 of file GfxStringListBox.cpp.
int16_t GfxStringListBox::selected | ( | ) |
Definition at line 181 of file GfxStringListBox.cpp.
|
virtual |
Get object width.
Implements GfxItem.
Definition at line 78 of file GfxStringListBox.cpp.