CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
cdc::ui::IView Class Referenceabstract

#include <IView.h>

Inheritance diagram for cdc::ui::IView:
cdc::ui::ViewBase 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 cdc::ui::ToastView

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

Detailed Description

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

Definition at line 25 of file IView.h.

Constructor & Destructor Documentation

◆ ~IView()

virtual cdc::ui::IView::~IView ( )
virtualdefault

Member Function Documentation

◆ clearDirty()

virtual void cdc::ui::IView::clearDirty ( )
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().

◆ getFooterHint()

◆ getName()

◆ markDirty()

virtual void cdc::ui::IView::markDirty ( )
pure virtual

Mark view as needing re-render

Implemented in cdc::plugin_manager::PluginListView, and cdc::ui::ViewBase.

◆ needsRender()

virtual bool cdc::ui::IView::needsRender ( ) const
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().

◆ onEnter()

virtual void cdc::ui::IView::onEnter ( void * context = nullptr)
pure virtual

◆ onExit()

virtual void cdc::ui::IView::onExit ( )
pure virtual

◆ onKey()

◆ onLongPress()

virtual InputResult cdc::ui::IView::onLongPress ( char key)
inlinevirtual

Handle long key press (optional)

Parameters
keyKey character
Returns
Input result

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().

◆ onPause()

virtual void cdc::ui::IView::onPause ( )
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().

◆ onResume()

virtual void cdc::ui::IView::onResume ( )
pure virtual

◆ onTick()

virtual void cdc::ui::IView::onTick ( uint32_t nowMs)
inlinevirtual

◆ prefersLightRefresh()

virtual bool cdc::ui::IView::prefersLightRefresh ( ) const
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().

◆ render()

◆ setFooterHint()

virtual void cdc::ui::IView::setFooterHint ( const char * hint)
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.

Parameters
hintFooter text, or nullptr to clear the override.

Reimplemented in cdc::ui::ViewBase.

Definition at line 126 of file IView.h.

◆ setLifecycleHooks()

virtual void cdc::ui::IView::setLifecycleHooks ( void(* onHide )(void *),
void(* onShow )(void *),
void * userData )
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.

Parameters
onHideCalled from onPause(), or nullptr.
onShowCalled from onResume(), or nullptr.
userDataOpaque pointer passed back to both hooks.

Reimplemented in cdc::ui::ViewBase.

Definition at line 137 of file IView.h.


The documentation for this class was generated from the following file:
  • components/cdc_ui/include/cdc_ui/IView.h