Skip to content

Commit

Permalink
Merge pull request #172 from forntoh/171-make-isatstart-and-isatend-p…
Browse files Browse the repository at this point in the history
…ublic

Make `isAtTheStart` and `isAtTheEnd` public
  • Loading branch information
forntoh authored May 13, 2024
2 parents b09e31e + 2f7233e commit 2be2ec3
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/LcdMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,28 +250,6 @@ class LcdMenu {
lcd->write(byte(0));
}
}
/**
* Check if the cursor is at the start of the menu items
* @return true : `boolean` if it is at the start
*/
boolean isAtTheStart() {
byte menuType = currentMenuTable[cursorPosition - 1]->getType();
return menuType == MENU_ITEM_MAIN_MENU_HEADER ||
menuType == MENU_ITEM_SUB_MENU_HEADER;
}
/**
* Check if the cursor is at the end of the menu items
* @return true : `boolean` if it is at the end
*/
boolean isAtTheEnd() { return isAtTheEnd(cursorPosition); }
/**
* Check if the item at [position] is at the end of the menu items
* @return true : `boolean` if it is at the end
*/
boolean isAtTheEnd(uint8_t position) {
return currentMenuTable[position + 1]->getType() ==
MENU_ITEM_END_OF_MENU;
}
/**
* Reset the display
* @param isHistoryAvailable indicates if there is a previous position
Expand Down Expand Up @@ -404,6 +382,28 @@ class LcdMenu {
* Reset the display
*/
void resetMenu() { this->reset(false); }
/**
* Check if the cursor is at the start of the menu items
* @return true : `boolean` if it is at the start
*/
boolean isAtTheStart() {
byte menuType = currentMenuTable[cursorPosition - 1]->getType();
return menuType == MENU_ITEM_MAIN_MENU_HEADER ||
menuType == MENU_ITEM_SUB_MENU_HEADER;
}
/**
* Check if the cursor is at the end of the menu items
* @return true : `boolean` if it is at the end
*/
boolean isAtTheEnd() { return isAtTheEnd(cursorPosition); }
/**
* Check if the item at [position] is at the end of the menu items
* @return true : `boolean` if it is at the end
*/
boolean isAtTheEnd(uint8_t position) {
return currentMenuTable[position + 1]->getType() ==
MENU_ITEM_END_OF_MENU;
}
/**
* Execute an "up press" on menu
* When edit mode is enabled, this action is skipped
Expand Down

0 comments on commit 2be2ec3

Please sign in to comment.