|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <IView.h>
Public Member Functions | |
| 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 void | render (bool partial)=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 * | getName () const =0 |
Protected Member Functions | |
| void | setTitle (const char *title) |
| const char * | getTitle () const |
Protected Attributes | |
| bool | dirty_ = true |
| const char * | title_ = nullptr |
| const char * | customFooter_ = nullptr |
| void(* | onHide_ )(void *) = nullptr |
| void(* | onShow_ )(void *) = nullptr |
| void * | lifecycleUserData_ = nullptr |
ViewBase - Default implementation of IView
Provides common functionality for views:
|
virtualdefault |
|
inlineoverridevirtual |
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().
Implements cdc::ui::IView.
Definition at line 187 of file IView.h.
References dirty_.
Referenced by cdc::mod_2fa::OathCodeView::render(), cdc::ui::BlePairingPromptView::render(), and cdc::ui::BlePairingView::render().
|
inlineoverridevirtual |
Get footer hint text (e.g., "[Y] OK [N] Back") Return nullptr for no footer
Reimplemented from cdc::ui::IView.
Definition at line 195 of file IView.h.
References customFooter_.
|
inlineprotected |
|
inlineoverridevirtual |
Mark view as needing re-render
Implements cdc::ui::IView.
Definition at line 186 of file IView.h.
References dirty_.
Referenced by cdc::ui::CanvasView::commit(), cdc::ui::ListView::insertItem(), cdc::mod_2fa::OathCodeView::onKey(), cdc::ui::PasswordT9View::onLongPress(), cdc::mod_2fa::OathCodeView::onTick(), cdc::ui::BlePairingView::onTick(), cdc::ui::ListView::removeItem(), cdc::ui::ListView::repaintPartial(), cdc::ui::PasswordT9View::setRevealed(), and cdc::ui::ListView::updateItem().
|
inlineoverridevirtual |
Check if view needs re-rendering
Implements cdc::ui::IView.
Definition at line 185 of file IView.h.
References dirty_.
|
inlineoverridevirtual |
Called when view becomes active (pushed or becomes top)
| context | Optional context data from parent |
Implements cdc::ui::IView.
Definition at line 162 of file IView.h.
References dirty_.
Referenced by cdc::ui::CanvasView::onEnter().
|
inlineoverridevirtual |
Called when view is being removed from stack
Implements cdc::ui::IView.
Definition at line 167 of file IView.h.
Referenced by cdc::ui::CanvasView::onExit().
|
inlineoverridevirtual |
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 from cdc::ui::IView.
Definition at line 174 of file IView.h.
References lifecycleUserData_, and onHide_.
|
inlineoverridevirtual |
Called when view becomes visible again (child popped)
Implements cdc::ui::IView.
Definition at line 169 of file IView.h.
References dirty_, lifecycleUserData_, and onShow_.
Referenced by cdc::ui::CanvasView::onResume().
|
inlineoverridevirtual |
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 from cdc::ui::IView.
Definition at line 191 of file IView.h.
References customFooter_, and dirty_.
|
inlineoverridevirtual |
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 from cdc::ui::IView.
Definition at line 178 of file IView.h.
References lifecycleUserData_, onHide_, and onShow_.
|
inlineprotected |
|
protected |
Definition at line 203 of file IView.h.
Referenced by cdc::ui::ColorPickerView::getFooterHint(), cdc::ui::ListView::getFooterHint(), getFooterHint(), cdc::ui::CanvasView::init(), cdc::ui::CanvasView::render(), cdc::ui::CanvasView::setFooter(), and setFooterHint().
|
protected |
Definition at line 201 of file IView.h.
Referenced by cdc::ui::T9InputView::appendRaw(), cdc::ui::T9InputView::backspace(), clearDirty(), cdc::ui::T9InputView::commitCharacter(), cdc::ui::T9InputView::forceDigit(), cdc::ui::CanvasView::init(), cdc::ui::ColorPickerView::init(), cdc::ui::ConfirmView::init(), cdc::ui::ContextMenuView::init(), cdc::ui::DateInputView::init(), cdc::ui::InfoView::init(), cdc::ui::ListView::init(), cdc::ui::LockScreenView::init(), cdc::ui::MessageBox::init(), cdc::ui::PinChangeView::init(), cdc::ui::PinEntryView::init(), cdc::ui::QRCodeView::init(), cdc::ui::SliderView::init(), cdc::ui::T9InputView::init(), cdc::ui::TimeInputView::init(), cdc::ui::ToastView::init(), markDirty(), needsRender(), cdc::mod_2fa::OathCodeView::onEnter(), cdc::ui::BlePairingPromptView::onEnter(), cdc::ui::BlePairingView::onEnter(), cdc::ui::LockScreenView::onEnter(), cdc::ui::PinEntryView::onEnter(), onEnter(), cdc::ui::PinChangeView::onKey(), cdc::ui::InfoView::onLongPress(), cdc::mod_2fa::OathCodeView::onResume(), cdc::ui::LockScreenView::onResume(), onResume(), cdc::ui::PinChangeView::onTick(), cdc::ui::PinEntryView::onTick(), cdc::ui::BlePairingPromptView::prepare(), cdc::ui::T9InputView::processKey(), cdc::ui::CanvasView::render(), cdc::ui::ColorPickerView::render(), cdc::ui::ConfirmView::render(), cdc::ui::ContextMenuView::render(), cdc::ui::DateInputView::render(), cdc::ui::InfoView::render(), cdc::ui::ListView::render(), cdc::ui::LockScreenView::render(), cdc::ui::MessageBox::render(), cdc::ui::PasswordT9View::render(), cdc::ui::PinChangeView::render(), cdc::ui::PinEntryView::render(), cdc::ui::QRCodeView::render(), cdc::ui::SliderView::render(), cdc::ui::T9InputView::render(), cdc::ui::TimeInputView::render(), cdc::ui::ToastView::render(), cdc::ui::LockScreenView::setBatteryPercent(), cdc::ui::LockScreenView::setClock(), cdc::ui::LockScreenView::setDate(), cdc::ui::LockScreenView::setDisplayName(), setFooterHint(), cdc::ui::LockScreenView::setInfo(), cdc::ui::LockScreenView::setInfo2(), cdc::ui::ListView::setSelection(), cdc::ui::LockScreenView::setStatusIcons(), cdc::ui::SliderView::setValue(), and cdc::ui::LockScreenView::toggleBacklight().
|
protected |
Definition at line 207 of file IView.h.
Referenced by onPause(), onResume(), and setLifecycleHooks().
|
protected |
Definition at line 205 of file IView.h.
Referenced by onPause(), and setLifecycleHooks().
|
protected |
Definition at line 206 of file IView.h.
Referenced by onResume(), and setLifecycleHooks().
|
protected |
Definition at line 202 of file IView.h.
Referenced by getTitle(), cdc::ui::CanvasView::init(), cdc::ui::CanvasView::render(), and setTitle().