|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <IView.h>
Public Member Functions | |
| virtual | ~IView ()=default |
| virtual void | onEnter (void *context=nullptr)=0 |
| virtual void | onExit ()=0 |
| virtual void | onResume ()=0 |
| virtual void | onPause () |
| virtual void | render (bool partial)=0 |
| virtual bool | needsRender () const =0 |
| virtual void | markDirty ()=0 |
| virtual void | clearDirty ()=0 |
| virtual bool | prefersLightRefresh () const |
| virtual InputResult | onKey (char key)=0 |
| virtual InputResult | onLongPress (char key) |
| virtual void | onTick (uint32_t nowMs) |
| virtual const char * | getFooterHint () const |
| virtual void | setFooterHint (const char *hint) |
| virtual void | setLifecycleHooks (void(*onHide)(void *), void(*onShow)(void *), void *userData) |
| virtual const char * | getName () const =0 |
View interface - base for all UI screens
Views are stateful screen components that handle rendering and input. They are managed by ViewStack for navigation.
Reference: ~/GIT/cdc-badge-os-legacy/components/cdc_badge/views.h
|
virtualdefault |
|
pure virtual |
Clear the dirty flag. Called automatically by ViewStack after a successful render() pass. Subclasses that animate or update every tick must call markDirty() themselves in onTick().
Implemented in cdc::plugin_manager::PluginListView, and cdc::ui::ViewBase.
Referenced by cdc::ui::ViewStack::render().
|
inlinevirtual |
Get footer hint text (e.g., "[Y] OK [N] Back") Return nullptr for no footer
Reimplemented in cdc::mod_2fa::OathCodeView, cdc::plugin_manager::PluginListView, cdc::ui::BlePairingPromptView, cdc::ui::ColorPickerView, cdc::ui::ConfirmView, cdc::ui::ContextMenuView, cdc::ui::DateInputView, cdc::ui::InfoView, cdc::ui::ListView, cdc::ui::LockScreenView, cdc::ui::MessageBox, cdc::ui::PasswordT9View, cdc::ui::PinChangeView, cdc::ui::PinEntryView, cdc::ui::QRCodeView, cdc::ui::SliderView, cdc::ui::T9InputView, cdc::ui::TimeInputView, and cdc::ui::ViewBase.
|
pure virtual |
Get view name for debugging
Implemented in cdc::mod_2fa::OathCodeView, cdc::plugin_manager::PluginListView, cdc::ui::BlePairingPromptView, cdc::ui::BlePairingView, cdc::ui::BleScanView, cdc::ui::CanvasView, cdc::ui::ColorPickerView, cdc::ui::ConfirmView, cdc::ui::ContextMenuView, cdc::ui::DateInputView, cdc::ui::InfoView, cdc::ui::ListView, cdc::ui::LockScreenView, cdc::ui::MessageBox, cdc::ui::PasswordT9View, cdc::ui::PinChangeView, cdc::ui::PinEntryView, cdc::ui::QRCodeView, cdc::ui::SliderView, cdc::ui::T9InputView, cdc::ui::TimeInputView, and cdc::ui::ToastView.
Referenced by cdc::serial::cmdPaste(), cdc::ui::isListView(), cdc::ui::ViewStack::replace(), and cdc::ui::ViewStack::showModal().
|
pure virtual |
Mark view as needing re-render
Implemented in cdc::plugin_manager::PluginListView, and cdc::ui::ViewBase.
|
pure virtual |
Check if view needs re-rendering
Implemented in cdc::plugin_manager::PluginListView, and cdc::ui::ViewBase.
Referenced by cdc::ui::ViewStack::needsRender(), and cdc::ui::ViewStack::render().
|
pure virtual |
Called when view becomes active (pushed or becomes top)
| context | Optional context data from parent |
Implemented in cdc::mod_2fa::OathCodeView, cdc::plugin_manager::PluginListView, cdc::ui::BlePairingPromptView, cdc::ui::BlePairingView, cdc::ui::BleScanView, cdc::ui::CanvasView, cdc::ui::LockScreenView, cdc::ui::PinChangeView, cdc::ui::PinEntryView, and cdc::ui::ViewBase.
Referenced by cdc::ui::BleScanView::onEnter(), cdc::ui::ViewStack::replace(), and cdc::ui::ViewStack::showModal().
|
pure virtual |
Called when view is being removed from stack
Implemented in cdc::plugin_manager::PluginListView, cdc::ui::BlePairingView, cdc::ui::BleScanView, cdc::ui::CanvasView, and cdc::ui::ViewBase.
Referenced by cdc::ui::BleScanView::onExit(), and cdc::ui::ViewStack::replace().
|
pure virtual |
Handle key press
| key | Key character ('0'-'9', 'Y', 'N', etc.) |
Implemented in cdc::mod_2fa::OathCodeView, cdc::plugin_manager::PluginListView, cdc::ui::BlePairingPromptView, cdc::ui::BlePairingView, cdc::ui::CanvasView, cdc::ui::ColorPickerView, cdc::ui::ConfirmView, cdc::ui::ContextMenuView, cdc::ui::DateInputView, cdc::ui::InfoView, cdc::ui::ListView, cdc::ui::LockScreenView, cdc::ui::MessageBox, cdc::ui::PinChangeView, cdc::ui::PinEntryView, cdc::ui::QRCodeView, cdc::ui::SliderView, cdc::ui::T9InputView, cdc::ui::TimeInputView, and cdc::ui::ToastView.
Referenced by cdc::ui::ViewStack::dispatchKey().
|
inlinevirtual |
Handle long key press (optional)
| key | Key character |
Reimplemented in cdc::ui::CanvasView, cdc::ui::InfoView, cdc::ui::ListView, cdc::ui::PasswordT9View, and cdc::ui::T9InputView.
Definition at line 101 of file IView.h.
References cdc::ui::IGNORED.
Referenced by cdc::ui::ViewStack::dispatchLongPress().
|
inlinevirtual |
Called when the view is covered by another view or modal (still on the stack but no longer active). Counterpart to onResume(). Default no-op.
Reimplemented in cdc::ui::ViewBase.
Definition at line 51 of file IView.h.
Referenced by cdc::ui::ViewStack::showModal().
|
pure virtual |
Called when view becomes visible again (child popped)
Implemented in cdc::mod_2fa::OathCodeView, cdc::plugin_manager::PluginListView, cdc::ui::BleScanView, cdc::ui::CanvasView, cdc::ui::LockScreenView, and cdc::ui::ViewBase.
Referenced by cdc::ui::BleScanView::onResume().
|
inlinevirtual |
Called periodically for animations/timers
| nowMs | Current time in milliseconds |
Reimplemented in cdc::mod_2fa::OathCodeView, cdc::ui::BlePairingPromptView, cdc::ui::BlePairingView, cdc::ui::BleScanView, cdc::ui::ColorPickerView, cdc::ui::ContextMenuView, cdc::ui::LockScreenView, cdc::ui::MessageBox, cdc::ui::PinChangeView, cdc::ui::PinEntryView, cdc::ui::SliderView, cdc::ui::T9InputView, and cdc::ui::ToastView.
Definition at line 109 of file IView.h.
Referenced by cdc::ui::ViewStack::dispatchTick().
|
inlinevirtual |
Whether this view's partial updates should use RefreshMode::PARTIAL_LIGHT, i.e. never be periodically promoted to a full refresh. Views whose updates are tiny and low-churn (e.g. the lock-screen clock) return true so the panel does not flicker through a forced full refresh while idle. A full refresh still happens on the next view change.
Reimplemented in cdc::ui::LockScreenView.
Definition at line 85 of file IView.h.
Referenced by cdc::ui::ViewStack::render().
|
pure virtual |
Render view content to display buffer
| partial | True for partial update, false for full refresh |
Implemented in cdc::mod_2fa::OathCodeView, cdc::plugin_manager::PluginListView, cdc::ui::BlePairingPromptView, cdc::ui::BlePairingView, cdc::ui::CanvasView, cdc::ui::ColorPickerView, cdc::ui::ConfirmView, cdc::ui::ContextMenuView, cdc::ui::DateInputView, cdc::ui::InfoView, cdc::ui::ListView, cdc::ui::LockScreenView, cdc::ui::MessageBox, cdc::ui::PasswordT9View, cdc::ui::PinChangeView, cdc::ui::PinEntryView, cdc::ui::QRCodeView, cdc::ui::SliderView, cdc::ui::T9InputView, cdc::ui::TimeInputView, and cdc::ui::ToastView.
Referenced by cdc::ui::ViewStack::render().
|
inlinevirtual |
Override the footer hint at runtime. Default is a no-op; views that support custom footers (ListView, T9InputView, ...) override this to persist the hint. The string is NOT copied by the view - caller (typically PluginUiState) must keep it alive while the view is shown.
| hint | Footer text, or nullptr to clear the override. |
Reimplemented in cdc::ui::ViewBase.
|
inlinevirtual |
Register opaque hooks fired when this view is hidden (onPause) and shown again (onResume). Default is a no-op; ViewBase persists and fires them. Lets callers (e.g. PluginUiState) react to a view being covered/revealed without enumerating concrete view types. Pass nullptr to clear a hook.
| onHide | Called from onPause(), or nullptr. |
| onShow | Called from onResume(), or nullptr. |
| userData | Opaque pointer passed back to both hooks. |
Reimplemented in cdc::ui::ViewBase.