ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_widget_keyboard.h File Reference

On-screen-keyboard leaf widget for the ra8_widget tree (#145 Phase 2). More...

#include <stdint.h>
#include "ra8_err.h"
#include "ra8_ui.h"
#include "ra8_widget.h"
Include dependency graph for ra8_widget_keyboard.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ra8_widget_key_info
struct  ra8_widget_keyboard_ops
struct  ra8_widget_keyboard

Typedefs

typedef struct ra8_widget_key_info ra8_widget_key_info_t
typedef struct ra8_widget_keyboard_ops ra8_widget_keyboard_ops_t
typedef struct ra8_widget_keyboard ra8_widget_keyboard_t

Enumerations

enum  ra8_widget_key_sentinel_t : uint8_t { k_ra8_widget_key_no_hit = 255U }
 Sentinel returned by ra8_widget_keyboard_ops_t::hit for "no key". More...

Functions

const ra8_widget_vtable_tra8_widget_keyboard_vtable (void)
 Return the shared vtable backing every on-screen-keyboard widget.
ra8_err_t ra8_widget_keyboard_init (ra8_widget_t *w, ra8_widget_keyboard_t *kbd)
 Bind a widget instance to an on-screen keyboard.

Detailed Description

On-screen-keyboard leaf widget for the ra8_widget tree (#145 Phase 2).

The e-reader search field opens the on-screen keyboard modelled by ra8_keyboard (a pure key grid + hit-test + text buffer). ra8_widget_keyboard_t wraps that as a reusable ra8_widget leaf: it draws each key (a bordered face plus its current-case glyph or a special-key label) through the injected ra8_widget_paint_t backend, and routes a tap to a key, applies it, and fires an on_commit callback when the query is committed (RETURN).

The ra8_keyboard engine is reached through an injected ra8_widget_keyboard_ops_t seam (count / key_info / hit / apply), so this widget – and the whole ra8_widget library – never links ra8_keyboard directly. The app binds the seam to ra8_kbd_hit / ra8_kbd_apply / ra8_kbd_key_glyph, keeping the key-drawing + routing logic host-testable with a recording mock seam while the layout logic stays in ra8_keyboard.

[Ring 5 / UI] {World: NS}

Since
0.1.0

Definition in file ra8_widget_keyboard.h.

Typedef Documentation

◆ ra8_widget_key_info_t

typedef struct ra8_widget_key_info ra8_widget_key_info_t

◆ ra8_widget_keyboard_ops_t

typedef struct ra8_widget_keyboard_ops ra8_widget_keyboard_ops_t

◆ ra8_widget_keyboard_t

typedef struct ra8_widget_keyboard ra8_widget_keyboard_t

Enumeration Type Documentation

◆ ra8_widget_key_sentinel_t

enum ra8_widget_key_sentinel_t : uint8_t

Sentinel returned by ra8_widget_keyboard_ops_t::hit for "no key".

Enumerator
k_ra8_widget_key_no_hit 

The tap hit no key (a gap / off-grid).

Definition at line 46 of file ra8_widget_keyboard.h.

Function Documentation

◆ ra8_widget_keyboard_init()

ra8_err_t ra8_widget_keyboard_init ( ra8_widget_t * w,
ra8_widget_keyboard_t * kbd )
nodiscard

Bind a widget instance to an on-screen keyboard.

Wires w to render + route kbd: sets its vtable to ra8_widget_keyboard_vtable, points its ctx at kbd, and makes it visible. The caller still sets w's fixed / flex for its parent's layout.

Parameters
[in,out]wWidget to turn into a keyboard (non-NULL).
[in]kbdKeyboard descriptor (non-NULL; outlives w's use).
Returns
ra8_err_t
Return values
k_ra8_okBound; w renders + routes kbd.
k_ra8_err_null_ptrw or kbd is NULL.
Precondition
w and kbd are non-NULL.
kbd outlives every render / dispatch of w.
Postcondition
On success w->vt == ra8_widget_keyboard_vtable(), w->ctx == kbd, w->visible == true.
On failure w is left unchanged.
Note
Not thread-safe.
See also
ra8_widget_keyboard_vtable
Since
0.1.0

Definition at line 176 of file ra8_widget_keyboard.c.

References k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_widget_keyboard_vtable(), and s_tag.

◆ ra8_widget_keyboard_vtable()

const ra8_widget_vtable_t * ra8_widget_keyboard_vtable ( void )

Return the shared vtable backing every on-screen-keyboard widget.

One immutable vtable serves all keyboards: render fills the background and draws every key through the keyboard's ra8_widget_paint_t + seam; on_input maps a touch to a key, applies it, and fires on_commit on the commit edge; measure is NULL. ra8_widget_keyboard_init binds it.

Returns
Non-NULL pointer to the static keyboard vtable.
Precondition
None.
None.
Postcondition
The returned pointer is non-NULL and references static storage.
No state is modified.
Note
Pure; thread-safe (returns a pointer to immutable static data).
See also
ra8_widget_keyboard_init
Since
0.1.0

Definition at line 171 of file ra8_widget_keyboard.c.

References s_kbd_vt.

Referenced by ra8_widget_keyboard_init().