|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <InfoView.h>
Public Types | |
| using | YesNoCallback = void(*)(void* userData) |
| using | MenuCallback = void(*)(void* userData) |
Public Member Functions | |
| void | init (const char *title, const char *text) |
| void | setHint (const char *hint) |
| void | setYesNoCallbacks (YesNoCallback onYes, YesNoCallback onNo, void *userData=nullptr) |
| void | setOnMenu (MenuCallback onMenu, void *userData=nullptr) |
| void | render (bool partial) override |
| Renders the info view including title, body, scroll indicator, and footer. | |
| InputResult | onKey (char key) override |
| Handles key input for scrolling and optional callbacks. | |
| InputResult | onLongPress (char key) override |
| Long-press jumps to the first (KEY_UP) or last (KEY_DOWN) page. | |
| const char * | getName () const override |
| const char * | getFooterHint () const override |
| Returns the footer hint text. | |
| Public Member Functions inherited from cdc::ui::ViewBase | |
| virtual | ~ViewBase ()=default |
| void | onEnter (void *context) override |
| void | onExit () override |
| void | onResume () override |
| void | onPause () override |
| void | setLifecycleHooks (void(*onHide)(void *), void(*onShow)(void *), void *userData) override |
| bool | needsRender () const override |
| void | markDirty () override |
| void | clearDirty () override |
| void | setFooterHint (const char *hint) override |
| const char * | getFooterHint () const override |
| Public Member Functions inherited from cdc::ui::IView | |
| virtual | ~IView ()=default |
| virtual bool | prefersLightRefresh () const |
| virtual void | onTick (uint32_t nowMs) |
Static Public Attributes | |
| static constexpr uint16_t | MAX_TEXT_LEN = 2048 |
| static constexpr uint8_t | VISIBLE_LINES = 6 |
| static constexpr uint8_t | LINE_HEIGHT = 14 |
Additional Inherited Members | |
| Protected Member Functions inherited from cdc::ui::ViewBase | |
| void | setTitle (const char *title) |
| const char * | getTitle () const |
| Protected Attributes inherited from cdc::ui::ViewBase | |
| bool | dirty_ = true |
| const char * | title_ = nullptr |
| const char * | customFooter_ = nullptr |
| void(* | onHide_ )(void *) = nullptr |
| void(* | onShow_ )(void *) = nullptr |
| void * | lifecycleUserData_ = nullptr |
InfoView - Scrollable text display
Displays multi-line text with vertical scrolling. Good for help screens, about pages, long messages.
Keys: 2 = Scroll up 8 = Scroll down N = Back (REQUEST_POP)
Definition at line 20 of file InfoView.h.
| using cdc::ui::InfoView::MenuCallback = void(*)(void* userData) |
Set optional context-menu callback (key 3). Pass nullptr to disable.
Definition at line 53 of file InfoView.h.
| using cdc::ui::InfoView::YesNoCallback = void(*)(void* userData) |
Set optional Y/N callbacks (for approve/deny prompts) If set, Y/N will trigger callbacks instead of popping the view.
Definition at line 42 of file InfoView.h.
|
overridevirtual |
Returns the footer hint text.
Reimplemented from cdc::ui::IView.
Definition at line 194 of file InfoView.cpp.
References cdc::ui::tr().
Referenced by render().
|
inlineoverridevirtual |
| void cdc::ui::InfoView::init | ( | const char * | title, |
| const char * | text ) |
Initialize info view
| title | View title |
| text | Text to display (can be multi-line with ) |
Definition at line 66 of file InfoView.cpp.
References cdc::ui::ViewBase::dirty_, LOG_D, MAX_TEXT_LEN, cdc::core::psramAlloc(), and cdc::ui::TAG.
Referenced by cdc::plugin_manager::PluginInfoView::loadForPluginId(), and cdc::mod_vcard::showVcardDetails().
|
overridevirtual |
Handles key input for scrolling and optional callbacks.
| key | Pressed key code. |
Implements cdc::ui::IView.
Definition at line 143 of file InfoView.cpp.
References cdc::ui::CONSUMED, cdc::ui::IGNORED, cdc::ui::KEY_DOWN, cdc::ui::KEY_MENU, cdc::ui::KEY_NO, cdc::ui::KEY_UP, cdc::ui::KEY_YES, and cdc::ui::REQUEST_POP.
|
overridevirtual |
Long-press jumps to the first (KEY_UP) or last (KEY_DOWN) page.
| key | Pressed key code. |
Reimplemented from cdc::ui::IView.
Definition at line 181 of file InfoView.cpp.
References cdc::ui::CONSUMED, cdc::ui::ViewBase::dirty_, cdc::ui::IGNORED, cdc::ui::KEY_DOWN, cdc::ui::KEY_UP, and VISIBLE_LINES.
|
overridevirtual |
Renders the info view including title, body, scroll indicator, and footer.
| partial | Indicates partial/full redraw mode. |
Implements cdc::ui::IView.
Definition at line 206 of file InfoView.cpp.
References cdc::ui::ViewBase::dirty_, cdc::ui::display, cdc::ui::render::drawFooterBar(), cdc::ui::render::drawHeaderLeft(), cdc::ui::render::drawScrollIndicator(), FOOTER_HEIGHT, cdc::hal::getDisplayInstance(), getFooterHint(), LINE_HEIGHT, SCROLL_INDICATOR_WIDTH, cdc::ui::TEXT_MARGIN, TEXT_START_Y, cdc::ui::TITLE_Y, and VISIBLE_LINES.
|
inline |
Set custom footer hint
Definition at line 36 of file InfoView.h.
|
inline |
Definition at line 54 of file InfoView.h.
Referenced by cdc::mod_vcard::showVcardDetails().
|
inline |
Definition at line 43 of file InfoView.h.
|
staticconstexpr |
Definition at line 24 of file InfoView.h.
Referenced by render().
|
staticconstexpr |
Definition at line 22 of file InfoView.h.
Referenced by init(), cdc::mod_password::showDetails(), and cdc::mod_vcard::showVcardDetails().
|
staticconstexpr |
Definition at line 23 of file InfoView.h.
Referenced by onLongPress(), and render().