|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <MessageBox.h>
Public Types | |
| using | CloseCallback = void(*)() |
Public Member Functions | |
| void | init (const char *message, MessageIcon icon=MessageIcon::NONE, uint32_t timeoutMs=0) |
| Initializes message box state. | |
| void | setOnClose (CloseCallback callback) |
| void | render (bool partial) override |
| Renders the modal message box. | |
| InputResult | onKey (char key) override |
| Handles key input for manual dismissal. | |
| void | onTick (uint32_t nowMs) override |
| Updates timeout-based auto-dismiss behavior. | |
| const char * | getName () const override |
| const char * | getFooterHint () const override |
| 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 InputResult | onLongPress (char key) |
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 |
MessageBox - System feedback overlay
Displays a centered message box for user feedback. Can have optional icon and auto-dismiss timeout.
Keys: Y/N = Close (if interactive)
Definition at line 28 of file MessageBox.h.
| using cdc::ui::MessageBox::CloseCallback = void(*)() |
Close callback (called when message is dismissed)
Definition at line 33 of file MessageBox.h.
|
inlineoverridevirtual |
Get footer hint text (e.g., "[Y] OK [N] Back") Return nullptr for no footer
Reimplemented from cdc::ui::IView.
Definition at line 54 of file MessageBox.h.
|
inlineoverridevirtual |
| void cdc::ui::MessageBox::init | ( | const char * | message, |
| MessageIcon | icon = MessageIcon::NONE, | ||
| uint32_t | timeoutMs = 0 ) |
Initializes message box state.
Initialize message box
| message | Text to display |
| icon | Icon type (NONE, SUCCESS, ERROR, INFO, WARNING) |
| timeoutMs | Auto-dismiss timeout (0 = no auto-dismiss) |
| message | Message text to display. |
| icon | Icon type for the message. |
| timeoutMs | Auto-close timeout in milliseconds. |
Definition at line 37 of file MessageBox.cpp.
References cdc::ui::ViewBase::dirty_, LOG_D, and cdc::ui::TAG.
|
overridevirtual |
Handles key input for manual dismissal.
| key | Pressed key code. |
Implements cdc::ui::IView.
Definition at line 75 of file MessageBox.cpp.
References cdc::ui::CONSUMED, cdc::ui::hideMessage(), cdc::ui::IGNORED, cdc::ui::KEY_NO, cdc::ui::KEY_YES, LOG_D, and cdc::ui::TAG.
|
overridevirtual |
Updates timeout-based auto-dismiss behavior.
| nowMs | Current monotonic time in milliseconds. |
Reimplemented from cdc::ui::IView.
Definition at line 54 of file MessageBox.cpp.
References cdc::ui::hideMessage(), LOG_D, and cdc::ui::TAG.
|
overridevirtual |
Renders the modal message box.
| partial | Indicates partial/full redraw mode. |
Implements cdc::ui::IView.
Definition at line 93 of file MessageBox.cpp.
References BOX_PADDING, cdc::ui::ViewBase::dirty_, cdc::ui::display, cdc::ui::render::drawDialogFrame(), cdc::ui::ERROR, cdc::hal::getDisplayInstance(), ICON_MARGIN, ICON_SIZE, cdc::ui::INFO, MAX_BOX_WIDTH, MIN_BOX_WIDTH, cdc::ui::NONE, cdc::ui::render::printText(), cdc::ui::SUCCESS, and cdc::ui::WARNING.
|
inline |
Set close callback
Definition at line 47 of file MessageBox.h.