In development. It changes without notice.
Topic
Interface Components
Buttons, lists, dialogs, steppers, keyboards and the rest, each drawn from the values it is given.
A component is a function of a record of values and a layout. It draws into the canvas and keeps nothing between calls: who is focused, pressed or selected is a value its caller passes. One whose gesture spans several frames keeps that in a companion type beside it. Each one has a form for a panel of two tones, with outlines and ink and no fill.
- Frame of a screen: header, action bar, key hints, tabs, rules.
- Lists and values: menu list, dropdown, stepper, fields for text, a date or an address, character wheel, touch keyboard.
- What a record is: identity, brand mark, chips, the card of a one-time code, the ring of its countdown.
- Feedback: dialog, toast, notice stack, progress, battery gauge, PIN dial, tutorial hints.
- Icons: drawn from lines and shapes, with no glyph font.
- QR codes, for joining the portal's network and opening its page.
- See also
- Canvas, Theme & Layout, Buttons & Gestures
Files | |
| file | src/ |
| Affordance-driven footer hint bar — the showcase of the input axis. | |
| file | src/ |
| The battery gauge every header shows: the step its fill is drawn at and the low-battery mark, each moved with hysteresis. | |
| file | src/ |
| Credential brand badge — registry logo with a letter fallback. | |
| file | src/ |
| Pressable button with explicit visual states (normal / focused / …). | |
| file | src/ |
| Horizontal, center-locked, paged character wheel for button-board text entry. | |
| file | src/ |
| The body of the screen that offers a record's 2FA code once its user and password have been typed. | |
| file | src/ |
| Depleting annulus-sector countdown indicator (TOTP validity ring). | |
| file | src/ |
| The identity block of a credential card: who the record is for. | |
| file | src/ |
| Field-by-field date-time editor: a pure edit model + a renderer. | |
| file | src/ |
| Modal / confirm box — title, body, and 1–2 action labels. | |
| file | src/ |
| Single-select list popover for an enum setting (language, layout, …). | |
| file | src/ |
| The focus mark of a segmented field editor (date-time, IPv4 address). | |
| file | src/ |
| Top status/header bar — title + optional status icons. | |
| file | src/ |
| The watch on the battery gauge of the header the glass shows. | |
| file | src/ |
| The rim that fills around a row while a key is held to open it. | |
| file | src/ |
| Quiet icon-only touch control (reveal, back): one size, two looks. | |
| file | src/ |
| Primitive-drawn UI icons — a curated affordance / status glyph set. | |
| file | src/ |
| Octet-by-octet literal-IPv4 editor: a pure edit model + a renderer. | |
| file | src/ |
| The keyboard boards' one key-hint shelf: key, then what it does. | |
| file | src/ |
| The Kleidos mark at the official geometry, with a keyhole that turns. | |
| file | src/ |
| The battery level every header shows: the one gauge of the firmware, moved by the board's reading. | |
| file | src/ |
| The live status cluster a screen header shows: battery, charge and the Bluetooth link. | |
| file | src/ |
| Scrollable vertical list: a single ListRow + the MenuList window. | |
| file | src/ |
| A column of centered text blocks set whole inside a box: the layout of a screen that only says something. | |
| file | src/ |
| Timing-arc PIN dial — the two-concentric-circle annulus primitive. | |
| file | src/ |
| The card every popup that asks for something is drawn on: a tinted title bar over the card's own surface. | |
| file | src/ |
| Linear progress bar + circular progress arc (general-purpose). | |
| file | src/ |
| Pure solver for a scan card: the largest crisp symbol a band holds. | |
| file | src/ |
| Scalable QR-code UI component drawn through kleidos:: | |
| file | src/ |
| In-house QR Code (ISO/IEC 18004) byte-mode encoder. | |
| file | src/ |
| Typed QR payload builders (heap-free), starting with WiFi join strings. | |
| file | src/ |
| The hairline that separates one row of content from the next. | |
| file | src/ |
| Small status pill (a.k.a. Badge) — e.g. "TOTP", severity tags. | |
| file | src/ |
| − value + numeric stepper control with min / max / step clamping. | |
| file | src/ |
| Horizontal tab strip with one selected tab. | |
| file | src/ |
| Multi-line text drawn inside a rectangle, wrapped to width, clipped to height. | |
| file | src/ |
| Single-line text display / entry field with caret + password masking. | |
| file | src/ |
| Greedy word-wrap and single-line fitting shared by the components. | |
| file | src/ |
| Transient toast overlay + full-width banner strip. | |
| file | src/ |
| TOTP code card: space-grouped mono code + countdown ring + expiry text. | |
| file | src/ |
| The open variant strip of an on-screen keyboard: which key, which cell. | |
| file | src/ |
| One layered on-screen keyboard for masked secret entry on touch boards. | |
| file | src/ |
| Centered "try it" goal pill shared by the onboarding component tutorials. | |
Namespaces | |
| namespace | kleidos:: |
| Integer helpers of the mark's geometry: rounding and the sine of an angle in tenths of a degree. | |
Typedefs | |
| using | kleidos:: |
Caller-owned, malloc-free module matrix sized for kMaxVersion. | |
| using | kleidos:: |
| Convenience alias for the WiFi payload buffer type. | |
| using | kleidos:: |
| One fixed-capacity wrapped line (NUL-terminated). | |
Functions | |
| int16_t | kleidos:: |
Height the bar for props takes from the bottom edge. | |
| bool | kleidos:: |
Whether the bar for props would cut a caption, one size down included. | |
| void | kleidos:: |
| Draw the affordance-driven hint bar into the reserved footer shelf. | |
| void | kleidos:: |
Draw the hint bar, as drawActionBar does, and record it in drawn. | |
| void | kleidos:: |
Repaint the hint bar for props, touching only what changed since drawn. | |
| void | kleidos:: |
| Repaint the hint bar on the display, in a frame of its own. | |
| uint8_t | kleidos:: |
Steps a gauge drawn in a status slot of iconSize can show: one per pixel column of its fill. | |
| int16_t | kleidos:: |
Width of the gauge's body outline for a status slot of iconSize. | |
| int16_t | kleidos:: |
Width of the fill a gauge in a status slot of iconSize draws for level. | |
| uint8_t | kleidos:: |
A reading's own step: the fill level nearest to pct. | |
| BatteryLevel | kleidos:: |
The level a gauge shows for pct with no history: its own step and the red mark at kBatteryLowPct. A first reading, or a gauge drawn for a fixed percent (the component gallery). | |
| constexpr const char * | kleidos:: |
| The string a credential's brand mark is keyed by: its brand token. | |
| constexpr const char * | kleidos:: |
| The string drawBrandMark looks the registry logo up in. | |
| bool | kleidos:: |
Draw the brand badge within box, returning true if drawn. | |
| void | kleidos:: |
| Draw the Kleidos mark (a keyhole in a ring) at the official geometry. | |
| int16_t | kleidos:: |
| Compute the natural (preferred) button height for a layout. | |
| void | kleidos:: |
| Draw a pressable button filling the supplied rectangle. | |
| uint8_t | kleidos:: |
| Number of cells in a group's ring. | |
| char | kleidos:: |
The appendable glyph at index in a character group's ring. | |
| const char * | kleidos:: |
| Short chip label for a group (drawn in the tool row). | |
| CharWheelChip | kleidos:: |
The chip at tool-row column col (ABC abc 123 -_. DEL OK). | |
| CharGroup | kleidos:: |
| Map a group chip to the group it enters. | |
| const char * | kleidos:: |
| Short ASCII label for a chip-row cell. | |
| CharWheelChip | kleidos:: |
| Advance the group-chip selector by one, wrapping at the chip count. | |
| uint8_t | kleidos:: |
| Advance a wheel ring index by one, wrapping at the ring length. | |
| uint8_t | kleidos:: |
| Step a wheel ring index back by one, wrapping at the ring length. | |
| void | kleidos:: |
Draw the paged character wheel into area. | |
| Rect | kleidos:: |
The wheel-band sub-rect of area (the horizontal glyph-ring strip). | |
| void | kleidos:: |
Draw ONLY the wheel band (sliding glyph ring + center box + position dots) of area — not the chips or the label. | |
| int16_t | kleidos:: |
| Natural height of the offer's stack, for a caller that centers it. | |
| void | kleidos:: |
Draw the offer, centered vertically in body. | |
| int16_t | kleidos:: |
| Swept angle (degrees, clockwise from the top) for a remaining fraction. | |
| int16_t | kleidos:: |
| Swept angle for a seconds-remaining / period pair (integer-exact). | |
| void | kleidos:: |
| Draw the countdown ring: dim track + linear remaining-fraction sector. | |
| IdentityRowPlan | kleidos:: |
Decide how many rows fit room and how far apart they sit. Pure. | |
| void | kleidos:: |
Draw the identity block into column. | |
| constexpr uint8_t | kleidos:: |
Days in month of year, accounting for leap-year February. | |
| constexpr void | kleidos:: |
| Re-clamp DateTimeFieldModel:: | |
| constexpr void | kleidos:: |
| Increment the active field by one, wrapping at its upper bound. | |
| constexpr void | kleidos:: |
| Decrement the active field by one, wrapping at its lower bound. | |
| constexpr bool | kleidos:: |
| Advance to the next field, or signal commit when past the last field. | |
| void | kleidos:: |
| Draw the YYYY-MM-DD HH:MM timestamp + a zone line into a rectangle. | |
| Rect | kleidos:: |
| Draw a centered modal dialog over the screen. | |
| int16_t | kleidos:: |
| Height of a single dropdown option row for a layout. | |
| int16_t | kleidos:: |
Number of option rows that fit in a panel body of bodyH pixels. | |
| uint8_t | kleidos:: |
| Clamp / advance the scroll window so the focused option is visible. | |
| Rect | kleidos:: |
| The rect drawDropdown lays its option rows in: the popover minus its title band. | |
| BackChipRects | kleidos:: |
| Geometry of the title band's back chip — the one definition the draw and the hit test share. | |
| Rect | kleidos:: |
| The popover rect of a picker: the screen less a small margin that frames it, ending above the first row the pointer does not own (on a board whose A/B/C zones are a band of the screen) and above the action bar where the picker keeps one. | |
| bool | kleidos:: |
| Whether dropdownPopoverBox stops above the action bar. | |
| DropdownTouch | kleidos:: |
Resolve a gesture against a dropdown drawn in box with props — the one touch grammar every picker shares. | |
| DropdownTouch | kleidos:: |
| resolveDropdownTouch for a host that scrolls its options by touch. | |
| void | kleidos:: |
| Draw a single-select dropdown popover filling the supplied rectangle. | |
| void | kleidos:: |
| Draw the field in focus on a 1-bit panel: paper text on an ink band, with an ink rule under the band. | |
| void | kleidos:: |
| Draw the accent rule under the field in focus on a color panel. | |
| int16_t | kleidos:: |
| Compute the header bar height for a layout (title-only vs title+subtitle). | |
| int16_t | kleidos:: |
Header bar height for props: headerHeight(const LayoutContext&, bool) raised to the tap-target floor when HeaderProps:: is set (and always on the Core2 v1.3 and the CoreS3 SE). | |
| int16_t | kleidos:: |
| Header bar height from the two props that size it, for a caller that lays out before it has the title (or whose title varies). | |
| int16_t | kleidos:: |
Center line of the header's title row and status cluster for props, where the bar draws its battery gauge. | |
| int16_t | kleidos:: |
| Edge of the square the header's brand mark fills. | |
| int16_t | kleidos:: |
| Clearance between the header's brand mark and the bar's top edge. | |
| KleidosMarkPixels | kleidos:: |
The pixel-fit parts of the Kleidos mark at edge. | |
| void | kleidos:: |
| Draw the pixel-fit Kleidos mark from canvas primitives. | |
| BackChipRects | kleidos:: |
| Geometry of the header back chip — the one definition the draw and the hit test share. | |
| void | kleidos:: |
| Draw the mark of a dedicated back key (the CoreInk side key). | |
| int16_t | kleidos:: |
| Draw the header / status bar across the top edge. | |
| HeaderDrawn | kleidos:: |
| Draw the header as drawHeader does, and say which reserve the title kept for the trailing element the caller draws next. | |
| int16_t | kleidos:: |
| Side of the square slot each status token is drawn in, the battery gauge's included. | |
| Rect | kleidos:: |
The footprint of the battery gauge a header drew in slot: its body and its terminal. | |
| void | kleidos:: |
Draw the header's battery gauge outside a header, right-aligned on rightX and centered on cy, over the background already there. | |
| void | kleidos:: |
| Draw the battery gauge on a screen that has no header bar, on the screen's background, and record it so it stays live at rest. | |
| void | kleidos:: |
Repaint a header's battery gauge alone, in place, showing live. | |
| bool | kleidos:: |
| Keep the gauge on the glass live on a tick at rest. | |
| constexpr bool | kleidos:: |
Whether an overlay covers the gauge drawn in gauge. | |
| HeaderGaugeWatch & | kleidos:: |
| The record of the gauge on the glass: the one every header draw writes and the main loop's watch reads. UI task only. | |
| void | kleidos:: |
Paint the rim around row for a hold that is progress01 charged. | |
| void | kleidos:: |
Draw an icon chip filling box. | |
| void | kleidos:: |
| Draw an icon centered inside a box. | |
| void | kleidos:: |
| Convenience overload: draw an icon from a center point and size. | |
| void | kleidos:: |
Draw an icon centered on a point, with a stroke of at least minStroke. | |
| void | kleidos:: |
| Draw a letter key as its key cap: the letter, bold, in a rounded box. | |
| constexpr void | kleidos:: |
| Increment the active octet by one, wrapping 255 → 0. | |
| constexpr void | kleidos:: |
| Decrement the active octet by one, wrapping 0 → 255. | |
| constexpr bool | kleidos:: |
| Advance to the next octet, or signal commit when past the last one. | |
| constexpr bool | kleidos:: |
| Prefill the model's octets from a literal dotted-quad string. | |
| constexpr bool | kleidos:: |
| Format the model as an unpadded dotted quad ("10.0.0.1"). | |
| void | kleidos:: |
| Draw the NNN.NNN.NNN.NNN address + an optional caption into a rect. | |
| constexpr KeyHint | kleidos:: |
| A hint for one glyph key and its verb. | |
| constexpr KeyHint | kleidos:: |
| A hint for a pair of glyph keys (the arrows) and their verb. | |
| constexpr KeyHint | kleidos:: |
| A hint whose key is named in a word. | |
| constexpr KeyHint | kleidos:: |
| A hint for a letter key, drawn as its key cap. | |
| Rect | kleidos:: |
| The shelf's band: a strip along the bottom of the screen, one small line tall plus its padding. | |
| Rect | kleidos:: |
| The row just above the shelf where a keyboard board with a pointer draws its buttons that are also keys, inside the side margins and at least a hit target tall. | |
| void | kleidos:: |
Draw the shelf filling band: a surface strip carrying the hints. | |
| constexpr KleidosMarkParts | kleidos:: |
The whole-pixel parts of the mark whose ring has mid radius ringR. | |
| constexpr KleidosMarkGeo | kleidos:: |
The geometry of a still mark drawn in an edge px square. | |
| constexpr int32_t | kleidos:: |
| A length of the logo grid on the screen, in 1/kMarkSubPx px. | |
| constexpr MarkBodyShape | kleidos:: |
The body and keyhole of a color mark, at deciDeg, in sub-pixels. | |
| constexpr StemSegment | kleidos:: |
The 1-bit stem at deciDeg: from the pivot to its round-capped tip. | |
| constexpr Rect | kleidos:: |
The screen box that holds every pixel of the color keyhole at deciDeg. | |
| constexpr Rect | kleidos:: |
| The box one keyhole frame repaints: the keyhole before and after. | |
| constexpr Rect | kleidos:: |
| The color body's box, its outline and antialiased edge included. | |
| constexpr uint16_t | kleidos:: |
| The ring, outline and keyhole color of a tone on a color panel. | |
| constexpr uint16_t | kleidos:: |
| The body fill of a tone on a color panel. | |
| void | kleidos:: |
| Draw the mark's body and keyhole (no ring). | |
| void | kleidos:: |
| Draw the whole mark: the ring, then the body and keyhole. | |
| void | kleidos:: |
Draw a still mark in an edge px square centered at (cx, cy). | |
| BatteryLevel | kleidos:: |
| The battery level every header shows, read from the board now. | |
| HeaderStatus | kleidos:: |
| The header status cluster as the board stands now. | |
| int16_t | kleidos:: |
| Compute the row height for a layout (single- or two-line rows). | |
| int16_t | kleidos:: |
| Compute how many rows fully fit a content height (the scroll window). | |
| int16_t | kleidos:: |
| Height of the trailing "peek" sliver drawn under the last full row. | |
| int16_t | kleidos:: |
| Usable width for a row's primary label, after chrome. | |
| uint16_t | kleidos:: |
| Sticky scroll-window top that keeps the selection on screen. | |
| uint16_t | kleidos:: |
| The window top of a list whose window a finger may have moved. | |
| uint16_t | kleidos:: |
| First visible item of a list that turns whole pages. | |
| uint16_t | kleidos:: |
| First visible item of a list on this panel. | |
| int16_t | kleidos:: |
| Y of a (possibly fractional) local row within a scrolled content rect. | |
| void | kleidos:: |
| Draw only the selection backdrop of a list row (band + focus rail). | |
| void | kleidos:: |
| Draw a single list row filling the supplied rectangle. | |
| void | kleidos:: |
| Draw the scrollable list into a content rectangle. | |
| Stack | kleidos:: |
Set parts as a centered column inside box. | |
| Stack | kleidos:: |
Set parts as layout does and draw every row where it landed. | |
| void | kleidos:: |
| Draw the timing-arc PIN dial. | |
| void | kleidos:: |
| Draw only the centered hero label of a dial. | |
| void | kleidos:: |
| Draw the ten rim digits (0..9) riding a clock face around a dial. | |
| void | kleidos:: |
| Clear the dial, its ring and everything inside it, and nothing else. | |
| void | kleidos:: |
| Draw the e-paper timing dial: rim digits, swept ring, hero numeral. | |
| bool | kleidos:: |
| Incrementally extend the swept fill by only the newly revealed slice. | |
| bool | kleidos:: |
Whether every word of the title fits a line of the title bar at card width cardW, in the card's own rung (PopupCardProps::). | |
| bool | kleidos:: |
Whether the title reads whole in the bar at card width cardW: in the card's rung or one the bar steps down to, every word on a line, within the lines the title may take. | |
| int16_t | kleidos:: |
The width a card should take for its title: cardW, or the whole width of the glass where a word of the title does not fit a line of the card at cardW (popupTitleWordsFit). | |
| int16_t | kleidos:: |
Height of the title bar for props at card width cardW. | |
| BackChipRects | kleidos:: |
| The back chip of a card drawn with PopupCardProps:: | |
| uint16_t | kleidos:: |
The fill the card's content sits on for tone (the tone's container where it has one, else the surface); paper on a 1-bit panel. | |
| uint16_t | kleidos:: |
| The tone's accent: the border, and the ink of anything the content marks in the tone (the safety line of a hold). | |
| Rect | kleidos:: |
Draw the card frame in card and return where its content goes. | |
| int16_t | kleidos:: |
| Compute the natural progress-bar height for a layout. | |
| void | kleidos:: |
| Draw a horizontal progress bar filling the supplied rectangle. | |
| void | kleidos:: |
| Draw a circular progress arc. | |
| int16_t | kleidos:: |
Smallest band side that renders payloadLen readably. | |
| QrCardPlan | kleidos:: |
| Solve the largest crisp scan card a band holds for a payload. | |
| QrColors | kleidos:: |
Dark-on-light module colors for the panel class monochrome names. | |
| constexpr QrFit | kleidos:: |
| Choose the module size a box holds (see QrFit). | |
| bool | kleidos:: |
Encode payload and draw a scalable QR code into a target box. | |
| bool | kleidos:: |
Variant of drawQr with explicit dark / light colors. | |
| bool | kleidos:: |
Encode payload into a QR module matrix (byte mode). | |
| int | kleidos:: |
Smallest version that fits dataLen payload bytes at ecc. | |
| int | kleidos:: |
Side length in modules of the symbol dataLen bytes encode to. | |
| void | kleidos:: |
| Build a standard WiFi join payload, escaping the special characters. | |
| void | kleidos:: |
Draw a row separator from x, w wide, on the row's last line y. | |
| int16_t | kleidos:: |
| Compute the pixel width a chip will occupy for a label. | |
| int16_t | kleidos:: |
| Compute the pixel width a chip will occupy for its props. | |
| int16_t | kleidos:: |
| Compute the pixel height a chip will occupy. | |
| Rect | kleidos:: |
Draw a status pill with its top-left corner at (x, y). | |
| constexpr int32_t | kleidos:: |
Clamp value to the inclusive [min, max] range. | |
| constexpr int32_t | kleidos:: |
Next value after a decrement by step, clamped at min. | |
| constexpr int32_t | kleidos:: |
Next value after an increment by step, clamped at max. | |
| int16_t | kleidos:: |
| Compute the natural (preferred) stepper height for a layout. | |
| StepperChips | kleidos:: |
The − and + chip rects for a stepper drawn in box. | |
| void | kleidos:: |
| Draw a − value + numeric stepper filling the supplied rectangle. | |
| int16_t | kleidos:: |
| Compute the natural tab-strip height for a layout. | |
| void | kleidos:: |
| Draw the tab strip filling the supplied rectangle. | |
| std::size_t | kleidos:: |
Draw multi-line text inside rect, wrapped to width and clipped to height. | |
| int16_t | kleidos:: |
| Compute the natural text-field height for a layout. | |
| void | kleidos:: |
| Draw a single-line text field filling the supplied rectangle. | |
| std::size_t | kleidos:: |
Greedily word-wrap text into rows of at most innerW pixels. | |
| std::size_t | kleidos:: |
Word-wrap text into at most lines.size() rows, cutting the last row with "…" where the words run past it. | |
| WholeWrap | kleidos:: |
Word-wrap text as wrap does, and say whether it reads whole. | |
| int16_t | kleidos:: |
Width of the widest part of text that wrapWhole cannot break. | |
| std::size_t | kleidos:: |
Break a value into rows of at most maxW pixels, so it reads whole. | |
| std::size_t | kleidos:: |
How many rows wrapValue fills for text with a budget of maxRows, without writing them. | |
| int16_t | kleidos:: |
Advance width of text in font, in the face weight draws. | |
| constexpr int16_t | kleidos:: |
Fit budget for a bold run inside a box of width width. | |
| void | kleidos:: |
Copy src into out cut to fit maxW pixels at font. | |
| LabelLines | kleidos:: |
Set a short label (a choice row, a button caption) in a box maxW pixels wide, whole wherever it can be. | |
| LabelLines | kleidos:: |
Set a record's name in a box maxW pixels wide, whole wherever the box can hold it. | |
| std::size_t | kleidos:: |
Offset of the longest tail of text that fits maxW pixels at font. | |
| Rect | kleidos:: |
| Draw an auto-positioned transient toast near the bottom edge. | |
| Rect | kleidos:: |
| Draw a full-width status banner pinned to the top or bottom edge. | |
| size_t | kleidos:: |
| Format a TOTP code as the space-grouped mono string. | |
| int16_t | kleidos:: |
| Natural Row-style card height for a layout. | |
| int16_t | kleidos:: |
Row-style card height for a list band of bandH pixels. | |
| Rect | kleidos:: |
The square a Row-style card's countdown ring occupies inside area. | |
| constexpr uint16_t | kleidos:: |
| The one color rule for every TOTP countdown (list rings, the hero ring, the code screen's bar): brand cyan, warning red for the last kTotpUrgentSeconds. | |
| void | kleidos:: |
| The one spelling of a TOTP countdown's seconds, on every surface: the number, a space and the SI "s" ("24 s"), and a leading "! " for the last kTotpUrgentSeconds ("! 3 s"), so the urgency reads by shape as well as by color. A bare "!3s" read as "13s". | |
| int16_t | kleidos:: |
| Natural Hero-style stack height for a layout. | |
| int16_t | kleidos:: |
| Natural Compact-style card height for a layout. | |
| void | kleidos:: |
Draw the TOTP code card into area. | |
| TouchKeyboardLetters | kleidos:: |
| The letter rows that match a BLE keyboard layout. | |
| void | kleidos:: |
| Set the letter rows the device's keyboards show (the BLE layout setting). | |
| TouchKeyboardLetters | kleidos:: |
| The letter rows the device's keyboards show. | |
| uint8_t | kleidos:: |
Number of keys on sheet. | |
| uint8_t | kleidos:: |
| Number of focus stops: every key, then the reveal, back and switch controls when shown. | |
| int8_t | kleidos:: |
| What a focus stop activates. | |
| uint8_t | kleidos:: |
Number of keys in row of sheet. | |
| uint8_t | kleidos:: |
Row-major index of the first key in row of sheet. | |
| TouchKeyboardKeyKind | kleidos:: |
Kind of the key at row-major index index in sheet. | |
| char16_t | kleidos:: |
| The character a TouchKeyboardKeyKind:: | |
| TouchKeyboardVariants | kleidos:: |
| The variants a held key offers. | |
| uint8_t | kleidos:: |
| Encode one code point as UTF-8. | |
| uint8_t | kleidos:: |
| Characters in a UTF-8 string: every byte that does not continue a sequence. | |
| uint8_t | kleidos:: |
| Bytes the last character of a UTF-8 string takes. | |
| Rect | kleidos:: |
The value-row rectangle at the top of area. | |
| Rect | kleidos:: |
| The reveal control's rectangle at the right end of the value row. | |
| Rect | kleidos:: |
| The back control's rectangle at the left end of the value row. | |
| Rect | kleidos:: |
| The PIN / passphrase switch's rectangle, just left of the reveal control. | |
| Rect | kleidos:: |
| Screen-space rectangle of one key. | |
| int8_t | kleidos:: |
| Resolve a touch point to the key (or value-row control) under it. | |
| Rect | kleidos:: |
| The card of a key's variant strip. | |
| Rect | kleidos:: |
| One cell of a key's variant strip. | |
| int8_t | kleidos:: |
| The variant cell a finger over the strip points at. | |
| TouchKeyboardLayer | kleidos:: |
| The layer a TouchKeyboardKeyKind:: | |
| TouchKeyboardLayer | kleidos:: |
| The layer a TouchKeyboardKeyKind:: | |
| void | kleidos:: |
Draw the value row and the four key rows into area. | |
| Rect | kleidos:: |
| Repaint one key of what drawTouchKeyboard draws, in place. | |
| Rect | kleidos:: |
| Repaint the value row of what drawTouchKeyboard draws, in place. | |
| void | kleidos:: |
Draw the masked value alone inside span, for a host's own field. | |
| int16_t | kleidos:: |
| Natural band height for the tutorial hint pill. | |
| void | kleidos:: |
Draw the tutorial goal pill centered inside band. | |
Variables | |
| constexpr const char * | kleidos:: |
| The dial's press, as every footer, tutorial and key legend names it. | |
| constexpr std::size_t | kleidos:: |
| Most cells one bar draws: a dial's two plus its tab, back and lock cells. | |
| constexpr int16_t | kleidos:: |
| Reading at or under which the gauge turns the warning red, in percent. | |
| constexpr int16_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| Inset of the gauge's fill inside its outline, in pixels. | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Number of character groups (the leading group chips in the tool row). | |
| constexpr uint8_t | kleidos:: |
| Number of cells in the tool / chip row (4 group chips + DEL + OK). | |
| constexpr uint8_t | kleidos:: |
| Most rows the identity block stacks: username, password, URL and the line. | |
| constexpr std::size_t | kleidos:: |
| constexpr std::size_t | kleidos:: |
| constexpr uint16_t | kleidos:: |
| Inclusive lower bound of the editable year range. | |
| constexpr uint16_t | kleidos:: |
| Inclusive upper bound of the editable year range. | |
| constexpr std::size_t | kleidos:: |
| Lines a dialog's body may take; past them the last line ends in "…". | |
| constexpr std::size_t | kleidos:: |
| Lines the title of a dialog that asks for nothing (a notice) may take. | |
| constexpr int16_t | kleidos:: |
| Height of the rule under the field in focus. | |
| constexpr int16_t | kleidos:: |
| Paper gap between a field line and the rule under its focused field. | |
| constexpr auto | kleidos:: |
| Room a field line keeps under it for the focus rule. | |
| constexpr int16_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| Drawn width of an icon chip (px); see the file comment for its hit box. | |
| constexpr uint8_t | kleidos:: |
| Number of octets in a dotted-quad IPv4 address (also the field count). | |
| constexpr size_t | kleidos:: |
| Buffer capacity (including NUL) that always fits ipv4ToText output. | |
| constexpr uint8_t | kleidos:: |
| Most key-cap glyphs one hint draws (a pair of chevrons for the arrows). | |
| constexpr int32_t | kleidos:: |
| Logo units from the center to the ring's mid band. | |
| constexpr int32_t | kleidos:: |
| Logo grid edge (units). | |
| constexpr int16_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| constexpr int32_t | kleidos:: |
| Sub-pixel steps per pixel of the 1-bit stem's endpoints (Canvas:: | |
| constexpr std::size_t | kleidos:: |
| Blocks one column may hold. | |
| constexpr std::size_t | kleidos:: |
| Rows one block may wrap onto. | |
| constexpr uint8_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| PinDialProps:: | |
| constexpr int16_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| Band width of the e-paper dial's solid ring (px). | |
| constexpr int16_t | kleidos:: |
| Gap between the ring and the rim digits on e-paper (px). | |
| constexpr float | kleidos:: |
| The hero numeral's scale: the mono face at twice its line height. | |
| constexpr int16_t | kleidos:: |
| constexpr std::size_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| Fewest whole pixels per module a camera can be expected to resolve. | |
| constexpr int16_t | kleidos:: |
| Width of the light margin drawn around the symbol, in modules. | |
| constexpr int | kleidos:: |
| Lowest supported QR version (21x21 modules). | |
| constexpr int | kleidos:: |
| Highest supported QR version — the documented RAM/flash cap (57x57 modules). | |
| constexpr int | kleidos:: |
| Module count (side length) of the largest supported version. | |
| constexpr std::size_t | kleidos:: |
| Worst-case matrix size in bytes (one byte per module at kMaxVersion). | |
| constexpr std::size_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Maximum tabs the strip will render (static, no heap). | |
| constexpr int16_t | kleidos:: |
| constexpr std::array< IconId, 3 > | kleidos:: |
| constexpr std::size_t | kleidos:: |
| Upper bound on rows a single drawTextBox call will wrap and draw. | |
| constexpr std::size_t | kleidos:: |
| Capacity of one wrapped line buffer including the trailing NUL. | |
| constexpr int16_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| Denominator of the bold fit share (see kBoldFitNum). | |
| constexpr std::size_t | kleidos:: |
| constexpr std::size_t | kleidos:: |
| constexpr std::size_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Seconds left at which a TOTP countdown turns to the warning color. | |
| constexpr uint32_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Rows on every layer (the numeric and letter tables are both four rows deep). | |
| constexpr uint8_t | kleidos:: |
| Largest key count across all layers (the German letter rows' 11 + 11 + 9 + 3). | |
| constexpr uint8_t | kleidos:: |
| Most variants one key offers (a: á à ä â ã å æ). | |
| constexpr int8_t | kleidos:: |
| Sentinel returned by touchKeyboardHitTest when a point misses everything. | |
| constexpr int8_t | kleidos:: |
| Sentinel returned by touchKeyboardHitTest for the reveal control. | |
| constexpr int8_t | kleidos:: |
| Sentinel returned by touchKeyboardHitTest for the back control. | |
| constexpr int8_t | kleidos:: |
| Sentinel returned by touchKeyboardHitTest for the PIN / passphrase switch. | |
Typedef Documentation
Matrix #
Caller-owned, malloc-free module matrix sized for kMaxVersion.
One byte per module: 0 = light, 1 = dark. Only the top-left size * size sub-square (with size returned by encode) is meaningful; the remainder is left untouched. Declare one on the stack and pass it in.
Enumeration Type Documentation
BannerPlacement #
ButtonState #
Visual interaction state of a button.
Drives the fill / outline / text-color presentation. The state is supplied by the caller, which chooses it; the component renders every state. Danger is an orthogonal destructive tone applied on top of the normal / focused look.
CharGroup #
One character group of the wheel (frequency-ordered).
The four character groups each expose a scrollable ring of pure glyphs. Recovery / commit are utility chips, not a group. The enumerator order is the order the group chips appear in the tool row.
CharWheelChip #
A cell in the tool / chip row (ABC abc 123 -_. DEL OK).
The four group chips swap the active ring; the DEL and OK utility chips are always one chip-walk away and resolve immediately (they never enter a ring).
| Enumerator | |
|---|---|
| GroupUpper | Enter the CharGroup:: |
| GroupLower | Enter the CharGroup:: |
| GroupDigits | Enter the CharGroup:: |
| GroupSeparators | Enter the CharGroup:: |
| Backspace | Delete the last appended glyph (utility chip). |
| Commit | Save the label and exit (utility chip). |
CharWheelMode #
The two host-owned interaction regions the wheel renders.
The two focus regions of the interaction model: the body (the scrolling ring) and the selector (the top chip row). ui::
ChipStyle #
Semantic color/role of a status chip.
Maps to a design token color; the component derives the fill/outline + text color from it (and collapses to ink on Mono1). Neutral is the dim default.
DialogSeverity #
DropdownTouch #
DtField #
Editable fields of a date-time, in left-to-right edit order.
The edit cursor advances Year → Month → Day → Hour → Minute → Zone; advancing past Zone is the commit signal (see dtAdvanceOrCommit). Count is the enumerator count, not a field.
| Enumerator | |
|---|---|
| Year | Full year (2024–2099). |
| Month | Month of year (1–12). |
| Day | Day of month (1–daysInMonth). |
| Hour | Hour of day (0–23). |
| Minute | Minute of hour (0–59). |
| Zone | Timezone index (0– |
| Count | Number of fields (not a selectable field). |
HeaderGaugeRepaint #
IconId #
Identifier of a primitive-drawn icon.
The curated catalog the component library and the screens draw: directional dial marks, chevrons, lock/
| Enumerator | |
|---|---|
| DialUp | Up triangle — CoreInk dial "up" affordance. |
| DialSelect | Filled dot — CoreInk dial "select" affordance. |
| DialDown | Down triangle — CoreInk dial "down" affordance. |
| DialUpDown | Combined up/down triangles — CoreInk dial "scroll" (▲▼) affordance. |
| ChevronUp | Up chevron — scroll-up / more-above hint. |
| ChevronDown | Down chevron — scroll-down / more-below hint. |
| ChevronLeft | Left chevron — previous / back / move-left hint. |
| ChevronRight | Right chevron — submenu / next / move-right hint. |
| Lock | Closed padlock — vault locked. |
| Unlock | Open padlock — vault unlocked. |
| Wifi | Wifi arcs — WiFi AP active. |
| Ble | Bluetooth rune — BLE active. |
| Battery | Battery outline + level fill. |
| BatteryCharging | Battery outline + charging bolt. |
| Check | Check mark — confirm / success. |
| Cross | X mark — reject / failure (wrong PIN). |
| Back | Back arrow — navigate up / cancel. |
| Key | Key — credential / password. |
| Credential | ID card with avatar — a stored credential entry. |
| Clock | Clock face — plain time. |
| Totp | Circular-arrow timer clock — TOTP / rotating code. |
| Settings | Three sliders — settings. |
| Warning | Warning triangle with exclamation — destructive / caution. |
| Keyboard | Keyboard outline — type / send keystrokes over BLE HID. |
| Trash | Trash can — delete an entry (destructive action). |
| Card | Card with a header band and two lines — the vault tab. |
| Menu | Hamburger (three rules) — the settings / more tab. |
| Eye | Open eye — reveal the masked value (secret currently hidden). |
| EyeOff | Struck-through eye — hide again (secret currently revealed). |
| Shift | Hollow up-arrow (U+21E7) — on-screen keyboard shift key. |
| Backspace | Left pentagon with an X (U+232B) — delete the last character. |
| Plus | Plus sign — add a new entry (network, host). |
| Enter | Return arrow (U+21B5) — the Enter key on a keyboard. |
| Tap | A contact point in a ring — a tap on the glass. |
| SwipeVertical | Up-and-down double arrow — a vertical swipe (scroll). |
| SwipeHorizontal | Left-and-right double arrow — a sideways swipe (tabs). |
| Person | Head and shoulders — a username / account. |
| Globe | Circle with an equator and a meridian — a web address. |
| Info | Ring with a dot over a stem — an informational tone. |
KleidosMarkStyle #
How the pixel-fit mark draws its body.
The ring is drawn in both: the logo never drops it. Below kKleidosMarkSolidBodyMaxEdge the 1 px outline, its accent fill and the keyhole inside it read as one muddy blot at arm's length, so the small mark is the solid-body version.
ListRowSize #
Vertical density of a list row.
Compact is the default menu/settings row (primary label in the BODY role). Comfortable is the taller two-line pitch the host lists use: the box is sized for the HEADING role with a larger gap to the secondary line, while the label reads at the BODY role like every other list. Cozy is a single-line credential row at the density of the Sticks' vault list: a BODY-role label in a ~32 px box with generous symmetric padding and no secondary line. All resolve their pixel sizes from the LayoutContext token scales, never magic numbers.
ListRowState #
Visual interaction state of a list row.
Supplied by the caller, which chooses it. Back tints the row as a navigation-up affordance; Disabled dims it.
ListRowTrailing #
Kind of trailing accessory drawn on the right of a row.
| Enumerator | |
|---|---|
| None | No trailing accessory. |
| Value | Right-aligned value string (ListRowProps:: |
| ToggleOn | Toggle shown ON. |
| ToggleOff | Toggle shown OFF. |
| Chevron | Submenu chevron icon. |
| Chip | Semantic status pill (ListRowProps:: |
MarkTone #
ProgressTone #
QrCaptionSide #
QrEcc #
StepperFocus #
Which stepper affordance currently carries focus.
On a 2-button device only one side is "armed" at a time (the screen toggles which side a tap nudges); the focused side renders with the accent / ink chip.
TextFieldState #
Visual interaction state of a text field.
Supplied by the caller, which chooses it. Drives the frame color and whether the caret is rendered.
ToastSeverity #
Severity tone of a toast / banner (mirrors popup::
| Enumerator | |
|---|---|
| Info | Neutral — brand cyan accent. |
| Success | Positive — green accent. |
| Caution | Soft warning — yellow accent. |
| Warning | Error / destructive — red accent. |
| Admin | Admin-mode banner — the status.info accent ( |
TotpCardStyle #
TouchKeyboardKeyKind #
What a keyboard cell does when activated.
| Enumerator | |
|---|---|
| Char | Append touchKeyboardCodepointAt to the value. |
| Shift | Toggle Lower <-> Upper. |
| Backspace | Remove the last entered character. |
| LayerToggle | Toggle letters <-> Symbols. |
| Space | Append a space. |
| Confirm | Submit the entered secret. |
TouchKeyboardLayer #
Which glyph table the keyboard is showing.
Numeric is the PIN surface and is never reachable from the letter layers; the other three are the passphrase surface and cycle through their own shift and layer-toggle keys.
TouchKeyboardLetters #
The letter rows of the passphrase layers, one per keyboard layout.
Index-stable with the BLE keyboard layout setting through touchKeyboardLettersForLayout. The symbol and numeric layers are the same under every entry.
Weight #
The face a run is drawn in, and so the face it is measured in.
| Enumerator | |
|---|---|
| Regular | Measured by ui:: |
| Bold | Measured by ui:: |
WifiAuth #
Function Documentation
actionBarCutsCaption() #
Whether the bar for props would cut a caption, one size down included.
A base cell's verb steps down a size before it is cut, and only one that does not fit then ends in "…". This reports that last case, for a surface that must not cut its text and can set ActionBarProps::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (measures text). layout in Responsive context. props in Semantic action slots to present.
- Return values
-
Value Meaning true A caption would be drawn cut.
actionBarHeight() #
Height the bar for props takes from the bottom edge.
One shelf (LayoutContext::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (measures the extra cells). layout in Responsive context. props in Semantic action slots to present.
- Returns
- Pixels from the bottom edge.
batteryGaugeBodyWidth() #
Width of the gauge's body outline for a status slot of iconSize.
- Parameters
-
Name Direction Meaning iconSize in Side of the header's square status slot, in pixels.
- Returns
- The body width in pixels.
batteryGaugeFillWidth() #
Width of the fill a gauge in a status slot of iconSize draws for level.
- Parameters
-
Name Direction Meaning iconSize in Side of the header's square status slot, in pixels. level in The level shown.
- Returns
- The fill width in pixels: 0 for an empty level or an unknown one.
batteryGaugeSteps() #
Steps a gauge drawn in a status slot of iconSize can show: one per pixel column of its fill.
- Parameters
-
Name Direction Meaning iconSize in Side of the header's square status slot, in pixels.
- Returns
- The step count, at least 1.
batteryLevelFor() #
The level a gauge shows for pct with no history: its own step and the red mark at kBatteryLowPct. A first reading, or a gauge drawn for a fixed percent (the component gallery).
- Parameters
-
Name Direction Meaning pct in Battery reading in percent. steps in Steps the fill is divided in (at least 1).
- Returns
- The level.
batteryStepFor() #
A reading's own step: the fill level nearest to pct.
- Parameters
-
Name Direction Meaning pct in Battery reading in percent (clamped to 0..100). steps in Steps the fill is divided in (at least 1).
- Returns
- The step, 0 to
steps.
boldFitWidth() #
Fit budget for a bold run inside a box of width width.
- Parameters
-
Name Direction Meaning width in Width of the box the run is drawn in, in pixels.
- Returns
- The width to fit the run against when measuring it in the regular face (see kBoldFitNum).
brandLogoKey() #
The string drawBrandMark looks the registry logo up in.
props.url when it is non-empty, else props.domain. A list row passes no URL, so its logo key is its brand token; a detail screen that passes the record's URL looks the logo up there instead. Two surfaces show the same logo for a record exactly when their keys name the same brand.
- Parameters
-
Name Direction Meaning props in The mark's props.
- Returns
- The logo lookup key; null or empty when the mark has none.
brandToken() #
The string a credential's brand mark is keyed by: its brand token.
The record's list domain when it has one, else its display name. The list domain is the index's domain column, kleidos::
Every surface that draws a credential's mark passes this as BrandMarkProps::
- Parameters
-
Name Direction Meaning listDomain in The record's list domain; null or empty when it has none, or when the row's domain has not been read yet. name in The record's display name.
- Returns
listDomainwhen it is non-empty, elsename.
buttonHeight() #
Compute the natural (preferred) button height for a layout.
height = bodyFontHeight + 2 * verticalPadding. A caller may use a taller rect; the component centers the label either way. Exposed so screens can size a button row before drawing.
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved body-font height + spacing).
- Returns
- Preferred button height in pixels.
capHint() #
A hint for a letter key, drawn as its key cap.
- Parameters
-
Name Direction Meaning key in The key's legend (one letter). verb in What the key does. primary in Whether it is the screen's main action.
- Returns
- The hint.
charWheelBandRect() #
The wheel-band sub-rect of area (the horizontal glyph-ring strip).
The band is the middle tier of the editor (chips above, label below). The host uses it to repaint ONLY the sliding ring during a glyph-ring tween, leaving the static chips and label untouched in the framebuffer — a dirty-only fast path that cuts the per-frame render + blit cost so the slide animates smoothly. Returns an empty rect when the band would be too short to render.
- Parameters
-
Name Direction Meaning layout in Responsive context (carries the device profile). area in Same content rectangle passed to drawCharWheel.
- Returns
- The band rect, or an empty rect when it would not render.
charWheelChipAt() #
The chip at tool-row column col (ABC abc 123 -_. DEL OK).
- Parameters
-
Name Direction Meaning col in Zero-based chip-row column [0, kCharWheelChipCount).
- Returns
- The chip kind (group chip or DEL / OK utility chip).
charWheelChipGroup() #
Map a group chip to the group it enters.
- Parameters
-
Name Direction Meaning chip in A group chip (CharWheelChip:: GroupUpper … GroupSeparators).
- Returns
- The target group; defaults to CharGroup::
Upper for the utility chips (the caller must check the chip kind first).
charWheelChipLabel() #
Short chip label for a group (drawn in the tool row).
- Parameters
-
Name Direction Meaning group in Group to label.
- Returns
- A static, NUL-terminated ASCII chip label (e.g. "ABC", "123").
charWheelChipLabelFor() #
Short ASCII label for a chip-row cell.
- Parameters
-
Name Direction Meaning chip in Chip to label.
- Returns
- A static, NUL-terminated ASCII label (e.g. "ABC", "DEL", "OK").
charWheelGlyphAt() #
The appendable glyph at index in a character group's ring.
- Parameters
-
Name Direction Meaning group in Character group (CharGroup:: Upper … ui:: CharGroup:: Separators). index in Ring index [0, ringLen) (wrapped modulo the ring length).
- Returns
- The ASCII glyph at that ring index.
charWheelNextChip() #
Advance the group-chip selector by one, wrapping at the chip count.
- Parameters
-
Name Direction Meaning chip in Current chip.
- Returns
- The next chip in the chip-row walk.
charWheelNextIndex() #
Advance a wheel ring index by one, wrapping at the ring length.
- Parameters
-
Name Direction Meaning group in Active group (determines the ring length). index in Current ring index.
- Returns
- The next index, wrapped to [0, ringLen).
charWheelPrevIndex() #
Step a wheel ring index back by one, wrapping at the ring length.
- Parameters
-
Name Direction Meaning group in Active group (determines the ring length). index in Current ring index.
- Returns
- The previous index, wrapped to [0, ringLen).
charWheelRingLen() #
Number of cells in a group's ring.
The ring is pure glyphs (no suggestion stop), so the count equals the group's glyph count.
- Parameters
-
Name Direction Meaning group in Group to measure.
- Returns
- Ring length (>= 1).
chipHeight() #
Compute the pixel height a chip will occupy.
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved small-font height + padding).
- Returns
- Chip height in pixels.
chipWidth() [1/2] #
Compute the pixel width a chip will occupy for a label.
width = textWidth + 2 * horizontalPadding. Lets a caller right-align or pack chips before drawing. Returns 0 for an empty label.
- Parameters
-
Name Direction Meaning canvas in Surface (for text measurement in the small role). layout in Responsive context (resolved spacing). label in Chip label.
- Returns
- Chip width in pixels.
chipWidth() [2/2] #
Compute the pixel width a chip will occupy for its props.
As the label-only overload, plus the leading glyph and its gap when StatusChipProps::
- Parameters
-
Name Direction Meaning canvas in Surface (for text measurement in the small role). layout in Responsive context (padding, glyph size). props in The chip as it will be drawn.
- Returns
- Width in pixels.
chooseVersion() #
Smallest version that fits dataLen payload bytes at ecc.
Exposed for tests / sizing (the same logic encode uses internally).
- Parameters
-
Name Direction Meaning dataLen in Payload length in bytes. ecc in Error-correction level.
- Return values
-
Value Meaning 1..kMaxVersion The chosen version. 0 The payload does not fit within kMaxVersion.
clampDay() #
Re-clamp DateTimeFieldModel::
Called after any change to the year or month so a day such as 31 folds down to the last valid day of a shorter month (e.g. Feb 28/29). Also lifts a zero day to 1. Leaves an already-valid day unchanged.
- Parameters
-
Name Direction Meaning m in, out The model whose dayis re-clamped in place.
clearPinDial() #
Clear the dial, its ring and everything inside it, and nothing else.
Fills the disc of radius rOuter + kPinDialClearPad about the dial center in bg, so a repaint of the ring and the hero numeral starts from a clean dial while the rim digits riding outside it (drawPinDialRimDigits) stay as they were. A square of the same half-width is not that: its corners sit √2 further out and cut the numerals on the diagonals (1, 4, 6 and 9 on the Sticks' 135 px panel).
No-op for a non-positive PinDialProps::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. props in Carries the center and PinDialProps:: rOuter. bg in Background color the dial is cleared to (RGB565).
codeOfferHeight() #
Natural height of the offer's stack, for a caller that centers it.
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Returns
- Stack height in pixels (the hint counted at two lines).
countdownRingSweepDeg() [1/2] #
Swept angle (degrees, clockwise from the top) for a remaining fraction.
Pure sector math shared by the render and the native tests: the sweep is linear in fraction, clamped to [0, 360]. Non-finite input maps to 0.
- Parameters
-
Name Direction Meaning fraction in Remaining fraction of the window (1 = full ring).
- Returns
- Sweep in degrees, 0..360.
countdownRingSweepDeg() [2/2] #
Swept angle for a seconds-remaining / period pair (integer-exact).
Convenience overload used by the TOTP surfaces: remaining * 360 / period with the same clamping as the fraction form. A zero periodSeconds yields 0.
- Parameters
-
Name Direction Meaning remainingSeconds in Seconds left in the current window. periodSeconds in Window length in seconds.
- Returns
- Sweep in degrees, 0..360.
daysInMonth() #
Days in month of year, accounting for leap-year February.
The proleptic-Gregorian leap rule (year % 4 == 0 && (year % 100 != 0 ||
year % 400 == 0)) is applied so February is 29 days in a leap year and 28 otherwise. An out-of-range month (0 or > 12) returns 31 defensively.
- Parameters
-
Name Direction Meaning year in Full year (e.g. 2026). month in Month of year, 1–12.
- Returns
- Number of days in that month, 28–31.
draw() #
Set parts as layout does and draw every row where it landed.
- Parameters
-
Name Direction Meaning canvas in, out Surface to draw on (inside the caller's frame). parts in The blocks, top to bottom. box in The box the column is set in.
- Returns
- The column that was drawn.
drawActionBar() [1/2] #
Draw the affordance-driven hint bar into the reserved footer shelf.
Lays the bar out across LayoutContext::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). props in Semantic action slots to present.
drawActionBar() [2/2] #
Draw the hint bar, as drawActionBar does, and record it in drawn.
The full-draw half of a footer that a hold gauge repaints: every full paint of that footer goes through here, so repaintActionBar knows what is on the glass.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). props in Semantic action slots to present. drawn out What the bar now shows.
drawBackKeyCap() #
Draw the mark of a dedicated back key (the CoreInk side key).
A 2 px ink key-cap outline with a left chevron. The key sits outside the glass, so the mark names it instead of inviting a tap. The header draws it in its back chip; a screen without a header (the PIN dial) draws it at headerBackRects' chip.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context. chip in The cap's box.
drawBanner() #
Draw a full-width status banner pinned to the top or bottom edge.
Pure: no retained state. Draws nothing without a message.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). props in Message / severity / placement.
- Returns
- The drawn banner rectangle (empty rect if nothing was drawn).
drawBodyBattery() #
Draw the battery gauge on a screen that has no header bar, on the screen's background, and record it so it stays live at rest.
The header's own gauge (the same step, red mark and charge tint), right-aligned on rightX and centered on cy. Unlike drawStatusBattery it is recorded in glassHeaderGauge as a gauge on the background (HeaderGaugeSlot::), so the main loop repaints it alone when the battery moves, as it does a header's. For a screen whose body already carries the brand (the keyboard boards' lock screen).
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface; the background under the gauge is already painted. layout in Responsive context (the slot size, the panel's tone). rightX in Right edge the gauge packs against. cy in Vertical center. live in What the gauge shows.
drawBrandKeyMark() #
Draw the Kleidos mark (a keyhole in a ring) at the official geometry.
The product's mark, drawn from ui::Canvas primitives through drawKleidosMarkAtEdge in a square of edge 2 radius + 1, so the small-size rule holds here too: below 24 px a solid body with the keyhole cut out, from 24 px an outlined body, the ring always. Used where no baked mark is available and as the small lockup mark on the PIN screen. Primary on color panels, ink on Mono1.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (carries the device profile / color mode). centerX in Center X in pixels. centerY in Center Y in pixels. radius in Half the mark's edge in pixels; clamped to a minimum of 6.
drawBrandMark() #
Draw the brand badge within box, returning true if drawn.
On device, attempts the registry logo for the box size (looked up in props.url when set, else in props.domain); on a miss (or when the letter fallback is forced) draws the deterministic letter tile, colored by props.domain alone. On host only the letter path is compiled, so tests assert the fallback geometry/
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (carries the device profile). box in Square-ish target rectangle for the badge. props in Brand token / label / URL / registry toggle.
- Return values
-
Value Meaning true A badge (logo or letter) was drawn. false Nothing was drawn (empty box).
drawButton() #
Draw a pressable button filling the supplied rectangle.
Renders the fill / outline appropriate to the ui::box; long labels are not clipped by the backend (the caller sizes box to fit). Pure: no retained state. Draws nothing for an empty rect or an empty label.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). box in Button rectangle in screen space. props in Label + visual state.
drawCharWheel() #
Draw the paged character wheel into area.
Renders, top to bottom: the six tool chips (ABC abc 123 -_. DEL OK; the highlighted / active one boxed or underlined) as the tools, the horizontal wheel with a generous portrait center selection box and faded neighbor previews, a row of position dots marking the ring index, and the in-progress label with a blinking caret pinned to the bottom. In CharWheelMode::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). area in Content rectangle to fill (between header and action bar). props in Host-owned current state.
drawCharWheelBand() #
Draw ONLY the wheel band (sliding glyph ring + center box + position dots) of area — not the chips or the label.
The dirty-only companion to drawCharWheel — during a ring-slide tween the chips and label do not change, so the host clears and repaints just charWheelBandRect with this. The caller clears the band background first.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). area in Same content rectangle passed to drawCharWheel. props in Host-owned current state.
drawCodeOffer() #
Draw the offer, centered vertically in body.
Top to bottom: a check mark and CodeOfferProps::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context. body in Region between the screen's header and its keys. props in Texts and code.
drawColorFieldFocus() #
Draw the accent rule under the field in focus on a color panel.
The accent tint alone is the kind of single-channel mark WCAG 2.2 SC 1.4.1 rules out, and on these panels the neighboring fields are the same size and weight, so the rule is what says which one a key will change. It sits the same ui::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. left in Left edge of the rule. width in Width of the rule (the field's measured text width). centerY in Vertical center of the field's line. lineH in Height of that line.
drawCountdownRing() #
Draw the countdown ring: dim track + linear remaining-fraction sector.
Color panels fill an anti-aliased annulus sector; non-AA panels draw the crisp per-degree spoke fallback. Pure: no retained state. Draws nothing for a non-positive radius.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). props in Center / radius / thickness / fraction / colors.
drawCredIdentity() #
Draw the identity block into column.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context. column in The block's rectangle; rows stack from its top. props in What the record carries.
drawDateTimeField() #
Draw the YYYY-MM-DD HH:MM timestamp + a zone line into a rectangle.
On a box wide enough for the whole timestamp in the HEADING face (the 320 px panels) it is one BODY line; on a narrower box (the 135 px sticks) the date and the time stack on two HEADING lines, so the digits can take the larger face exactly where they were smallest.
Renders each field as text, highlighting the active field in theme:: and the rest in theme:: over a theme::kBg565 background — solid colors only (no alpha). On a Mono1 / e-paper panel, where the accent prints as ink, the active field is paper text on an ink band its own width, with a 2 px ink rule under the band, and every line keeps room for that rule. Sizes come from the LayoutContext; the component draws nothing for an empty rect or a null model.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile + scales). box in Field rectangle in screen space. props in Borrowed model + resolved zone name.
drawDialog() #
Draw a centered modal dialog over the screen.
Sizes a card centered in the layout bounds, renders the title (accent tinted), the word-wrapped body, and the action row (1 or 2 cells presented like the action bar). Pure: no retained state. Draws nothing when there is no title and no body.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). props in Title / body / action labels / severity.
- Returns
- The drawn card rectangle (empty rect if nothing was drawn).
drawDropdown() #
Draw a single-select dropdown popover filling the supplied rectangle.
Renders a surface panel, the optional title band, and the windowed option list: the focused option gets the selection band, the applied option gets a trailing marker. Pure: no retained state. Draws nothing for an empty rect or an empty option list.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). box in Popover rectangle in screen space. props in Title + options + selection / focus / scroll.
drawEpaperTimingDial() #
Draw the e-paper timing dial: rim digits, swept ring, hero numeral.
The one drawing of that dial. Unlock enters its PIN on it and setup rehearses on it, so what is practiced is the screen that is met later — a rehearsal drawn a little differently teaches a dial the owner never sees.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (the mono face sizes the rim). cx in Center x of the dial. cy in Center y. radius in Outer radius of the ring. percent in Sweep of the hold, 0..100, clockwise from twelve. digit in The numeral under the sweep.
drawHeader() #
Draw the header / status bar across the top edge.
Renders the surface shelf (or a divider rule on Mono1), the left title (and optional subtitle), and the right-aligned status cluster. Pure: no retained state. Draws nothing when props has no title and no active status flag.
On the glass (Canvas::) it rewrites the battery gauge's record (ui/
Returns the status cluster's left edge (the "next available right edge" one gap to the left of the leftmost status token), so a caller that packs a trailing element against the cluster — e.g. the Sticks' clock chip — can position it from the actual drawn geometry instead of re-deriving the token widths. When there is no status cluster this is the right content inset.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (carries the device profile). props in Title / subtitle / status to present.
- Returns
- Status cluster left edge in pixels (title-clamp boundary before the gap).
drawHeaderBeside() #
Draw the header as drawHeader does, and say which reserve the title kept for the trailing element the caller draws next.
With HeaderProps:: set, the title keeps the full reserve where it (or its short form) still reads whole beside it, and the compact one otherwise, so a "clock not set" chip gives up its word before the title gives up its name. The caller draws its element at the width returned.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (carries the device profile). props in Title / subtitle / status to present.
- Returns
- The cluster's left edge and the reserve used.
drawHoldRim() #
Paint the rim around row for a hold that is progress01 charged.
The first call lays a dim 1 px track around the whole row; later calls ink the arc the hold has reached, clockwise from the top-left corner, and the rim turns to the success ink once the hold is complete.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface; the call brackets its own frame. row in The row to draw around. progress01 in Hold progress, clamped to 0..1. state in, out The caller's rim state (see HoldRimState). stepPct in Advance step in percent; 0 uses kHoldRimStepPct.
drawIcon() [1/3] #
Draw an icon centered inside a box.
The icon is rendered into the largest centered square that fits box, scaled from box size. Pure: emits only Canvas primitive calls, holds no state. Draws nothing for an empty box. The caller passes the resolved RGB565 color, so the icon is color-agnostic (no mono mapping done here).
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. box in Bounding rectangle the icon is centered + scaled into. id in Which icon to draw. color in Already-resolved RGB565 draw color.
drawIcon() [2/3] #
Convenience overload: draw an icon from a center point and size.
Builds the centered square box of side size around (cx, cy) and forwards to drawIcon. Lets a caller place an icon by its center without computing the bounding rect.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. cx in Center X in pixels. cy in Center Y in pixels. size in Square side length in pixels. id in Which icon to draw. color in Already-resolved RGB565 draw color.
drawIcon() [3/3] #
Draw an icon centered on a point, with a stroke of at least minStroke.
As the centered overload, but the stroke (about 1/12 of the side) never drops below minStroke: a 1-bit panel draws small marks with 2 px strokes so they do not read as hairlines.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. cx in Center X in pixels. cy in Center Y in pixels. size in Square side length in pixels. id in Which icon to draw. color in Already-resolved RGB565 draw color. minStroke in Thinnest stroke in pixels.
drawIconChip() #
Draw an icon chip filling box.
Pure: no retained state; draws nothing for an empty rect. Leaves the canvas's known background at the page background, as it found it.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (corner radius). box in Chip rectangle in screen space. props in Glyph and look.
drawIpv4Field() #
Draw the NNN.NNN.NNN.NNN address + an optional caption into a rect.
Octets render zero-padded to three digits in the MONO data font (stable cell layout while stepping), the rest in theme:: over theme::kBg565. The active octet is theme:: with an underline cursor on a color panel, and paper text on an ink band with a rule under it on a 1-bit panel (see field_focus.h); the caption keeps clear of the rule. Sizes come from the LayoutContext; the component draws nothing for an empty rect or a null model.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile + scales). box in Field rectangle in screen space. props in Borrowed model + optional caption.
drawKeyCap() #
Draw a letter key as its key cap: the letter, bold, in a rounded box.
The keyboard boards' way to name a key that has no glyph of its own (R, T, E…), beside the action it runs. Draws nothing for an empty key.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. cx in Center X in pixels. cy in Center Y in pixels. size in The box's side in pixels. key in The key's legend (one letter). color in Already-resolved RGB565 color of the box and the legend.
drawKeyHintShelf() #
Draw the shelf filling band: a surface strip carrying the hints.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context. band in The strip to fill. props in The hints.
drawKleidosMark() #
Draw the whole mark: the ring, then the body and keyhole.
Color: the ring an antialiased band in the tone's hue. 1-bit: an ink ring of the band's width, or for a knockout an ink disc to the ring's outer edge. The caller clears what lies under the mark and brackets the frame.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. geo in The mark. view in How it is drawn.
drawKleidosMarkAtEdge() #
Draw a still mark in an edge px square centered at (cx, cy).
The small-size rule in one place: below kleidos::background; from it up the official geometry with an outlined body. The ring is drawn at every size.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. cx in Center X. cy in Center Y. edge in The square's edge (px). mono in Whether the panel is 1-bit ink. background in What the mark stands on.
drawKleidosMarkBody() #
Draw the mark's body and keyhole (no ring).
Color: the body filled in the tone's container and outlined in its hue, the eye and the stem in the hue, in one antialiased pass over what the mark stands on (kleidosMarkBodyShape, Canvas::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. geo in The mark. view in How it is drawn.
drawKleidosMarkPrimitive() #
Draw the pixel-fit Kleidos mark from canvas primitives.
The parts of kleidosMarkPixels around the center pixel of the edge square at (left, top), in the edge's KleidosMarkStyle. Outlined: a color panel fills the body with the accent and draws the ring, the body outline and the keyhole in the primary; a 1-bit panel draws them in ink and leaves the body paper. Solid body: the ring and the whole body in the primary (ink on a 1-bit panel), then the keyhole in background, so the bar shows through it. The e-paper header draws this, and so does any header where no raster is compiled (the host build).
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. left in Left edge of the mark's square. top in Top edge of the mark's square. edge in The square's edge in pixels. mono in Whether the panel is 1-bit ink. background in What the mark stands on: the color a solid body's keyhole is cut out to (the bar's surface, or paper).
drawListRow() #
Draw a single list row filling the supplied rectangle.
Renders the selection highlight, leading marker, width-fitted primary (and secondary) label, and the trailing accessory. Long labels are truncated by bounds math (no backend clip). Pure: no retained state. Draws nothing for an empty rect.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). box in Row rectangle in screen space. props in Row content + state. suppressSelectionFill in When true, a Selected row keeps its selected text/marker styling but does NOT paint its own background fill — used by the animated list, which draws one continuous sliding highlight band behind the rows instead.
drawListRowSelectionBand() #
Draw only the selection backdrop of a list row (band + focus rail).
The exact selected-row visual drawListRow paints (flat accent band + kPrimary left rail on color panels; full ink inversion + paper marker bar on Mono1), exposed so custom-anatomy rows (e.g. the TOTP tab's code rows) reuse the one selection styling instead of re-deriving it. Draws nothing for an empty rect.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). box in Row rectangle in screen space.
drawMenuList() #
Draw the scrollable list into a content rectangle.
Lays rows top-to-bottom from scrollTop, drawing only the rows that fit content (the visible window), maps selected to the highlighted row, and draws a scroll-rail / chevron hint whenever the list is longer than the window (count > visibleRows — the same condition under which scrollWindowTop can move the window, and the same one that reserves the rail's gutter width, so the affordance and its gutter always agree). The trailing peek sliver never enters that decision: it is a reduced render, not a resting place for the selection. Pure: no retained state. Draws nothing for an empty rect or zero items.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). content in Content rectangle the list fills. props in Items / selected / scrollTop.
drawMonoFieldFocus() #
Draw the field in focus on a 1-bit panel: paper text on an ink band, with an ink rule under the band.
The band is the text's measured width by bandH, centered on centerY; the rule runs the band's width, ui::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. text in The field's text. left in Left edge of the band and of the text. centerY in Vertical center of the band and of the text. font in Font role the text is set in. bandH in Height of the band: the line the text sits on.
drawPinDial() #
Draw the timing-arc PIN dial.
Composition order gives ring presence at idle and bright progress on top:
- TRACK: the full annulus (0..360) in the dim track color.
- PROGRESS: the lit arc in the bright fill color, from PinDialProps::
startDeg for PinDialProps:: sweepDeg (or percent*360/ 100) degrees. - OUTLINES: the two concentric circle edges.
- MARKERS: the exterior per-digit ticks.
- LABEL: the optional centered hero numeral.
On a color panel with a readable framebuffer the annulus / outline steps use the coverage-AA primitives; otherwise they use the crisp concentric-circle + point-plotted-sweep fallback. Pure: no retained state. Draws nothing for a non-positive PinDialProps::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper / host). props in Center / radii / band / percent / colors / label.
drawPinDialLabel() #
Draw only the centered hero label of a dial.
Renders PinDialProps::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. props in Carries the label, its center, and its color.
drawPinDialRimDigits() #
Draw the ten rim digits (0..9) riding a clock face around a dial.
The dial has a ring of rim numerals in place of tick markers: digit 0 at 12 o'clock, increasing clockwise (matching the sweep), each glyph centered on the circle of radius ringRadius about (PinDialProps::activeMarker (e.g. kNoActiveMarker) highlights none. The caller computes ringRadius so the glyph band nests outside the ring (typically rOuter + pad + monoLineHeight/
Shared by the PIN entry and the dial tutorial of first-time setup, so the practice dial is pixel-true to the real one.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. props in Carries the center, the dim/live inks ( marker/markerActive), and the live digit (activeMarker).ringRadius in Radius of the glyph-center circle (px).
drawPinDialSlice() #
Incrementally extend the swept fill by only the newly revealed slice.
For a monotonically growing gauge (the PIN timing dial within one digit), the fill wedge only ever advances. Instead of repainting the whole [0, sweepDeg] wedge each frame (drawPinDial), this paints just the angular slice [fromPercent, to props.percent] of the annulus in PinDialProps::
Color-TFT (AA) only and a no-op when ui::
- Parameters
-
Name Direction Meaning props in Dial geometry + colors; PinDialProps:: percent is the NEW (target) fill. fromPercent in The fill the dial was last painted at (0..100); the slice spans [fromPercent, percent]. kNoPriorSweep or a value >= percent paints nothing.
- Returns
- true if the slice was painted incrementally; false if the caller must fall back to a full drawPinDial.
drawPopupCard() #
Draw the card frame in card and return where its content goes.
The rectangle below the title bar, inset by the card's padding. The known background is left set to the content fill. Marks the open frame heavy (Canvas::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context. card in The whole card, bar included. props in Title, tone and icon.
- Returns
- The content rectangle.
drawProgressArc() #
Draw a circular progress arc.
Renders the dim ring track plus the filled arc (clockwise from the top) and an optional centered label. The backend exposes no native arc primitive: the track is short chord segments and the fill is a fan of radial spokes that overlap into a solid annulus; the angular step is coarsened on e-paper to limit refresh cost. Pure: no retained state. Draws nothing for a non-positive radius.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). props in Center / radius / thickness / percent / tone / label.
drawProgressBar() #
Draw a horizontal progress bar filling the supplied rectangle.
Renders the rounded track plus the filled portion sized by percent. Pure: no retained state. Draws nothing for an empty rect.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). box in Bar rectangle in screen space. props in Percent + tone.
drawQr() [1/2] #
Variant of drawQr with explicit dark / light colors.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. x in Top-left X of the target box. y in Top-left Y of the target box. targetSizePx in Desired square side in pixels. payload in NUL-terminated payload string. ecc in Error-correction level. colors in Dark / light module colors.
- Return values
-
Value Meaning true The QR was encoded and drawn. false Encoding failed; nothing drawn.
drawQr() [2/2] #
Encode payload and draw a scalable QR code into a target box.
Encodes with the in-house byte-mode encoder (auto-version), then fills the dark modules through canvas, centered in the targetSizePx box at (x, y) with a quiet-zone light border. Draws nothing (returns false) if the payload cannot be encoded at ecc within the encoder's version cap.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). x in Top-left X of the target box. y in Top-left Y of the target box. targetSizePx in Desired square side in pixels (the QR is centered inside it on an integer module grid). payload in NUL-terminated payload string. ecc in Error-correction level (default Medium).
- Return values
-
Value Meaning true The QR was encoded and drawn. false Encoding failed (payload too long for the version cap); nothing drawn.
drawRowRule() #
Draw a row separator from x, w wide, on the row's last line y.
Monochrome only: on a color panel the rows are separated by their own fills and a rule would only add noise, so nothing is drawn.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (its profile decides the treatment). x in Left edge of the rule. y in Row of pixels the rule occupies. w in Width of the rule.
drawStatusBattery() #
Draw the header's battery gauge outside a header, right-aligned on rightX and centered on cy, over the background already there.
For a screen with no header bar that still shows the battery (the Core's PIN column). The gauge is the header's own: the same step, red mark and charge tint. It is not recorded for the at-rest repaint (header_
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (the slot size, the panel's tone). rightX in Right edge the gauge packs against. cy in Vertical center. live in What the gauge shows.
drawStatusChip() #
Draw a status pill with its top-left corner at (x, y).
Self-sizes from the label; use chipWidth / chipHeight to lay out around it. Pure: no retained state. A chip with a glyph and no label draws the glyph alone, centered in the pill; one with neither draws nothing.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (carries the device profile). x in Left edge in pixels. y in Top edge in pixels. props in Chip label / style / fill.
- Returns
- The drawn chip rectangle (empty rect if nothing was drawn).
drawStepper() #
Draw a − value + numeric stepper filling the supplied rectangle.
Renders the two square affordance chips at the rectangle's left / right edges and the centered StepperProps::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). box in Stepper rectangle in screen space. props in Value + bounds + focus.
drawTabBar() #
Draw the tab strip filling the supplied rectangle.
Splits band into min(count, kMaxTabs) equal cells, draws each label centered, and highlights the selected one (accent fill + underline on color, K0-inverse cell on Mono1). Pure: no retained state. Draws nothing for an empty band or zero tabs.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). band in Tab-strip rectangle in screen space. props in Labels / count / selected index.
drawTextBox() #
Draw multi-line text inside rect, wrapped to width and clipped to height.
When wrap is true the text is greedily word-wrapped to rect.w and the resulting rows are drawn from the top; when false the text is treated as a single line. Either way an exact software clip is armed to rect for the duration of the draw, so rows (or a long unwrapped line) that exceed the box are cut at its edges and never paint outside it. The clip is released before returning. Pure: no retained state. Draws nothing for an empty rect or text.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (line-height metrics, profile). rect in Destination rectangle in screen space. text in NUL-terminated text to lay out. props in Font / color / datum / bold / line spacing. wrap in Word-wrap to rect.wwhen true; single line when false.
- Returns
- Number of lines actually drawn (before height clipping drops pixels).
drawTextField() #
Draw a single-line text field filling the supplied rectangle.
Renders the framed box, the visible (caret-anchored) tail of the content (or the dim placeholder when empty), and the caret when focused. Masks each glyph with * in password mode. Only the characters that fit the inner width are drawn (bounds math; no backend clip). Pure: no retained state. Draws nothing for an empty rect.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). box in Field rectangle in screen space. props in Content / placeholder / state / password / caret.
drawToast() #
Draw an auto-positioned transient toast near the bottom edge.
Self-sizes from the longer of title / detail, centers horizontally, and floats above the action-bar shelf. Pure: no retained state. Draws nothing without a title.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). props in Title / detail / severity.
- Returns
- The drawn toast rectangle (empty rect if nothing was drawn).
drawTotpCodeCard() #
Draw the TOTP code card into area.
Hero style centers the ring/area; Row style lays the issuer + code left and the compact ring right. Pure: no retained state; the background is the caller's (region fills stay at the call site so dirty-only repaints keep working). Draws nothing for an empty rect.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). area in Card rectangle in screen space. props in Code / window / style / gate.
drawTouchKeyboard() #
Draw the value row and the four key rows into area.
Pure: no retained state, draws nothing for an empty rect. The caller brackets the frame and owns anything outside area.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context (carries the device profile). area in Content rectangle to fill. props in Host-owned current state.
drawTouchKeyboardField() #
Repaint the value row of what drawTouchKeyboard draws, in place.
Clears touchKeyboardFieldRect to the background and draws the row (the value or its placeholder, the label, the hint, the reveal, back and switch controls and the rule under them) as drawTouchKeyboard does. Plaintext reaches it under the same rule: only TouchKeyboardProps::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface; the caller brackets the frame. layout in Responsive context. area in The rectangle drawTouchKeyboard was drawn into. props in Host-owned current state.
- Returns
- The row repainted (empty when nothing was).
drawTouchKeyboardKey() #
Repaint one key of what drawTouchKeyboard draws, in place.
Clears the key's box to the background and draws the key as drawTouchKeyboard does for props, so the box ends exactly as a whole repaint would leave it. For a change that only touches keys and the value row (the pressed key, the length): the focus box and the variant strip, which draw over the keys, need the whole keyboard repainted instead.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface; the caller brackets the frame. layout in Responsive context. area in The rectangle drawTouchKeyboard was drawn into. props in Host-owned current state. index in Row-major key index on the props' layer; out of range draws nothing.
- Returns
- The box repainted (empty when nothing was).
drawTouchKeyboardValue() #
Draw the masked value alone inside span, for a host's own field.
For a host that keeps the value out of the keyboard's area (TouchKeyboardProps::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface; the caller brackets the frame and clears the span. span in Where the value goes, vertically centered. props in Host-owned current state.
drawTutorialHint() #
Draw the tutorial goal pill centered inside band.
Pending (done == false) renders an outlined primary chip; done renders a filled success chip — the caption text carries the state as well, so the flip never relies on color alone. Pure: no retained state. Draws nothing for an empty band or an empty caption.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (color TFT or Mono1 e-paper). layout in Responsive context (carries the device profile). band in Band rectangle the pill is centered in (screen space). props in Caption + done flag.
dropdownBackRects() #
Geometry of the title band's back chip — the one definition the draw and the hit test share.
The chip sits at the band's left; its hit box runs from the screen edge to one small gap past it, from the top of the screen to the bottom of the band.
- Parameters
-
Name Direction Meaning layout in Responsive context. box in Popover rectangle, the same one passed to drawDropdown. props in The props the popover is drawn with.
- Returns
- The chip and its hit box; both empty unless
DropdownProps::is set and the popover has a title band.showBack
dropdownBodyRect() #
The rect drawDropdown lays its option rows in: the popover minus its title band.
The one definition of where the rows are. Anything that windows, scrolls or hit-tests the rows reads it from here; computing the title band a second way is how a scroll window drifts a row away from the rows drawn, and how a tap lands on the option above the one under the finger.
- Parameters
-
Name Direction Meaning layout in Responsive context. box in Popover rectangle, the same one passed to drawDropdown. title in The same title passed in DropdownProps (null or empty: no band).
- Returns
- The body rect; empty when the title band fills the box.
dropdownKeepsActionBar() #
Whether dropdownPopoverBox stops above the action bar.
True on the boards that read their keys from a bar of captions (two or three face keys, or zones with a reserved shelf): there the popover leaves the bar on screen, and the screen that shows it draws the picker's own bindings in it.
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Return values
-
Value Meaning true The bar stays visible below the popover. false The popover reaches the bottom margin.
dropdownPopoverBox() #
The popover rect of a picker: the screen less a small margin that frames it, ending above the first row the pointer does not own (on a board whose A/B/C zones are a band of the screen) and above the action bar where the picker keeps one.
Passing optionCount shrinks the box to the height its content needs, anchored at the top, so a short picker draws no empty surface. The draw, the scroll windowing and the pointer must all be given the same arguments.
- Parameters
-
Name Direction Meaning layout in Responsive context. optionCount in Options the picker lists; 0 keeps the full height. title in The picker's title, or null when it has no title band.
- Returns
- The box to pass to drawDropdown and resolveDropdownTouch.
dropdownRowHeight() #
Height of a single dropdown option row for a layout.
height = bodyFontHeight + 2 * verticalPadding, matching the compact list row so a dropdown and the settings list read at the same rhythm.
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Returns
- Option row height in pixels.
dropdownScrollTop() #
Clamp / advance the scroll window so the focused option is visible.
Mirrors the menu-list windowing: if the cursor is above the window the top is pulled up; if below, the top is pushed down. Pure; no retained state.
- Parameters
-
Name Direction Meaning focus in Cursor option index. count in Total option count. visible in Visible row count. prevTop in Previous window top.
- Returns
- The clamped / advanced window top.
dropdownVisibleRows() #
Number of option rows that fit in a panel body of bodyH pixels.
- Parameters
-
Name Direction Meaning layout in Responsive context. bodyH in Available body height in pixels (panel minus title).
- Returns
- Visible row count (>= 0).
dtAdvanceOrCommit() #
Advance to the next field, or signal commit when past the last field.
If the active field is before Zone, moves to the next field and returns false (keep editing). If the active field is already Zone, returns true — the caller commits the edited date-time — and leaves active on Zone so a re-entry resumes on the last field.
- Parameters
-
Name Direction Meaning m in, out The model; its activeadvances when not yet atZone.
- Return values
-
Value Meaning true The user advanced past Zone:commit the value.false Still editing: activenow points at the next field.
dtDecrement() #
Decrement the active field by one, wrapping at its lower bound.
Wrap-around per field: year 2024→2099, month 1→12, day 1→(max), hour 0→23, minute 0→59, zone 0→(kZoneCount − 1). Changing the year or month re-clamps the day via clampDay so it never exceeds the new month.
- Parameters
-
Name Direction Meaning m in, out The model; its DateTimeFieldModel:: active field is nudged.
dtIncrement() #
Increment the active field by one, wrapping at its upper bound.
Wrap-around per field: year 2099→2024, month 12→1, day (max)→1, hour 23→0, minute 59→0, zone (kZoneCount − 1)→0. Changing the year or month re-clamps the day via clampDay so it never exceeds the new month.
- Parameters
-
Name Direction Meaning m in, out The model; its DateTimeFieldModel:: active field is nudged.
encode() #
Encode payload into a QR module matrix (byte mode).
Auto-selects the smallest version in [kMinVersion, kMaxVersion] that holds the data at ecc, runs the full pipeline (data + RS ECC + interleave + pattern placement + masking + format/out.
Host-testable and deterministic: no I/O, and the only allocation is the lazily heap-backed worst-case scratch (see RAM cost of the version cap), shared across calls and never freed. Non-reentrant — call it from a single task.
- Parameters
-
Name Direction Meaning payload in NUL-terminated payload; each byte is encoded verbatim (ISO-8859-1 / UTF-8 bytes pass through). nullptr is treated as empty. ecc in Error-correction level. out out Caller-owned matrix; the encoded grid lands top-left. outSize out Side length in modules of the produced matrix. forceMask in Optional fixed mask 0..7 for deterministic known-answer tests; -1 (default) selects the lowest-penalty mask per the spec.
- Return values
-
Value Meaning true Encoded successfully; outSizeis valid.false Payload does not fit at eccwithinkMaxVersion, an invalidforceMask, or the scratch allocation failed.out/outSizeare unspecified.
fitLabel() #
Set a short label (a choice row, a button caption) in a box maxW pixels wide, whole wherever it can be.
The label is measured in the face it is drawn in and takes the first setting that holds it whole: one line in BODY, one line in SMALL, then two lines in SMALL split at the space that leaves the longer line shortest, then, where maxLines allows three, three SMALL lines of whole words. Only a label that not even those hold (or a single word wider than the box in SMALL) is cut, over two lines, each line that runs past the box ending in "…". The setting depends only on the label, the width, the weight and the line budget, so a row measured in the face it takes when focused keeps its size as the focus moves.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. label in NUL-terminated UTF-8 label (nullptr yields no lines). maxW in Width of the box the label is drawn in, in pixels. weight in Face the label is drawn in. maxLines in Lines the box can grow to: kLabelMaxLines, or kLabelGrowLines where the box grows to three.
- Returns
- The font and the lines to draw.
fitName() #
Set a record's name in a box maxW pixels wide, whole wherever the box can hold it.
The name a credential screen titles itself with. It takes the first setting that holds it whole: one line in HEADING, one in BODY, one in SMALL, then, when maxLines allows two, two SMALL lines broken as wrapValue breaks a value (at a space, then at a joint). Only a name that not even those hold is cut, its last line ending in "…".
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. name in NUL-terminated UTF-8 name (nullptr or empty yields no lines). maxW in Width of the box, in pixels. maxLines in Lines the box has room for (1 or 2; 0 is taken as 1). weight in Face the name is drawn in.
- Returns
- The font and the lines to draw.
fitQr() #
Choose the module size a box holds (see QrFit).
modulePx is boxPx / gridModules, floored and clamped to at least 1, so renderedPx exceeds boxPx only in the clamped case (a box too small for even one pixel per module). A caller that must not overflow checks renderedPx <= boxPx.
- Parameters
-
Name Direction Meaning boxPx in Square side available, in pixels. moduleCount in Symbol side in modules; <= 0 yields an empty fit. quietZone in Light margin in modules (negative reads as 0).
- Returns
- The grid, module size and rendered square side.
fitText() #
Copy src into out cut to fit maxW pixels at font.
Text that fits is copied as-is. Text that does not is cut on a whole UTF-8 code point — never inside one, which would leave a broken byte on a panel showing Spanish, French, German or Italian — and, with ellipsis, ends in "…" so a cut label reads as cut. A source longer than out counts as cut. When not even the ellipsis fits, out is empty.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. src in NUL-terminated UTF-8 source (nullptr yields ""). font in Font role the text will be drawn in. maxW in Width to fit, in pixels (<= 0 yields ""). out out Destination buffer, always NUL-terminated. cap in Size of outin bytes, NUL included.ellipsis in End a cut text in "…" (default) or cut it bare. weight in Face the text will be drawn in, measured in it.
formatTotpCodeGrouped() #
Format a TOTP code as the space-grouped mono string.
Pure and native-testable: 6-digit codes group as "NNN NNN", 8-digit as "NNNN NNNN" (any other digit count clamps to 6), zero-padded. When valid is false a dash placeholder of the same shape is written ("--- ---" / "---- ----") so an untrusted clock can never leak a code.
- Parameters
-
Name Direction Meaning code in Code value. digits in 6 or 8. valid in False writes the placeholder instead of the code. out out Destination buffer. cap in Capacity of outin bytes (needs >= 10).
- Returns
- Characters written (excluding the NUL); 0 when
capis too small.
- Warning
- SECURITY: callers must securely zeroize
outafter use.
formatTotpSeconds() #
The one spelling of a TOTP countdown's seconds, on every surface: the number, a space and the SI "s" ("24 s"), and a leading "! " for the last kTotpUrgentSeconds ("! 3 s"), so the urgency reads by shape as well as by color. A bare "!3s" read as "13s".
- Parameters
-
Name Direction Meaning remaining in Seconds left in the current window. out out Destination; always NUL-terminated when cap> 0.cap in Size of outin bytes (8 holds every value).
glassHeaderGauge() #
The record of the gauge on the glass: the one every header draw writes and the main loop's watch reads. UI task only.
- Returns
- The record.
glyphHint() #
A hint for one glyph key and its verb.
- Parameters
-
Name Direction Meaning glyph in The key cap. verb in What the key does. primary in Whether it is the screen's main action.
- Returns
- The hint.
glyphPairHint() #
A hint for a pair of glyph keys (the arrows) and their verb.
- Parameters
-
Name Direction Meaning first in The first key cap. second in The second key cap. verb in What the keys do.
- Returns
- The hint.
headerBackRects() #
Geometry of the header back chip — the one definition the draw and the hit test share.
- Parameters
-
Name Direction Meaning layout in Responsive context. props in The props the header is drawn with.
- Returns
- The chip and its hit box; both empty unless
HeaderProps::.showBack
headerGaugeRect() #
The footprint of the battery gauge a header drew in slot: its body and its terminal.
A header drawn on the glass records the slot (ui/
- Parameters
-
Name Direction Meaning slot in Where the gauge was drawn.
- Returns
- The rectangle a repaint of the gauge alone covers.
headerHeight() [1/3] #
Compute the header bar height for a layout (title-only vs title+subtitle).
Exposed so screens can reserve the matching content offset (the component does not mutate the context's insets). Derived from the resolved heading / small font heights plus vertical padding. On a board that draws its own touch controls (DeviceProfile:: the Core2 v1.3, the CoreS3 SE) every bar is at least the tap-target floor, with or without a back chip, so the header is one height on every screen.
- Parameters
-
Name Direction Meaning layout in Responsive context. subtitle in Whether a subtitle line is present.
- Returns
- Header bar height in pixels.
headerHeight() [2/3] #
Header bar height from the two props that size it, for a caller that lays out before it has the title (or whose title varies).
- Parameters
-
Name Direction Meaning layout in Responsive context. subtitle in Whether a subtitle line is present. showBack in Whether the back chip is drawn ( HeaderProps::).showBack
- Returns
- Header bar height in pixels.
headerHeight() [3/3] #
Header bar height for props: headerHeight(const LayoutContext&, bool) raised to the tap-target floor when HeaderProps:: is set (and always on the Core2 v1.3 and the CoreS3 SE).
- Parameters
-
Name Direction Meaning layout in Responsive context. props in The props the header will be drawn with.
- Returns
- Header bar height in pixels.
headerMarkEdge() #
Edge of the square the header's brand mark fills.
The single-line bar (headerHeight(const LayoutContext&, bool)) over its bottom rule (1 px on color, 2 px of ink on e-paper) less the mark's clearance above and below (headerMarkInset), never smaller than the title and never larger than 31 px, the largest mark raster. An even edge drops to the odd one below, so the pixel-fit mark (kleidosMarkPixels) centers its ring, eye and stem on a pixel: 21 px on the Sticks, 19 px on the M5Cardputer ADV, 27 px on the LILYGO T-Deck, 21 px on the CoreInk and 31 px on the Core2 v1.3 and the CoreS3 SE. The mark centers on the title line, at least the inset under the bar's top edge (a title lifted by a subtitle) and at least 1 px over its bottom rule.
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Returns
- The mark's edge in pixels.
headerMarkInset() #
Clearance between the header's brand mark and the bar's top edge.
1 px when the single-line bar has under 24 rows over its bottom rule (the Sticks and the M5Cardputer ADV), where a 1 px ring and a 3 px eye need every row the bar has; 2 px otherwise.
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Returns
- The clearance in pixels.
headerStatusCy() #
Center line of the header's title row and status cluster for props, where the bar draws its battery gauge.
A screen that drops the bar but keeps the battery (the keyboard boards' lock screen) centers its gauge here, so the gauge stands where every other screen's bar draws it and does not move when the screen changes.
- Parameters
-
Name Direction Meaning layout in Responsive context. props in The props the bar would be drawn with.
- Returns
- The row's center Y in pixels.
headerStatusIconSize() #
Side of the square slot each status token is drawn in, the battery gauge's included.
The slot is the drawn SMALL role height, so the gauge's fill spans a fixed number of pixel columns on each board (batteryGaugeSteps).
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Returns
- The slot side in pixels.
ipv4AdvanceOrCommit() #
Advance to the next octet, or signal commit when past the last one.
If the active octet is before the fourth, moves to the next octet and returns false (keep editing). If the active octet is already the last, returns true — the caller formats and persists the address — and leaves active on the last octet so a re-entry resumes there.
- Parameters
-
Name Direction Meaning m in, out The model; its activeadvances when not yet at the end.
- Return values
-
Value Meaning true The user advanced past the last octet: commit the value. false Still editing: activenow points at the next octet.
ipv4Decrement() #
Decrement the active octet by one, wrapping 0 → 255.
- Parameters
-
Name Direction Meaning m in, out The model; its active octet is nudged. An out-of-range activeis ignored.
ipv4FromText() #
Prefill the model's octets from a literal dotted-quad string.
Strict parse mirroring kleidos::: exactly four decimal octets 0–255 separated by single dots, digits and dots only. On success the octets are stored and active resets to the first octet; on rejection the model is left untouched.
- Parameters
-
Name Direction Meaning text in NUL-terminated candidate string (nullptr is rejected). m in, out Model receiving the parsed octets.
- Return values
-
Value Meaning true textparsed as a literal IPv4; model updated.false Not a plain dotted quad; model unchanged.
ipv4Increment() #
Increment the active octet by one, wrapping 255 → 0.
- Parameters
-
Name Direction Meaning m in, out The model; its active octet is nudged. An out-of-range activeis ignored.
ipv4ToText() #
Format the model as an unpadded dotted quad ("10.0.0.1").
The output always satisfies the strict literal-IPv4 validator (octets are full-range bytes by construction). Nothing is written when cap cannot hold the longest form (kIpv4TextCap).
- Parameters
-
Name Direction Meaning m in Model to format. out out Destination buffer, NUL-terminated on success. cap in Capacity of outin bytes.
- Return values
-
Value Meaning true Formatted; outholds the dotted quad.false outis null orcapis too small; nothing written.
keepHeaderGaugeLive() #
Keep the gauge on the glass live on a tick at rest.
Asks watch what the gauge needs (HeaderGaugeWatch::) and, when it moved and no overlay covers it, repaints it alone in place in a frame of its own (repaintHeaderGauge) and notes what it now shows. The same on every panel: a backlit one blits the gauge's footprint, an e-paper one writes it to its frame buffer and refreshes the band it changed. A gauge under a covering overlay, and any gauge while the frame is being composed in tones (the e-paper gray pass repaints the whole screen, its header drawn live), stays owed for a later tick. No screen is asked for anything.
- Parameters
-
Name Direction Meaning canvas in, out The glass. watch in, out The record of the gauge on it (glassHeaderGauge). live in What the gauge would draw now. screen in The glass's screen count now ( display::).screenClears overlays in The overlays on the glass.
- Returns
truewhen the gauge was repainted.
keyButtonRowRect() #
The row just above the shelf where a keyboard board with a pointer draws its buttons that are also keys, inside the side margins and at least a hit target tall.
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Returns
- The row.
keyHintShelfRect() #
The shelf's band: a strip along the bottom of the screen, one small line tall plus its padding.
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Returns
- The band.
keyholeBox() #
The screen box that holds every pixel of the color keyhole at deciDeg.
The eye's box and the four corners of the stem (kleidosMarkBodyShape), each grown by the half pixel of the coverage ramp, rounded out to whole pixels and widened by kKeyholeFeatherPx.
- Parameters
-
Name Direction Meaning geo in The mark. deciDeg in Keyhole angle, tenths of a degree.
- Returns
- The box.
keyholeRepaintBox() #
The box one keyhole frame repaints: the keyhole before and after.
- Parameters
-
Name Direction Meaning geo in The mark. fromDeciDeg in The angle on the glass. toDeciDeg in The angle the frame paints.
- Returns
- The union of both keyhole boxes.
kleidosMarkBodyBox() #
The color body's box, its outline and antialiased edge included.
- Parameters
-
Name Direction Meaning geo in The mark.
- Returns
- The box (markBodyBounds of kleidosMarkBodyShape).
kleidosMarkBodyShape() #
The body and keyhole of a color mark, at deciDeg, in sub-pixels.
The logo's own lengths scaled by s = ringR / 42 and centered on the center of pixel (cx, cy), the ring's center: a contour of half width 14 s whose straight half length is 14 s (a 28 x 56 stadium), an outline 2.5 s wide centered on it, an eye of radius 5 s whose center is 4 s above the mark's, and a stem 3 s wide that runs 14 s from the eye's center, square at its end. The angle turns the stem clockwise on the screen about the eye's center: 0 points it straight down, 900 to 9 o'clock, a negative angle to the right.
- Parameters
-
Name Direction Meaning geo in The mark. deciDeg in Keyhole angle, tenths of a degree.
- Returns
- The shape (zero lengths when the ring has no radius).
kleidosMarkGeoForEdge() #
The geometry of a still mark drawn in an edge px square.
The ring at the official stroke: mid radius round(42 e / 100) and band round(3 e / 100), at least one pixel (two on a 1-bit panel).
- Parameters
-
Name Direction Meaning cx in Center X. cy in Center Y. edge in The square's edge (px). mono in Whether the panel is 1-bit ink.
- Returns
- The geometry.
kleidosMarkParts() #
The whole-pixel parts of the mark whose ring has mid radius ringR.
What a 1-bit panel draws (a color panel draws the sub-pixel kleidosMarkBodyShape). Scaled from the logo grid by s = ringR / 42 and rounded to whole pixels: body 2 round(14 s) x 2 round(28 s), outline round(2.5 s), eye round(5 s), stem round(3 s) x round(14 s), pivot round(4 s) above the center. A 1-bit panel has no antialiasing to carry a thin stroke, so its outline and eye keep larger floors.
- Parameters
-
Name Direction Meaning ringR in Mid-band radius of the ring (px). mono in Whether the panel is 1-bit ink.
- Returns
- The parts.
kleidosMarkPixels() #
The pixel-fit parts of the Kleidos mark at edge.
- Parameters
-
Name Direction Meaning edge in The mark's square edge in pixels (odd for a centered mark).
- Returns
- The parts; see KleidosMarkPixels.
layout() #
Set parts as a centered column inside box.
Tries the roles the parts ask for, then every part one role smaller (each no smaller than its minFont), and returns the first setting in which no word is wider than the box, every word of every part lands on a row, and the column is no taller than the box. When no setting does, returns the smallest one with fits false, its rows starting at the top of the box.
kleidos::
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. parts in The blocks, top to bottom; at most kMaxBlocks are set. box in The box the column is set in.
- Returns
- Where every row of the column lands.
listRowHeight() #
Compute the row height for a layout (single- or two-line rows).
The Comfortable size sizes the primary line for the HEADING role and adds a larger inter-line gap, yielding a noticeably taller row than Compact; its label is still drawn at the BODY role. All terms come from the layout token scales.
On touch-primary profiles the result is floored to the ui::
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved font heights + spacing). twoLine in True to size for a primary + secondary line. size in Vertical density of the row.
- Returns
- Row height in pixels (tap-floored on touch-primary profiles).
listWindowTop() #
First visible item of a list on this panel.
A 1-bit panel turns whole pages (each e-paper repaint is a refresh, so a list moves once per page, not once per row); other panels scroll a row at a time.
- Parameters
-
Name Direction Meaning layout in Responsive context. selected in Selected item index. count in Total number of items. visible in Rows the window shows. prevTop in The window's first item before this move.
- Returns
- pagedWindowTop on a monochrome panel, scrollWindowTop elsewhere.
liveBatteryLevel() #
The battery level every header shows, read from the board now.
Reads power once and moves the one BatteryGauge of the firmware with it, at the step count the board's header gauge can show (the fill columns of a gauge in the header's status slot, ui::). The gauge lives in RAM, so its first reading after a boot (every wake from the production sleep is one) sets the level directly. The sample holds only good readings (a read the chip refused keeps the last); before the first one the battery is unknown and the level has no steps (BatteryLevel::): the gauge draws its outline with a "?" inside. Called on the UI task only.
- Parameters
-
Name Direction Meaning power in, out Board power manager (battery reading).
- Returns
- The level to draw.
liveHeaderStatus() #
The header status cluster as the board stands now.
- Parameters
-
Name Direction Meaning power in, out Board power manager (battery level and charge state).
- Returns
- The battery level the gauge shows (liveBatteryLevel), charging, and whether a host is connected.
logoSub() #
A length of the logo grid on the screen, in 1/kMarkSubPx px.
Scaled by s = ringR / 42, the ring's own mid radius, so the body keeps the logo's proportions to the ring that is drawn.
- Parameters
-
Name Direction Meaning halfUnits in The length in half logo units (2.5 units is 5). ringR in Mid-band radius of the ring (px).
- Returns
- The length in sub-pixels, rounded half up.
markFillColor() #
The body fill of a tone on a color panel.
- Parameters
-
Name Direction Meaning tone in The tone.
- Returns
- RGB565 color.
markLineColor() #
The ring, outline and keyhole color of a tone on a color panel.
- Parameters
-
Name Direction Meaning tone in The tone.
- Returns
- RGB565 color.
measure() #
Advance width of text in font, in the face weight draws.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. text in NUL-terminated string. font in Font role the text is drawn in. weight in Face the text is drawn in.
- Returns
- Pixel width (advance, not bounding box).
minReadableQrBandPx() #
Smallest band side that renders payloadLen readably.
The side at which the sparsest symbol the payload can take (the weakest error-correction level, which needs the fewest modules) still gets kQrMinModulePx whole pixels per module. A band below this cannot hold a readable symbol at any level, so it is the figure a page quotes when it asks its chrome for room.
- Parameters
-
Name Direction Meaning payloadLen in Payload length in bytes. quietZone in Light margin in modules (kQrQuietZone).
- Return values
-
Value Meaning >0 The band side in pixels. 0 The payload does not fit the encoder's version cap at any level.
moduleCountFor() #
Side length in modules of the symbol dataLen bytes encode to.
17 + 4 * chooseVersion(dataLen, ecc) — the figure a layout needs to size a symbol before encoding it, so a card can be laid out on the grid the encoder will actually produce instead of a guessed version.
- Parameters
-
Name Direction Meaning dataLen in Payload length in bytes. ecc in Error-correction level.
- Return values
-
Value Meaning 21..kMaxModules The symbol's module count. 0 The payload does not fit within kMaxVersion.
overlayCoversGauge() #
Whether an overlay covers the gauge drawn in gauge.
A gauge painted under an overlay would cut it, so the watch waits for it to clear; one painted beside it (a toast at the bottom of the glass) cuts nothing and is painted at once.
- Parameters
-
Name Direction Meaning gauge in The gauge's footprint ( ui::).headerGaugeRect overlays in The overlays on the glass.
- Returns
truewhile one covers the gauge.
pagedWindowTop() #
First visible item of a list that turns whole pages.
Moving past the last visible row starts the next page at the selection; moving above the first ends the previous page at it; a selection inside the window keeps it. A wrap from the last item to the first lands on the first page, and from the first to the last on the last page. A list that fits never moves.
- Parameters
-
Name Direction Meaning selected in Selected item index. count in Total number of items. visible in Rows the window shows. prevTop in The window's first item before this move.
- Returns
- The new first visible item.
peekRowHeight() #
Height of the trailing "peek" sliver drawn under the last full row.
The single gate shared by drawMenuList (which draws the sliver) and the touch hit-tests (which size their tap band with it), so every row the list draws is tappable and the two predicates can never drift. Returns 0 when no peek row is drawn: mono/e-paper panels, a window that already reaches the list end, or a leftover band too short to seat a compact single line (body font + xs spacing). Mid-scroll animation frames suppress the peek inside drawMenuList itself (the slide draws its own trailing row), independent of this gate.
- Parameters
-
Name Direction Meaning layout in Responsive context (carries the device profile). content in Content rectangle the list fills. twoLine in True if rows are two-line. size in Vertical density of the rows. scrollTop in First visible item index. count in Total number of items.
- Returns
- Sliver height in pixels, or 0 when no peek row is drawn.
planIdentityRows() #
Decide how many rows fit room and how far apart they sit. Pure.
Rows are kept from the first while each one, plus the gap before it, still fits. The kept rows then share the height left over, so the block fills its column; the gap never leaves minGap .. maxGap.
- Parameters
-
Name Direction Meaning heights in Height of each row, in order. count in Rows offered (clamped to kIdentityRowMax). room in Pixels the column has. minGap in Smallest gap between two rows. maxGap in Largest gap between two rows.
- Returns
- The rows kept and the gap to draw them with.
planQrCard() #
Solve the largest crisp scan card a band holds for a payload.
Tries the caption below and beside the symbol; for each, tries every error-correction level the payload fits in; and keeps the candidate with the largest module size, breaking ties toward the highest error-correction level and then toward QrCaptionSide::
- Parameters
-
Name Direction Meaning band in Usable band (content box) and the caption gap. caption in What the caption needs (see QrCaptionBox). payloadLen in Payload length in bytes. quietZone in Light margin in modules (kQrQuietZone).
- Returns
- The solved plan; valid == false when no symbol fits the band at all (the caller then draws its "cannot show" state rather than a symbol spilling over its neighbors).
popupCardAccent() #
The tone's accent: the border, and the ink of anything the content marks in the tone (the safety line of a hold).
- Parameters
-
Name Direction Meaning layout in Responsive context. tone in The card's tone.
- Returns
- RGB565 color.
popupCardBackRects() #
The back chip of a card drawn with PopupCardProps::
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (measures the title). layout in Responsive context. card in The card's rect. props in The card's props.
- Returns
- Empty rects when the card shows no back chip.
popupCardFill() #
The fill the card's content sits on for tone (the tone's container where it has one, else the surface); paper on a 1-bit panel.
- Parameters
-
Name Direction Meaning layout in Responsive context. tone in The card's tone.
- Returns
- RGB565 color.
popupCardWidthFor() #
The width a card should take for its title: cardW, or the whole width of the glass where a word of the title does not fit a line of the card at cardW (popupTitleWordsFit).
The title then steps down a rung in the wider card only where it still has to (popupTitleBarHeight), so a word is never split.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (measures the title). layout in Responsive context (the glass's width). cardW in The width the card would take. props in The card's title, font and mark.
- Returns
- Card width in pixels.
popupTitleBarHeight() #
Height of the title bar for props at card width cardW.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (measures the wrapped title). layout in Responsive context. cardW in The card's width. props in The card's title, font and wrap budget.
- Returns
- Bar height in pixels.
popupTitleReadsWhole() #
Whether the title reads whole in the bar at card width cardW: in the card's rung or one the bar steps down to, every word on a line, within the lines the title may take.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (measures the title). layout in Responsive context. cardW in Width of the card. props in The card's title, font, mark and line budget.
- Return values
-
Value Meaning true The bar sets it whole; false where it splits or cuts it.
popupTitleWordsFit() #
Whether every word of the title fits a line of the title bar at card width cardW, in the card's own rung (PopupCardProps::).
A popup never splits a word of its title: where one is wider than the card's line, the narrow card stands from edge to edge of the glass first, and only then does the title take a smaller rung.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface (measures the title). layout in Responsive context. cardW in Width of the card. props in The card's title, font and mark.
- Return values
-
Value Meaning true Every word (a compound by its hyphenated parts) fits a line.
progressBarHeight() #
Compute the natural progress-bar height for a layout.
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved spacing).
- Returns
- Bar height in pixels.
qrScanColors() #
Dark-on-light module colors for the panel class monochrome names.
A scanner expects dark modules on a light quiet zone, and which theme token is physically dark depends on the panel:
- 1-bit e-paper inverts in the Light theme it defaults to, mapping a bright color to ink and a dark one to paper, so the ink token (kText) lands as black modules and the background token (kBg) as white paper.
- Color TFT draws what it is given, and the Kleidos palette is a dark theme, so the same pair would render light modules on a black field — an inverted symbol that not every phone camera decodes. Those panels take the pair the other way round: kBg modules on a kText quiet zone, which is also the near-white card the admin scan page draws.
- Parameters
-
Name Direction Meaning monochrome in True for a 1-bit (e-paper) panel; false for color.
- Returns
- The dark / light pair that renders physically dark-on-light.
repaintActionBar() [1/2] #
Repaint the hint bar for props, touching only what changed since drawn.
A hold gauge moves ~20 times across one 800 ms hold. Repainting the whole bar for each step clears its band and redraws every cell for a 2 px rule; drawn straight to the panel (no shadow framebuffer) that is a visible flicker. With the cells where drawn recorded them: a cell whose verb or mark changed is cleared to the shelf color and redrawn alone; a cell whose hold fill alone moved gets its rule as two fills that do not overlap (the filled part and the rest), with no clear; an unchanged cell is left alone. Anything else — no recorded draw, other cells or places, a 1-bit panel, a verb that runs past its cell — draws the whole bar. Either way the pixels equal a full draw of props, and drawn records them.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context. props in Semantic action slots to present, gauges included. drawn in, out What the bar shows; updated to props.
repaintActionBar() [2/2] #
Repaint the hint bar on the display, in a frame of its own.
Device-only: it owns the raster surface and the active display's layout, so callers never open a frame for a footer-sized update. See the overload that takes a canvas for what it repaints.
- Parameters
-
Name Direction Meaning props in Semantic action slots to present, gauges included. drawn in, out What the bar shows; updated to props.
repaintHeaderGauge() #
Repaint a header's battery gauge alone, in place, showing live.
Fills the gauge's footprint (headerGaugeRect) with what lies under it (the bar's surface, or the background for a gauge drawn with no bar) and draws the gauge over it, the very pixels a repaint of the whole header would change for a moved battery. The caller brackets it in a frame.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. slot in Where the header drew the gauge. live in What the gauge shows now.
resolveDropdownTouch() #
Resolve a gesture against a dropdown drawn in box with props — the one touch grammar every picker shares.
The back chip cancels; the option rows take the list grammar of ui:: (a tap selects, a tap on the selection commits, a swipe pages). Reads the same geometry drawDropdown lays out, so a tap lands on the option drawn under it.
- Parameters
-
Name Direction Meaning ev in The resolved gesture. layout in Responsive context. box in The popover rect the dropdown is drawn in. props in Its props (title, count and back chip are read). focus in, out The focused option; moved on a select or a page. scrollTop in, out The window top; kept following focus.
- Returns
- What the gesture did.
rowBandTop() #
Y of a (possibly fractional) local row within a scrolled content rect.
The row-placement math shared by the static and animated list paths: the top Y of local row localRowFrac is content.y + localRowFrac * rowHeight +
scrollOffsetPx. Exposed (pure) so the sliding-highlight geometry is host-testable without a canvas.
- Parameters
-
Name Direction Meaning contentY in Top of the content rect (px). localRowFrac in Fractional local row index (0 = first visible row). rowHeight in Row height (px). scrollOffsetPx in Sub-row vertical shift applied to all rows (px).
- Returns
- Top Y of the row band (px).
scrollWindowTop() #
Sticky scroll-window top that keeps the selection on screen.
Pure list-scroll math shared by the catalog: given the previous window top, the selected index, the item count, and how many rows are visible, it returns the new top. The window does not re-center on the selection — it only moves the minimum needed so the selected row stays inside [top, top + visible): scroll up when the selection went above the window, scroll down when it went below, otherwise leave the window put. The result is clamped to [0, count - visible]. This is what makes the highlight track the selection within the window instead of pinning it to a fixed row.
- Parameters
-
Name Direction Meaning selected in Currently selected item index. count in Total number of items. visible in Number of fully-visible rows in the window. prevTop in The window top from the previous frame.
- Returns
- The new window top (first visible item index).
setTouchKeyboardLettersPreference() #
Set the letter rows the device's keyboards show (the BLE layout setting).
The one device-wide input preference, like the UI language: set at boot and whenever the layout setting changes; hosts read it when they open a keyboard.
- Parameters
-
Name Direction Meaning letters in The rows to show.
stemSegment() #
The 1-bit stem at deciDeg: from the pivot to its round-capped tip.
The angle turns clockwise on the screen: 0 points the stem straight down, 900 to 9 o'clock, a negative angle to the right of the pivot. The round cap ends where the logo's square-ended stem does, so the segment is the stem's length less half its width.
- Parameters
-
Name Direction Meaning geo in The mark. parts in Its parts. deciDeg in Keyhole angle, tenths of a degree.
- Returns
- The segment.
stepperChipRects() #
The − and + chip rects for a stepper drawn in box.
The one definition of where the chips are, read by drawStepper and by anything that hit-tests them, so a finger on a drawn chip is a finger on that chip. Both rects are empty when the box is too small to draw them.
- Parameters
-
Name Direction Meaning layout in Responsive context. box in Stepper rectangle, the same one passed to drawStepper.
- Returns
- The two chip rects.
stepperClamp() #
Clamp value to the inclusive [min, max] range.
A defensive helper so a screen that loads a persisted value out of range (e.g. after a range change between firmware revisions) lands back in bounds. If min > max the value is returned unchanged.
- Parameters
-
Name Direction Meaning value in Candidate value. min in Inclusive lower bound. max in Inclusive upper bound.
- Returns
- The clamped value.
stepperHeight() #
Compute the natural (preferred) stepper height for a layout.
height = bodyFontHeight + 2 * verticalPadding — same as a button row so a stepper drops into a list / edit overlay at a consistent height. A caller may use a taller rect; the component centers its content either way.
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved body-font height + spacing).
- Returns
- Preferred stepper height in pixels.
stepperNext() #
Next value after an increment by step, clamped at max.
Saturating: never wraps. step is treated as a magnitude (its sign is ignored). Returns max when already at or above the ceiling.
- Parameters
-
Name Direction Meaning value in Current value. step in Increment magnitude (>= 1 advised). min in Inclusive lower bound (for the initial clamp). max in Inclusive upper bound.
- Returns
- The incremented, clamped value.
stepperPrev() #
Next value after a decrement by step, clamped at min.
Saturating: never wraps. step is treated as a magnitude (its sign is ignored). Returns min when already at or below the floor.
- Parameters
-
Name Direction Meaning value in Current value. step in Decrement magnitude (>= 1 advised). min in Inclusive lower bound. max in Inclusive upper bound (for the initial clamp).
- Returns
- The decremented, clamped value.
tabBarHeight() #
Compute the natural tab-strip height for a layout.
height = bodyFontHeight + 2 * verticalPadding + underline, floored to the ui::
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved body-font height + spacing).
- Returns
- Tab-strip height in pixels (tap-floored on touch-primary profiles).
tailThatFits() #
Offset of the longest tail of text that fits maxW pixels at font.
The head-dropping twin of fitText. An entry row (a text field, a passphrase being dialed, the touch keyboard's revealed row) keeps the end the user just typed in view and drops whole code points from the front until the rest fits. It works in place — the caller draws text + offset — so a secret is never copied, and the offset always lands on the lead byte of a code point, so a multi-byte glyph (an accented letter, the U+2022 mask bullet) is never cut in half.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. text in UTF-8 text, NUL-terminated at text[len] (nullptr yields 0). len in Length of textin bytes.font in Font role the text will be drawn in. maxW in Width to fit, in pixels.
- Returns
- Byte offset of the first code point of the tail that fits: 0 when the whole text fits,
lenwhen not even the last code point does.
textFieldHeight() #
Compute the natural text-field height for a layout.
height = bodyFontHeight + 2 * verticalPadding. Exposed so a screen can lay out a stack of fields. The caller may pass a taller rect.
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved body-font height + spacing).
- Returns
- Text-field height in pixels.
totpCompactCardHeight() #
Natural Compact-style card height for a layout.
The code line plus the bar-and-seconds line under it: the one-block form a surface uses when the 2FA code shares the screen with other fields, where the hero ring and code would crowd them.
- Parameters
-
Name Direction Meaning layout in Responsive context. large in The code at the hero size (see TotpCodeCardProps:: large).
- Returns
- Card height in pixels.
totpCountdownColor() #
The one color rule for every TOTP countdown (list rings, the hero ring, the code screen's bar): brand cyan, warning red for the last kTotpUrgentSeconds.
- Parameters
-
Name Direction Meaning remaining in Seconds left in the current window.
- Returns
- RGB565 color of the countdown on a color panel.
totpHeroCardHeight() #
Natural Hero-style stack height for a layout.
Shared with callers that center the stack plus their own field label, so the label + card group centers as one block.
- Parameters
-
Name Direction Meaning layout in Responsive context. withRing in Include the countdown-ring band. withExpiry in Include the expiry-caption line.
- Returns
- Stack height in pixels.
totpRowCardHeight() #
Natural Row-style card height for a layout.
Issuer line (SMALL) over the row-scale mono code line plus the vertical rhythm padding — all terms from the layout token scales (a 44 px row on the Sticks).
This is what the row WANTS, with no reference to the band it has to tile. A list draws its rows at totpRowCardHeightIn instead; this entry point is for the code that has no band to fit (a cache sizing a scratch, a tick region measured against the row it was given).
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved font heights + spacing).
- Returns
- Row card height in pixels.
- See also
- totpRowCardHeightIn
totpRowCardHeightIn() #
Row-style card height for a list band of bandH pixels.
A row of fixed height tiling a fixed band always floors, and the remainder is lost. That is harmless while the remainder is a sliver and a bug when it is most of a row: on the M5Cardputer ADV's 87 px 2FA band the natural 46 px row tiles ONCE and leaves 41 blank pixels, so a vault with two 2FA entries reports two and draws one.
The code line is therefore a two-rung ladder, and the band picks the rung: the list code (the MONO role magnified, which every board draws), and one rung down, the compact code of the Sticks' row. The smaller row is taken ONLY when it lets the band hold one more row than the natural one does — so a band that already tiles well keeps the larger code, and the only boards that change are the ones whose band was a rung short.
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved font heights + spacing). bandH in Height of the list band in pixels; 0 or less reads as "no band", giving totpRowCardHeight.
- Returns
- Row card height in pixels, never above totpRowCardHeight.
- See also
- totpRowCardHeight
totpRowRingBounds() #
The square a Row-style card's countdown ring occupies inside area.
The part of a list row that changes every second (the code changes once a window): a 1 Hz refresh repaints the row clipped to this square. It holds the ring with its anti-aliased edge and a pixel of margin.
- Parameters
-
Name Direction Meaning layout in Responsive context (spacing tokens). area in The row the card is drawn in.
- Returns
- The ring's bounding square.
touchKeyboardCancelRect() #
The back control's rectangle at the left end of the value row.
- Parameters
-
Name Direction Meaning layout in Responsive context. area in Content rectangle the keyboard fills.
- Returns
- The control rect; empty when
areais empty or too narrow.
touchKeyboardCodepointAt() #
The character a TouchKeyboardKeyKind::
- Parameters
-
Name Direction Meaning sheet in The keyboard as drawn. index in Row-major key index [0, touchKeyboardKeyCount(sheet)).
- Returns
- The character's Unicode code point (Latin-1), or 0 for a non-character cell.
touchKeyboardEncodeUtf8() #
Encode one code point as UTF-8.
- Parameters
-
Name Direction Meaning codepoint in The character (U+0001..U+FFFF). out out At least 4 bytes; receives the bytes and a NUL.
- Returns
- The byte count (1..3), or 0 for code point 0.
touchKeyboardFieldRect() #
The value-row rectangle at the top of area.
- Parameters
-
Name Direction Meaning layout in Responsive context. area in Content rectangle the keyboard fills.
- Returns
- The value-row rect; empty when
areais empty.
touchKeyboardFocusCount() #
Number of focus stops: every key, then the reveal, back and switch controls when shown.
- Parameters
-
Name Direction Meaning sheet in The keyboard as drawn. showReveal in Whether the reveal control participates. showCancel in Whether the back control participates. showSwitch in Whether the PIN / passphrase switch participates.
- Returns
- The focus-ring size.
touchKeyboardFocusTarget() #
What a focus stop activates.
Stops [0, keys) are the keys; the stops after them are the reveal control (when shown), the back control (when shown) and the PIN / passphrase switch (when shown).
- Parameters
-
Name Direction Meaning sheet in The keyboard as drawn. showReveal in Whether the reveal control participates. showCancel in Whether the back control participates. stop in Focus stop index. showSwitch in Whether the PIN / passphrase switch participates.
- Returns
- The key index, kTouchKeyboardRevealKey, kTouchKeyboardCancelKey, kTouchKeyboardSwitchKey, or kTouchKeyboardNoKey for a stop past the ring.
touchKeyboardHitTest() #
Resolve a touch point to the key (or value-row control) under it.
Rows are resolved by pitch and then the key within the row by pitch, so a contact in a gutter still activates the cell it belongs to (full-pitch effective targets). The value-row controls are tested first, so a contact on one can never fall through to a key.
- Parameters
-
Name Direction Meaning layout in Responsive context. area in Content rectangle the keyboard fills (same value passed to draw). sheet in The keyboard as drawn. showReveal in Whether the reveal control is present. x in Touch point X in screen space. y in Touch point Y in screen space. showCancel in Whether the back control is present. showSwitch in Whether the PIN / passphrase switch is present.
- Returns
- The row-major key index, kTouchKeyboardRevealKey, kTouchKeyboardCancelKey, kTouchKeyboardSwitchKey, or kTouchKeyboardNoKey.
touchKeyboardKeyCount() #
Number of keys on sheet.
- Parameters
-
Name Direction Meaning sheet in The keyboard as drawn.
- Returns
- 12 on ui::
TouchKeyboardLayer:: Numeric, 31 on the symbols, and the letter rows' keys plus the six utility keys on a letter layer.
touchKeyboardKeyRect() #
Screen-space rectangle of one key.
- Parameters
-
Name Direction Meaning layout in Responsive context. area in Content rectangle the keyboard fills. sheet in The keyboard as drawn (rows differ per layer and letters). index in Row-major key index [0, touchKeyboardKeyCount(sheet)).
- Returns
- The key rect; empty for an out-of-range index or an empty
area.
touchKeyboardKindAt() #
Kind of the key at row-major index index in sheet.
- Parameters
-
Name Direction Meaning sheet in The keyboard as drawn. index in Row-major key index [0, touchKeyboardKeyCount(sheet)).
- Returns
- The cell's kind; TouchKeyboardKeyKind::
Char for out-of-range.
touchKeyboardLettersForLayout() #
The letter rows that match a BLE keyboard layout.
- Parameters
-
Name Direction Meaning layoutIndex in The layout setting's index: US, ES, UK, FR, DE, PT, IT.
- Returns
- The rows a keyboard of that layout shows; QWERTY for an unknown index.
touchKeyboardLettersPreference() #
The letter rows the device's keyboards show.
- Returns
- The rows last set by setTouchKeyboardLettersPreference; QWERTY before.
touchKeyboardRevealRect() #
The reveal control's rectangle at the right end of the value row.
- Parameters
-
Name Direction Meaning layout in Responsive context. area in Content rectangle the keyboard fills.
- Returns
- The control rect; empty when
areais empty or too narrow.
touchKeyboardRowLen() #
Number of keys in row of sheet.
- Parameters
-
Name Direction Meaning sheet in The keyboard as drawn. row in Zero-based keyboard row [0, kTouchKeyboardRows).
- Returns
- Key count in that row; 0 for an out-of-range row.
touchKeyboardRowStart() #
Row-major index of the first key in row of sheet.
- Parameters
-
Name Direction Meaning sheet in The keyboard as drawn. row in Zero-based keyboard row [0, kTouchKeyboardRows).
- Returns
- The first key index of that row; the layer's key count when
rowis out of range.
touchKeyboardShifted() #
The layer a TouchKeyboardKeyKind::
- Parameters
-
Name Direction Meaning layer in Current layer.
- Returns
- Upper from Lower, Lower from Upper, unchanged otherwise.
touchKeyboardSwitchRect() #
The PIN / passphrase switch's rectangle, just left of the reveal control.
- Parameters
-
Name Direction Meaning layout in Responsive context. area in Content rectangle the keyboard fills.
- Returns
- The control rect; empty when
areais empty or too narrow.
touchKeyboardToggled() #
The layer a TouchKeyboardKeyKind::
- Parameters
-
Name Direction Meaning layer in Current layer.
- Returns
- Symbols from a letter layer, Lower from Symbols, unchanged from Numeric (the PIN keypad has no layer-toggle key).
touchKeyboardUtf8LastLength() #
Bytes the last character of a UTF-8 string takes.
- Parameters
-
Name Direction Meaning text in The string. bytes in Its length in bytes.
- Returns
- The last character's byte count (1..3); 0 for an empty string.
touchKeyboardUtf8Length() #
Characters in a UTF-8 string: every byte that does not continue a sequence.
- Parameters
-
Name Direction Meaning text in The string (need not be NUL-terminated). bytes in Bytes to count over.
- Returns
- The character count.
touchKeyboardVariantAt() #
The variant cell a finger over the strip points at.
Lenient as a held finger is: anywhere from a cell's height above the strip to a key's height below the held key, the nearest cell by X; beyond half a cell past either end, nothing.
- Parameters
-
Name Direction Meaning layout in Responsive context. area in Content rectangle the keyboard fills. sheet in The keyboard as drawn. key in The held key. count in Variants on the strip. x in Finger X. y in Finger Y.
- Returns
- The cell index, or -1 when the finger has left the strip.
touchKeyboardVariantCellRect() #
One cell of a key's variant strip.
- Parameters
-
Name Direction Meaning layout in Responsive context. area in Content rectangle the keyboard fills. sheet in The keyboard as drawn. key in The held key. count in Variants on the strip. cell in Zero-based cell.
- Returns
- The cell rect; empty for a cell past
count.
touchKeyboardVariantRect() #
The card of a key's variant strip.
Cells of the key's size in a row over the key, the first over the key itself, running right (left where the panel ends), inside area.
- Parameters
-
Name Direction Meaning layout in Responsive context. area in Content rectangle the keyboard fills. sheet in The keyboard as drawn. key in The held key. count in Variants on the strip (TouchKeyboardVariants:: count).
- Returns
- The strip's card; empty for no variants or an invalid key.
touchKeyboardVariantsOf() #
The variants a held key offers.
The accented and other Latin-1 forms of a letter, in the case of base (a → á à ä â ã å æ, N → Ñ), and ¿ / ¡ for ? / !. Forms the atlas cannot draw (outside Latin-1) are never offered.
- Parameters
-
Name Direction Meaning base in The key's character (touchKeyboardCodepointAt).
- Returns
- The variants; a count of 0 when the key has none.
touchWindowTop() #
The window top of a list whose window a finger may have moved.
While followSelection is set this is scrollWindowTop. Once a touch scroll moved the window on its own the selection may be off screen, as on a phone: the window then stays where the finger left it, clamped to the list, until a button or key moves the selection and the host sets the flag again.
- Parameters
-
Name Direction Meaning selected in Currently selected item index. count in Total number of items. visible in Number of fully-visible rows in the window. prevTop in The window top from the previous frame. followSelection in True to keep the selection on screen.
- Returns
- The new window top (first visible item index).
tutorialHintHeight() #
Natural band height for the tutorial hint pill.
Matches chipHeight so a screen can reserve the band above its action bar and offset the tutorial content above it.
- Parameters
-
Name Direction Meaning layout in Responsive context (resolved small-font height + spacing).
- Returns
- Hint band height in pixels.
updateDropdownTouch() #
resolveDropdownTouch for a host that scrolls its options by touch.
Feeds the frame to scroll's scroller first: a vertical drag moves the options under the finger (and is never a tap), a release flings and settles, and scrollTop follows. A tap then takes the same grammar as resolveDropdownTouch, a tap on the peek sliver gliding a windowful on. Call it every frame, with or without a gesture, so a fling keeps moving.
- Parameters
-
Name Direction Meaning gestures in The host's recognizer, after this frame's sample. ev in What the recognizer resolved on this sample. nowMs in Monotonic time of the sample. layout in Responsive context. box in The popover rect the dropdown is drawn in. props in Its props (title, count and back chip are read). scroll in, out The host's scroll state. focus in, out The focused option; moved on a select. scrollTop in, out The window top.
- Returns
- What the frame did (
Movedalso when only the options moved).
usableLabelWidth() #
Usable width for a row's primary label, after chrome.
The exact budget drawListRow leaves for the label: the row width (content minus the scroll rail when the list overflows) less the two horizontal row pads, the trailing accessory reserve, and the leading icon slot when present. Exposed so a caller can pre-select a responsive label variant (the longest that fits) instead of relying on the row's truncation fallback — byte-identical to the width the row itself will measure against.
- Parameters
-
Name Direction Meaning layout in Responsive context (token scales + device profile). content in The list content rectangle the rows fill. listOverflows in True when the list is longer than its window (a scroll rail is reserved on color panels, narrowing the row). trailing in The row's trailing accessory kind. hasLeadingIcon in True when the row draws a leading icon/brand slot.
- Returns
- Usable label width in pixels (>= 0).
valueRows() #
How many rows wrapValue fills for text with a budget of maxRows, without writing them.
A screen that grows to hold a value asks this first, sizes the value's band from the answer, and draws the rows once the whole layout is known.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. text in NUL-terminated UTF-8 value (nullptr or empty yields 0). font in Font role the rows will be drawn in. maxW in Row width in pixels (<= 0 yields 0). maxRows in Row budget. weight in Face the rows will be drawn in.
- Returns
- Rows filled, 0..
maxRows;maxRowsalso when the value is cut.
visibleRowCount() #
Compute how many rows fully fit a content height (the scroll window).
Divides by listRowHeight, so the count already accounts for the touch-primary tap-target floor (fewer, taller rows on touch boards).
- Parameters
-
Name Direction Meaning layout in Responsive context. contentHeight in Height of the area the list draws into. twoLine in True if rows are two-line. size in Vertical density of the rows.
- Returns
- Number of fully-visible rows (>= 0).
widestUnbreakable() #
Width of the widest part of text that wrapWhole cannot break.
A word, or the part of a hyphenated compound up to and with its hyphen: the narrowest row wrapWhole can set text in whole.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. text in NUL-terminated text (nullptr or empty measures 0). font in Logical font role it would be drawn in.
- Returns
- Width in pixels.
wifi() #
Build a standard WiFi join payload, escaping the special characters.
Produces WIFI:T:<auth>;S:<ssid>;P:<password>;;, backslash-escaping any of \ ; , : " in ssid / password. For ui::
- Parameters
-
Name Direction Meaning out out Destination payload buffer (overwritten). ssid in Network SSID (treated as empty if nullptr). password in Network password (ignored for ui:: qr:: WifiAuth:: Nopass; treated as empty if nullptr). auth in Authentication type (default ui:: qr:: WifiAuth:: Wpa).
wordHint() #
A hint whose key is named in a word.
- Parameters
-
Name Direction Meaning key in The key's name, drawn bold. verb in What the key does. primary in Whether it is the screen's main action.
- Returns
- The hint.
wrap() #
Greedily word-wrap text into rows of at most innerW pixels.
Measures candidate lines through canvas at font and packs whole words greedily; a single word wider than innerW is split by measured width and continues on the next row rather than being dropped. Stops at lines.size() rows; remaining text is not emitted (the caller clips vertical overflow). Each row is NUL-terminated.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text (no draws emitted). text in NUL-terminated source text (nullptr yields 0 rows). font in Logical font role the rows will be drawn in. innerW in Target row width in pixels (<= 0 yields 0 rows). lines out Caller-owned row span; its size bounds the rows filled.
- Returns
- Number of rows written (0..lines.size()).
wrapFitted() #
Word-wrap text into at most lines.size() rows, cutting the last row with "…" where the words run past it.
The rows are those of wrap. When the text needs more rows than lines holds, the last row takes the rest of the text cut by fitText, so a block that cannot grow any further still shows that it goes on instead of dropping its last words silently. The cut never splits a UTF-8 sequence.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text (no draws emitted). text in NUL-terminated source text (nullptr yields 0 rows). font in Logical font role the rows will be drawn in. innerW in Target row width in pixels (<= 0 yields 0 rows). lines out Caller-owned row span; its size is the row budget.
- Returns
- Number of rows written (0..lines.size()).
wrapValue() #
Break a value into rows of at most maxW pixels, so it reads whole.
For what a credential screen shows of a record: a username, an e-mail address, a host, a line naming what else the record stores. Such a value often has no space to wrap on, and a row that runs out of room must not cut it with "…": the owner reads it to know which account this is. A row ends where the value has a seam, the furthest one that fits:
- after the last space in the row's back half (the space itself is dropped);
- else after the last joint in its back half (a period, hyphen, underscore, slash, backslash, colon, semicolon, comma, plus, equals sign, vertical bar, ampersand, tilde or at sign), so "example." / "com" never reads as two words the value does not have;
- else after the last space anywhere in it;
- else on the last whole code point that fits, never inside one.
An e-mail address breaks after its last "@" first when that costs no extra row, so each row names something: "dev@" / "example.com", not "dev@example." / "com".
Only a value that needs more rows than lines holds is cut: its last row takes the rest and ends in "…" (fitText). That is the last resort, for a value longer than every row together.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text (no draws emitted). text in NUL-terminated UTF-8 value (nullptr or empty yields 0 rows). font in Font role the rows will be drawn in. maxW in Row width in pixels (<= 0 yields 0 rows). lines out Caller-owned rows; its size is the row budget. weight in Face the rows will be drawn in, measured in it.
- Returns
- Number of rows written (0..lines.size()).
wrapWhole() #
Word-wrap text as wrap does, and say whether it reads whole.
For text that must not be cut and can instead be set smaller: a warning, a notice, a popup's title. The rows are those of wrap, except that a word wider than innerW that is a hyphenated compound ("Datenschutz-Schlüssel") breaks after its hyphen, its parts read whole on two rows. Any other word wider than innerW is split across rows, and the rows stop at lines.size(); whole is false in either case, so the caller can try another font instead of drawing it.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text (no draws emitted). text in NUL-terminated source text (nullptr or empty is whole, in 0 rows). font in Logical font role the rows will be drawn in. innerW in Target row width in pixels. lines out Caller-owned row span; its size bounds the rows filled.
- Returns
- The rows written and whether every word landed whole on one.
Variable Documentation
kBatteryHysteresisPct #
Points a step's window reaches past the readings that are its own, on each side, so two neighboring windows share twice as many. Six shared points hold the widest read noise measured at rest: 44 mV on the CoreInk's ADC (about five points at 9 mV a point), 8 mV on the M5StickC Plus2's (one point), and a fuel-gauge percent that did not move on the CoreS3 SE.
kBatteryLowClearPct #
Reading above which a red gauge stops being red, in percent: the red mark's window reaches the same overlap above kBatteryLowPct.
kBoldFitNum #
Share of a wrap budget a bold block may claim, as num/den (7/8 = 12.5% held back). The wrap helpers (wrap, wrapFitted) measure the regular face, and a baked bold rung runs wider per glyph than the regular face that was measured (the synthetic fallback adds a smear column), so a block drawn bold is wrapped against the reduced budget; the headroom exceeds the widening of every bold rung the font ladder bakes. A single line measures the bold face itself instead (fitText and fitLabel with Weight::Bold).
kCharWheelMaxLen #
Default maximum label length the wheel will build (under the 23-byte backend buffer, keeps the label one line on a 135 px row). Used by the short-label editors (bond rename / device name). A per-context CharWheelProps::
kCharWheelStoreCap #
Storage capacity for the wheel label (chars, sans NUL). Sized to hold the longest per-context value the editor accepts — an 802.11 WPA passphrase (63 chars). The label renderer holds this many mask bullets (three UTF-8 bytes each), so a masked value is never cut short before it is windowed to its tail.
kHoldRimStepPct #
Progress step, in percent, at which the rim advances.
The rim advances in the same increments as the footer's hold gauge rather than per perimeter pixel: a ~330 px perimeter filled over the hold threshold would otherwise advance on nearly every loop iteration, and each advance is a frame — a blit over SPI plus a seqlock cycle that spoils any concurrent read-back.
kIdentityMaskGlyphs #
Mask glyphs the password row draws, whatever the password's length: the row must not publish how long the secret is.
kIdentityValueRowsMax #
Most lines one value of the block (the username, the site, the line) takes before its last line is cut.
kKeyholeFeatherPx #
Pixels a keyhole repaint box reaches past every pixel the keyhole can touch: a margin for the rounding of the stem's direction.
kKleidosMarkAtEdgeMinOutlined #
The edge from which a still mark is drawn outlined (variant A); below it the header's pixel-fit solid body (variant B) is drawn.
kKleidosMarkSolidBodyMaxEdge #
The largest edge drawn as KleidosMarkStyle::
kLabelGrowLines #
Lines a label set by fitLabel may take where its box grows to hold them (a popup's button: "Borrar" / "llavero" / "(mantén)").
kLabelMaxLines #
kNoActiveMarker #
Sentinel for PinDialProps::
kNoPriorSweep #
Sentinel for drawPinDialSlice meaning "no previously-painted fill" (the caller must do a full drawPinDial instead).
kPinDialClearPad #
How far clearPinDial reaches past PinDialProps::
kPopupTitleMaxLines #
Lines a card's title may take at most, whatever the caller asks; past them the last line ends in "…".
kQrMinModulePx #
Fewest whole pixels per module a camera can be expected to resolve.
At one pixel per module the modules are the panel's own pixel pitch, and no phone resolves them at any distance it can focus at — the symbol renders, and nothing reads it. Two is the floor a band has to clear for the page to be doing its job, and minReadableQrBandPx is that floor expressed as the band a payload needs.
kQrQuietZone #
Width of the light margin drawn around the symbol, in modules.
ISO/IEC 18004 §9.1 requires a four-module light border on all four sides of a QR Code symbol, and nothing wider buys anything: the margin is the quiet zone the spec requires and no more. The margin is drawn in the light color, so a caller whose card is that same light shade gets the card and the quiet zone from one fill.
kTabUnderlineAuto #
Sentinel for TabBarProps::
kToastMaxLines #
Lines a toast's title or detail may take; more than any string in the table needs on the narrowest frame. Past them the last line ends in "…".
kTouchKeyVariantHoldMs #
How long a key or the B zone is held before its variant strip opens (ms); the touch recognizer's long-press threshold, so finger and button agree.
kVaultTabIcons #
Icons of the vault pager's labeled tabs, in tab order: the credential card, the 2FA timer and the actions menu.
kWifiPayloadCap #
Capacity (chars) of the WiFi payload buffer wifi fills. A WIFI: string for a 32-char SSID + 63-char passphrase, fully escaped, fits comfortably.