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

Reflowed-reading-body 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_reflow_view.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_reflow_ops
struct  ra8_widget_reflow_view

Typedefs

typedef struct ra8_widget_reflow_ops ra8_widget_reflow_ops_t
typedef struct ra8_widget_reflow_view ra8_widget_reflow_view_t

Functions

const ra8_widget_vtable_tra8_widget_reflow_view_vtable (void)
 Return the shared vtable backing every reflow-view widget.
ra8_err_t ra8_widget_reflow_view_init (ra8_widget_t *w, ra8_widget_reflow_view_t *view)
 Bind a widget instance to a reflow view.

Detailed Description

Reflowed-reading-body leaf widget for the ra8_widget tree (#145 Phase 2).

The e-reader Reading screen's body is a paginated block of reflowed text drawn by ra8_reflow, with page turns on a left / right tap and <a href> links that jump pages. ra8_widget_reflow_view_t wraps that as a reusable ra8_widget leaf that owns the view state (current page, page count, body margins) and the tap routing (link-follow, then page-turn with boundary clamping), while the ra8_reflow engine itself is reached through an injected ra8_widget_reflow_ops_t seam.

That seam is what keeps this widget – and the whole ra8_widget library – free of ra8_reflow (which pulls in ra8_gfx, stb, and the glyph atlas): the app binds render_page to ra8_reflow_render_page_at and follow_link to ra8_reflow_hit_test_link + href navigation, so the pixel-touching and engine-specific work lives on-target in the app, and the pure page-state / routing logic is host-testable with a recording mock seam.

[Ring 5 / UI] {World: NS}

Since
0.1.0

Definition in file ra8_widget_reflow_view.h.

Typedef Documentation

◆ ra8_widget_reflow_ops_t

typedef struct ra8_widget_reflow_ops ra8_widget_reflow_ops_t

◆ ra8_widget_reflow_view_t

typedef struct ra8_widget_reflow_view ra8_widget_reflow_view_t

Function Documentation

◆ ra8_widget_reflow_view_init()

ra8_err_t ra8_widget_reflow_view_init ( ra8_widget_t * w,
ra8_widget_reflow_view_t * view )
nodiscard

Bind a widget instance to a reflow view.

Wires w to render + route view: sets its vtable to ra8_widget_reflow_view_vtable, points its ctx at view, 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 reflow view (non-NULL).
[in]viewReflow-view descriptor (non-NULL; outlives w's use).
Returns
ra8_err_t
Return values
k_ra8_okBound; w renders + routes view.
k_ra8_err_null_ptrw or view is NULL.
Precondition
w and view are non-NULL.
view outlives every render / dispatch of w.
Postcondition
On success w->vt == ra8_widget_reflow_view_vtable(), w->ctx == view, w->visible == true.
On failure w is left unchanged.
Note
Not thread-safe.
See also
ra8_widget_reflow_view_vtable
Since
0.1.0

Definition at line 253 of file ra8_widget_reflow_view.c.

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

◆ ra8_widget_reflow_view_vtable()

const ra8_widget_vtable_t * ra8_widget_reflow_view_vtable ( void )

Return the shared vtable backing every reflow-view widget.

One immutable vtable serves all reflow views: render clears the body and asks the seam to paint the current page; on_input follows a link or turns the page; measure is NULL. ra8_widget_reflow_view_init binds it.

Returns
Non-NULL pointer to the static reflow-view 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_reflow_view_init
Since
0.1.0

Definition at line 248 of file ra8_widget_reflow_view.c.

References s_rv_vt.

Referenced by ra8_widget_reflow_view_init().