|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <DateInputView.h>
Public Types | |
| using | ConfirmCallback = void(*)(uint8_t day, uint8_t month, uint16_t year) |
| using | CancelCallback = void(*)() |
Public Member Functions | |
| void | init (const char *title, uint8_t day, uint8_t month, uint16_t year) |
| Initializes date input state. | |
| void | setOnConfirm (ConfirmCallback callback) |
| void | setOnCancel (CancelCallback callback) |
| uint8_t | getDay () const |
| uint8_t | getMonth () const |
| uint16_t | getYear () const |
| void | render (bool partial) override |
| Renders the date input view. | |
| InputResult | onKey (char key) override |
| Handles key input for the date editor. | |
| const char * | getName () const override |
| const char * | getFooterHint () const override |
| Returns localized 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 InputResult | onLongPress (char key) |
| virtual void | onTick (uint32_t nowMs) |
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 |
DateInputView - Date input with day/month/year fields
Navigation: 0-9 = Enter digits 4 = Previous field 6 = Next field N = Clear current field / Cancel (if empty) Y = Confirm
Definition at line 18 of file DateInputView.h.
| using cdc::ui::DateInputView::CancelCallback = void(*)() |
Cancel callback (called when the user dismisses the view with N). The view pops itself before this fires, so do not call pop() in the handler.
Definition at line 32 of file DateInputView.h.
| using cdc::ui::DateInputView::ConfirmCallback = void(*)(uint8_t day, uint8_t month, uint16_t year) |
Confirm callback
| day | Day (1-31) |
| month | Month (1-12) |
| year | Year (e.g., 2026) |
Definition at line 26 of file DateInputView.h.
|
inline |
Get current values
Definition at line 56 of file DateInputView.h.
|
overridevirtual |
Returns localized footer hint text.
Reimplemented from cdc::ui::IView.
Definition at line 209 of file DateInputView.cpp.
References cdc::ui::tr().
Referenced by render().
|
inline |
Definition at line 57 of file DateInputView.h.
|
inlineoverridevirtual |
Get view name for debugging
Implements cdc::ui::IView.
Definition at line 63 of file DateInputView.h.
|
inline |
Definition at line 58 of file DateInputView.h.
| void cdc::ui::DateInputView::init | ( | const char * | title, |
| uint8_t | day, | ||
| uint8_t | month, | ||
| uint16_t | year ) |
Initializes date input state.
Initialize date input view
| title | View title |
| day | Initial day (1-31) |
| month | Initial month (1-12) |
| year | Initial year |
| title | View title text. |
| day | Initial day value. |
| month | Initial month value. |
| year | Initial year value. |
Definition at line 37 of file DateInputView.cpp.
References cdc::ui::ViewBase::dirty_.
|
overridevirtual |
Handles key input for the date editor.
| key | Pressed key code. |
Implements cdc::ui::IView.
Definition at line 169 of file DateInputView.cpp.
References cdc::ui::CONSUMED, cdc::ui::IGNORED, cdc::ui::ViewStack::instance(), cdc::ui::KEY_NO, cdc::ui::KEY_YES, LOG_I, cdc::ui::ViewStack::pop(), and cdc::ui::TAG.
|
overridevirtual |
Renders the date input view.
| partial | Indicates partial/full redraw mode. |
Implements cdc::ui::IView.
Definition at line 218 of file DateInputView.cpp.
References DATE_Y, cdc::ui::ViewBase::dirty_, cdc::ui::display, cdc::ui::render::drawFooterBar(), cdc::ui::render::drawHeaderCentered(), cdc::hal::getDisplayInstance(), getFooterHint(), cdc::ui::TITLE_Y, and UNDERLINE_Y.
|
inline |
Set cancel callback (called when the view is dismissed without confirming)
Definition at line 51 of file DateInputView.h.
|
inline |
Set confirm callback
Definition at line 46 of file DateInputView.h.