CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
HtmlViewerHook.h File Reference

Optional HTML-rendering hook, decoupling HTML producers from consumers. More...

#include <cstddef>

Go to the source code of this file.

Namespaces

namespace  cdc
namespace  cdc::ui
 Centralized key-code constants for cdc_views.

Typedefs

using cdc::ui::HtmlViewerFn = void (*)(const char* title, const char* html, size_t len)
 Render an HTML document. html / title are UTF-8.
using cdc::ui::UrlOpenerFn = void (*)(const char* url)
 Open a URL in the browser (enters the browser and loads it). url is UTF-8.
using cdc::ui::ImageOpenerFn = void (*)(const char* path)
 Open a local image file by path (relative to the file explorer's current directory). path is UTF-8.

Functions

void cdc::ui::setHtmlViewer (HtmlViewerFn fn)
 Register the HTML viewer (called by the provider module at init).
HtmlViewerFn cdc::ui::htmlViewer ()
 Current HTML viewer, or nullptr when none is registered.
void cdc::ui::setUrlOpener (UrlOpenerFn fn)
 Register the URL opener (called by the browser module at init).
UrlOpenerFn cdc::ui::urlOpener ()
 Current URL opener, or nullptr when none is registered.
void cdc::ui::setImageOpener (ImageOpenerFn fn)
 Register the local-image opener (called by the file explorer at init).
ImageOpenerFn cdc::ui::imageOpener ()
 Current image opener, or nullptr when none is registered.

Detailed Description

Optional HTML-rendering hook, decoupling HTML producers from consumers.

A provider (the browser module) registers a function that renders an HTML document; consumers (e.g. the file explorer) call htmlViewer to open a local HTML file without depending on the provider module. When no provider is registered the getter returns nullptr and the consumer falls back.

Definition in file HtmlViewerHook.h.