Skip to content

File syn_imgui.h

FileList > src > syntropic > ui > syn_imgui.h

Go to the source code of this file

Lightweight, zero-allocation Immediate Mode GUI (IMGUI) for embedded systems. More...

  • #include "../common/syn_defs.h"
  • #include "../display/syn_gfx.h"
  • #include <stdbool.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_IMGUI_Context
Immediate-mode GUI context — inputs, navigation, style, layout.
struct SYN_IMGUI_Layout
Auto-layout state. Managed by syn_imgui_layout_begin/end.
struct SYN_IMGUI_Scroll
Scroll region state for scrollable IMGUI panels.
struct SYN_IMGUI_Style
Visual style parameters for IMGUI widgets.

Public Functions

Type Name
void syn_imgui_bar_chart (SYN_IMGUI_Context * ctx, const char * title, const int32_t * data, size_t count, int32_t min_val, int32_t max_val, int16_t x, int16_t y, int16_t w, int16_t h)
Vertical bar chart.
void syn_imgui_begin (SYN_IMGUI_Context * ctx, SYN_GfxContext gfx, bool select, bool back, int32_t enc_delta, bool touch_down, int16_t touch_x, int16_t touch_y)
Begin a new IMGUI frame.
void syn_imgui_begin_disabled (SYN_IMGUI_Context * ctx)
Begin a disabled region. Widgets draw dimmed and skip input.
bool syn_imgui_button (SYN_IMGUI_Context * ctx, const char * label, int16_t x, int16_t y, int16_t w, int16_t h)
Draw and handle a button.
bool syn_imgui_checkbox (SYN_IMGUI_Context * ctx, const char * label, bool * checked, int16_t x, int16_t y, int16_t w, int16_t h)
Draw and handle a checkbox.
bool syn_imgui_checkbox_flags (SYN_IMGUI_Context * ctx, const char * label, uint32_t * flags, uint32_t mask, int16_t x, int16_t y, int16_t w, int16_t h)
Checkbox that toggles a bitmask in a flags word.
bool syn_imgui_collapsing_header (SYN_IMGUI_Context * ctx, const char * label, bool * expanded, int16_t x, int16_t y, int16_t w, int16_t h)
Collapsible section header.
bool syn_imgui_combo (SYN_IMGUI_Context * ctx, const char * label, const char ** options, size_t count, int32_t * selected, int16_t x, int16_t y, int16_t w, int16_t h)
Renders and handles an inline option selection dropdown/selector.
SYN_IMGUI_Style syn_imgui_default_style (void)
Return the default monochrome style (white-on-black).
bool syn_imgui_dialog (SYN_IMGUI_Context * ctx, const char * message, bool * ok_clicked, int16_t x, int16_t y, int16_t w, int16_t h)
Renders a modal confirmation dialog overlay.
void syn_imgui_end (SYN_IMGUI_Context * ctx)
End the IMGUI frame.
void syn_imgui_end_disabled (SYN_IMGUI_Context * ctx)
End a disabled region.
void syn_imgui_gauge (SYN_IMGUI_Context * ctx, const char * label, int32_t value, int32_t min, int32_t max, int16_t cx, int16_t cy, int16_t radius)
Renders an analog meter gauge with a needle indicator.
void syn_imgui_graph (SYN_IMGUI_Context * ctx, const char * title, const int32_t * data, size_t count, int32_t min_val, int32_t max_val, int16_t x, int16_t y, int16_t w, int16_t h)
Renders a line telemetry chart.
void syn_imgui_group_begin (SYN_IMGUI_Context * ctx, const char * title, int16_t x, int16_t y, int16_t w, int16_t h)
Begin a visual group box with an optional title.
void syn_imgui_group_end (SYN_IMGUI_Context * ctx)
End the group box.
bool syn_imgui_icon_button (SYN_IMGUI_Context * ctx, const uint8_t * icon, int16_t icon_w, int16_t icon_h, int16_t x, int16_t y, int16_t w, int16_t h)
Button that displays a monochrome icon bitmap.
void syn_imgui_init (SYN_IMGUI_Context * ctx)
Initialize the IMGUI context.
void syn_imgui_label (SYN_IMGUI_Context * ctx, const char * text, int16_t x, int16_t y)
Draw a static text label (no navigation ID, no interaction).
void syn_imgui_label_centered (SYN_IMGUI_Context * ctx, const char * text, int16_t x, int16_t y, int16_t w)
Draw a centered label within a given width.
void syn_imgui_label_colored (SYN_IMGUI_Context * ctx, const char * text, uint16_t color, int16_t x, int16_t y)
Draw a label in an arbitrary color.
void syn_imgui_label_right (SYN_IMGUI_Context * ctx, const char * text, int16_t x, int16_t y, int16_t w)
Draw a right-aligned label within a given width.
void syn_imgui_layout_begin (SYN_IMGUI_Context * ctx, int16_t x, int16_t y, int16_t w)
Begin an auto-layout region.
void syn_imgui_layout_end (SYN_IMGUI_Context * ctx)
End the auto-layout region.
void syn_imgui_layout_row (SYN_IMGUI_Context * ctx, int items, const int16_t * widths, int16_t height)
Define a multi-column layout row.
void syn_imgui_progress_bar (SYN_IMGUI_Context * ctx, int32_t value, int32_t min, int32_t max, int16_t x, int16_t y, int16_t w, int16_t h)
Renders a non-interactive progress bar.
void syn_imgui_progress_bar_ex (SYN_IMGUI_Context * ctx, int32_t value, int32_t min, int32_t max, const char * overlay, int16_t x, int16_t y, int16_t w, int16_t h)
Enhanced progress bar with overlay text and indeterminate mode.
bool syn_imgui_radio (SYN_IMGUI_Context * ctx, const char * label, int32_t * selection, int32_t button_val, int16_t x, int16_t y, int16_t w, int16_t h)
Draw and handle a radio button option.
void syn_imgui_same_line (SYN_IMGUI_Context * ctx)
Place the next widget on the same row as the previous one.
void syn_imgui_scroll_begin (SYN_IMGUI_Context * ctx, int16_t x, int16_t y, int16_t w, int16_t h, int16_t * scroll)
Begin a scrollable region.
void syn_imgui_scroll_end (SYN_IMGUI_Context * ctx)
End the scrollable region and draw scroll indicator.
bool syn_imgui_selectable (SYN_IMGUI_Context * ctx, const char * label, bool * selected, int16_t x, int16_t y, int16_t w, int16_t h)
Full-width clickable row (like a borderless toggleable button).
void syn_imgui_separator (SYN_IMGUI_Context * ctx, int16_t x, int16_t y, int16_t w)
Draw a horizontal separator line.
void syn_imgui_separator_text (SYN_IMGUI_Context * ctx, const char * text, int16_t x, int16_t y, int16_t w)
Draw a labeled separator: ── Title ──────────
void syn_imgui_set_style (SYN_IMGUI_Context * ctx, const SYN_IMGUI_Style * style)
Override the active style.
bool syn_imgui_slider (SYN_IMGUI_Context * ctx, const char * label, int32_t * value, int32_t min, int32_t max, int16_t x, int16_t y, int16_t w, int16_t h)
Draw and handle an integer value slider.
void syn_imgui_spacing (SYN_IMGUI_Context * ctx, int16_t pixels)
Insert vertical spacing (moves the layout cursor down).
bool syn_imgui_spinner (SYN_IMGUI_Context * ctx, const char * label, int32_t * value, int32_t min, int32_t max, int32_t step, int16_t x, int16_t y, int16_t w, int16_t h)
Integer numeric spinner widget.
void syn_imgui_status_bar (SYN_IMGUI_Context * ctx, const char * text, int16_t x, int16_t y, int16_t w)
Draw a single-line status bar with a separator above it.
bool syn_imgui_tabs (SYN_IMGUI_Context * ctx, const char ** labels, size_t count, int32_t * active, int16_t x, int16_t y, int16_t w)
Horizontal tab selector.
void syn_imgui_text_clipped (SYN_IMGUI_Context * ctx, const char * text, int16_t x, int16_t y, int16_t clip_x, int16_t clip_y, int16_t clip_w, int16_t clip_h)
Draw text clipped to a bounding rectangle.
void syn_imgui_text_marquee (SYN_IMGUI_Context * ctx, const char * text, int16_t * offset, int16_t x, int16_t y, int16_t w, int16_t speed)
Scrolling text label with pause at each end.
void syn_imgui_text_wrapped (SYN_IMGUI_Context * ctx, const char * text, int16_t x, int16_t y, int16_t w)
Render word-wrapped text within a width.
bool syn_imgui_toggle (SYN_IMGUI_Context * ctx, const char * label, bool * state, int16_t x, int16_t y, int16_t w, int16_t h)
ON/OFF toggle switch.
void syn_imgui_value_int (SYN_IMGUI_Context * ctx, const char * label, int32_t value, int16_t x, int16_t y)
Draw a non-interactive "label: value" pair.
bool syn_imgui_widget_visible (const SYN_IMGUI_Context * ctx, int16_t y, int16_t h)
Check if a widget at (y, h) is visible in the scroll viewport.

Macros

Type Name
define SYN_IMGUI_MAX_ROW_COLS 8
Maximum number of columns in a layout_row call.

Detailed Description

Supports both button/encoder physical inputs and touch-screen inputs.

Public Functions Documentation

function syn_imgui_bar_chart

Vertical bar chart.

void syn_imgui_bar_chart (
    SYN_IMGUI_Context * ctx,
    const char * title,
    const int32_t * data,
    size_t count,
    int32_t min_val,
    int32_t max_val,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • title Chart title (drawn top-left).
  • data Data values.
  • count Number of values.
  • min_val Minimum axis value.
  • max_val Maximum axis value.
  • x Bounds.

function syn_imgui_begin

Begin a new IMGUI frame.

void syn_imgui_begin (
    SYN_IMGUI_Context * ctx,
    SYN_GfxContext gfx,
    bool select,
    bool back,
    int32_t enc_delta,
    bool touch_down,
    int16_t touch_x,
    int16_t touch_y
) 

Resets the transient ID counter, processes physical navigation inputs, and resets active states.

Parameters:

  • ctx Context.
  • gfx Graphics context to draw on.
  • select True if select button was pressed this frame.
  • back True if back button was pressed this frame.
  • enc_delta Encoder rotation value for this frame.
  • touch_down True if touch screen is active.
  • touch_x Touch X coordinate.
  • touch_y Touch Y coordinate.

function syn_imgui_begin_disabled

Begin a disabled region. Widgets draw dimmed and skip input.

void syn_imgui_begin_disabled (
    SYN_IMGUI_Context * ctx
) 

Calls may be nested; the region is re-enabled only when every begin_disabled has a matching end_disabled.

Parameters:

  • ctx Context.

function syn_imgui_button

Draw and handle a button.

bool syn_imgui_button (
    SYN_IMGUI_Context * ctx,
    const char * label,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • label Button text.
  • x X coordinate.
  • y Y coordinate.
  • w Width.
  • h Height.

Returns:

true if the button was selected/clicked this frame.


function syn_imgui_checkbox

Draw and handle a checkbox.

bool syn_imgui_checkbox (
    SYN_IMGUI_Context * ctx,
    const char * label,
    bool * checked,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • label Checkbox label.
  • checked Pointer to boolean state.
  • x X coordinate.
  • y Y coordinate.
  • w Width.
  • h Height.

Returns:

true if the checkbox state was toggled this frame.


function syn_imgui_checkbox_flags

Checkbox that toggles a bitmask in a flags word.

bool syn_imgui_checkbox_flags (
    SYN_IMGUI_Context * ctx,
    const char * label,
    uint32_t * flags,
    uint32_t mask,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • label Display label.
  • flags Pointer to the flags word (modified in place).
  • mask Bitmask to toggle.
  • x Bounds (0 = auto-layout).

Returns:

true if the value changed this frame.


function syn_imgui_collapsing_header

Collapsible section header.

bool syn_imgui_collapsing_header (
    SYN_IMGUI_Context * ctx,
    const char * label,
    bool * expanded,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Renders "+ Label" (collapsed) or "- Label" (expanded). Toggles *expanded on click.

Parameters:

  • ctx Context.
  • label Section title.
  • expanded Pointer to expansion state (toggled on click).
  • x Bounds (0 = auto-layout).

Returns:

true if the expanded state changed this frame.


function syn_imgui_combo

Renders and handles an inline option selection dropdown/selector.

bool syn_imgui_combo (
    SYN_IMGUI_Context * ctx,
    const char * label,
    const char ** options,
    size_t count,
    int32_t * selected,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • label Selector label.
  • options Array of option string labels.
  • count Number of option strings in the array.
  • selected Pointer to active selected index.
  • x X coordinate.
  • y Y coordinate.
  • w Width.
  • h Height.

Returns:

true if selection changed this frame.


function syn_imgui_default_style

Return the default monochrome style (white-on-black).

SYN_IMGUI_Style syn_imgui_default_style (
    void
) 

The returned struct may be modified and passed to syn_imgui_set_style().

Returns:

Default style struct.


function syn_imgui_dialog

Renders a modal confirmation dialog overlay.

bool syn_imgui_dialog (
    SYN_IMGUI_Context * ctx,
    const char * message,
    bool * ok_clicked,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Captures all navigation and touch focus until dismissed.

Parameters:

  • ctx Context.
  • message Display text.
  • ok_clicked Pointer to check trigger results (updated when OK is clicked).
  • x X coordinate.
  • y Y coordinate.
  • w Width.
  • h Height.

Returns:

true if the modal dialog has been dismissed (OK or CANCEL selected).


function syn_imgui_end

End the IMGUI frame.

void syn_imgui_end (
    SYN_IMGUI_Context * ctx
) 

Finalizes widget count tracking.

Parameters:

  • ctx Context.

function syn_imgui_end_disabled

End a disabled region.

void syn_imgui_end_disabled (
    SYN_IMGUI_Context * ctx
) 

Parameters:

  • ctx Context.

function syn_imgui_gauge

Renders an analog meter gauge with a needle indicator.

void syn_imgui_gauge (
    SYN_IMGUI_Context * ctx,
    const char * label,
    int32_t value,
    int32_t min,
    int32_t max,
    int16_t cx,
    int16_t cy,
    int16_t radius
) 

Uses lightweight fixed-point integer mathematics for vector coordinates.

Parameters:

  • ctx Context.
  • label Gauge label.
  • value Current value to point needle at.
  • min Minimum bounds.
  • max Maximum bounds.
  • cx Center X coordinate.
  • cy Center Y coordinate.
  • radius Radius of gauge boundary.

function syn_imgui_graph

Renders a line telemetry chart.

void syn_imgui_graph (
    SYN_IMGUI_Context * ctx,
    const char * title,
    const int32_t * data,
    size_t count,
    int32_t min_val,
    int32_t max_val,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • title Chart title label.
  • data Pointer to array of data points.
  • count Number of data points.
  • min_val Minimum scale limit.
  • max_val Maximum scale limit.
  • x X coordinate.
  • y Y coordinate.
  • w Width.
  • h Height.

function syn_imgui_group_begin

Begin a visual group box with an optional title.

void syn_imgui_group_begin (
    SYN_IMGUI_Context * ctx,
    const char * title,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • title Title text (NULL for no title).
  • x Bounds.

function syn_imgui_group_end

End the group box.

void syn_imgui_group_end (
    SYN_IMGUI_Context * ctx
) 

Parameters:

  • ctx Context.

function syn_imgui_icon_button

Button that displays a monochrome icon bitmap.

bool syn_imgui_icon_button (
    SYN_IMGUI_Context * ctx,
    const uint8_t * icon,
    int16_t icon_w,
    int16_t icon_h,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • icon Bitmap data (1bpp, row-major, MSB first).
  • icon_w Icon dimensions in pixels.
  • x Button bounds (0 = auto-layout).

Returns:

true if clicked this frame.


function syn_imgui_init

Initialize the IMGUI context.

void syn_imgui_init (
    SYN_IMGUI_Context * ctx
) 

Parameters:

  • ctx Context to initialize.

function syn_imgui_label

Draw a static text label (no navigation ID, no interaction).

void syn_imgui_label (
    SYN_IMGUI_Context * ctx,
    const char * text,
    int16_t x,
    int16_t y
) 

Uses style.fg for color. When inside a layout region with x=0, y=0, the label is drawn at the current cursor and the cursor advances.

Parameters:

  • ctx Context.
  • text Null-terminated string.
  • x X coordinate (0 = use layout cursor).
  • y Y coordinate (0 = use layout cursor).

function syn_imgui_label_centered

Draw a centered label within a given width.

void syn_imgui_label_centered (
    SYN_IMGUI_Context * ctx,
    const char * text,
    int16_t x,
    int16_t y,
    int16_t w
) 

Parameters:

  • ctx Context.
  • text Null-terminated string.
  • x Left edge and vertical position.
  • w Width to center within.

function syn_imgui_label_colored

Draw a label in an arbitrary color.

void syn_imgui_label_colored (
    SYN_IMGUI_Context * ctx,
    const char * text,
    uint16_t color,
    int16_t x,
    int16_t y
) 

Parameters:

  • ctx Context.
  • text Null-terminated string.
  • color 16-bit color value.
  • x Position.

function syn_imgui_label_right

Draw a right-aligned label within a given width.

void syn_imgui_label_right (
    SYN_IMGUI_Context * ctx,
    const char * text,
    int16_t x,
    int16_t y,
    int16_t w
) 

Parameters:

  • ctx Context.
  • text Null-terminated string.
  • x Left edge and vertical position.
  • w Width to right-align within.

function syn_imgui_layout_begin

Begin an auto-layout region.

void syn_imgui_layout_begin (
    SYN_IMGUI_Context * ctx,
    int16_t x,
    int16_t y,
    int16_t w
) 

Widgets within this region may pass x=0, y=0, w=0, h=0 to use the layout cursor. Widgets that use the cursor advance it down by (widget_height + style.spacing) after each call.

Parameters:

  • ctx Context.
  • x Left edge of the layout region.
  • y Top edge.
  • w Default widget width (used when widget's w parameter is 0).

function syn_imgui_layout_end

End the auto-layout region.

void syn_imgui_layout_end (
    SYN_IMGUI_Context * ctx
) 

Parameters:

  • ctx Context.

function syn_imgui_layout_row

Define a multi-column layout row.

void syn_imgui_layout_row (
    SYN_IMGUI_Context * ctx,
    int items,
    const int16_t * widths,
    int16_t height
) 

Subsequent auto-layout widgets fill columns left-to-right. Positive width = fixed pixels. Negative width = fill remainder.

Parameters:

  • ctx Context (must be inside a layout region).
  • items Number of columns (max SYN_IMGUI_MAX_ROW_COLS).
  • widths Array of column widths (NULL for equal split).
  • height Row height (0 = auto).

function syn_imgui_progress_bar

Renders a non-interactive progress bar.

void syn_imgui_progress_bar (
    SYN_IMGUI_Context * ctx,
    int32_t value,
    int32_t min,
    int32_t max,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • value Current status value.
  • min Minimum possible value.
  • max Maximum possible value.
  • x X coordinate.
  • y Y coordinate.
  • w Width.
  • h Height.

function syn_imgui_progress_bar_ex

Enhanced progress bar with overlay text and indeterminate mode.

void syn_imgui_progress_bar_ex (
    SYN_IMGUI_Context * ctx,
    int32_t value,
    int32_t min,
    int32_t max,
    const char * overlay,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • value Current value. If value < min, renders indeterminate animation.
  • min Value range.
  • overlay Overlay text (NULL = auto "XX%", "" = no text).
  • x Bounds.

function syn_imgui_radio

Draw and handle a radio button option.

bool syn_imgui_radio (
    SYN_IMGUI_Context * ctx,
    const char * label,
    int32_t * selection,
    int32_t button_val,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Sets the selection variable to the target button value if clicked or touched.

Parameters:

  • ctx Context.
  • label Radio button label.
  • selection Pointer to active selection variable.
  • button_val Specific option value this button represents.
  • x X coordinate.
  • y Y coordinate.
  • w Width.
  • h Height.

Returns:

true if the selection changed to this button's value this frame.


function syn_imgui_same_line

Place the next widget on the same row as the previous one.

void syn_imgui_same_line (
    SYN_IMGUI_Context * ctx
) 

Call immediately before the next widget. The next widget's x is set to (previous widget right edge + style.spacing).

Parameters:

  • ctx Context.

function syn_imgui_scroll_begin

Begin a scrollable region.

void syn_imgui_scroll_begin (
    SYN_IMGUI_Context * ctx,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h,
    int16_t * scroll
) 

Widgets between scroll_begin and scroll_end are clipped to the viewport and offset by the scroll position. The scroll offset is auto-adjusted to keep the focused widget visible.

Parameters:

  • ctx Context.
  • x Viewport left edge.
  • y Viewport top edge.
  • w Viewport width.
  • h Viewport height.
  • scroll Pointer to user-owned scroll offset (persists between frames).

function syn_imgui_scroll_end

End the scrollable region and draw scroll indicator.

void syn_imgui_scroll_end (
    SYN_IMGUI_Context * ctx
) 

Parameters:

  • ctx Context.

function syn_imgui_selectable

Full-width clickable row (like a borderless toggleable button).

bool syn_imgui_selectable (
    SYN_IMGUI_Context * ctx,
    const char * label,
    bool * selected,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • label Display text.
  • selected Pointer to selection state (toggled on click).
  • x Bounds (0 = auto-layout).

Returns:

true if clicked this frame.


function syn_imgui_separator

Draw a horizontal separator line.

void syn_imgui_separator (
    SYN_IMGUI_Context * ctx,
    int16_t x,
    int16_t y,
    int16_t w
) 

When inside a layout region, the line spans the full layout width and the cursor advances by 1 + style.spacing.

Parameters:

  • ctx Context.
  • x X start (0 = use layout cursor).
  • y Y position (0 = use layout cursor).
  • w Width in pixels (0 = use layout width).

function syn_imgui_separator_text

Draw a labeled separator: ── Title ──────────

void syn_imgui_separator_text (
    SYN_IMGUI_Context * ctx,
    const char * text,
    int16_t x,
    int16_t y,
    int16_t w
) 

Parameters:

  • ctx Context.
  • text Section title text.
  • x X coordinate.
  • y Y coordinate.
  • w Total width.

function syn_imgui_set_style

Override the active style.

void syn_imgui_set_style (
    SYN_IMGUI_Context * ctx,
    const SYN_IMGUI_Style * style
) 

Parameters:

  • ctx Context.
  • style Style to copy into the context.

function syn_imgui_slider

Draw and handle an integer value slider.

bool syn_imgui_slider (
    SYN_IMGUI_Context * ctx,
    const char * label,
    int32_t * value,
    int32_t min,
    int32_t max,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

When clicked or touched, this widget goes into "edit mode". While in edit mode, encoder rotation or direct touch drags change the value.

Parameters:

  • ctx Context.
  • label Slider label.
  • value Pointer to integer value.
  • min Minimum allowed value.
  • max Maximum allowed value.
  • x X coordinate.
  • y Y coordinate.
  • w Width.
  • h Height.

Returns:

true if the value was modified this frame.


function syn_imgui_spacing

Insert vertical spacing (moves the layout cursor down).

void syn_imgui_spacing (
    SYN_IMGUI_Context * ctx,
    int16_t pixels
) 

Parameters:

  • ctx Context.
  • pixels Number of pixels to advance downward.

function syn_imgui_spinner

Integer numeric spinner widget.

bool syn_imgui_spinner (
    SYN_IMGUI_Context * ctx,
    const char * label,
    int32_t * value,
    int32_t min,
    int32_t max,
    int32_t step,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Renders Label [< value >]. When focused, encoder delta increments the value by step. Returns true on the frame the value changes.

Parameters:

  • ctx Context.
  • label Display label.
  • value Pointer to the current value (modified in place).
  • min Minimum value (clamped, wraps to max).
  • max Maximum value (clamped, wraps to min).
  • step Increment / decrement amount per encoder tick.
  • x X coordinate (0 = use layout cursor).
  • y Y coordinate (0 = use layout cursor).
  • w Width (0 = use layout width).
  • h Height (0 = font height + 2*padding).

Returns:

true if the value changed this frame.


function syn_imgui_status_bar

Draw a single-line status bar with a separator above it.

void syn_imgui_status_bar (
    SYN_IMGUI_Context * ctx,
    const char * text,
    int16_t x,
    int16_t y,
    int16_t w
) 

Parameters:

  • ctx IMGUI context.
  • text Status text to display.
  • x X position.
  • y Y position.
  • w Width in pixels.

function syn_imgui_tabs

Horizontal tab selector.

bool syn_imgui_tabs (
    SYN_IMGUI_Context * ctx,
    const char ** labels,
    size_t count,
    int32_t * active,
    int16_t x,
    int16_t y,
    int16_t w
) 

Renders a row of labeled tabs. Consumes one navigation ID. When focused, encoder cycles through tabs.

Parameters:

  • ctx Context.
  • labels Array of tab label strings.
  • count Number of tabs.
  • active Pointer to active tab index.
  • x Position and total width.

Returns:

true if the active tab changed.


function syn_imgui_text_clipped

Draw text clipped to a bounding rectangle.

void syn_imgui_text_clipped (
    SYN_IMGUI_Context * ctx,
    const char * text,
    int16_t x,
    int16_t y,
    int16_t clip_x,
    int16_t clip_y,
    int16_t clip_w,
    int16_t clip_h
) 

Uses the canvas clip rect to prevent text overflow.

Parameters:

  • ctx Context.
  • text Null-terminated string.
  • x Text draw position.
  • clip_x Clipping rectangle.

function syn_imgui_text_marquee

Scrolling text label with pause at each end.

void syn_imgui_text_marquee (
    SYN_IMGUI_Context * ctx,
    const char * text,
    int16_t * offset,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t speed
) 

If the text fits within w, it's drawn statically. Otherwise it scrolls left, pauses, scrolls right, pauses, and repeats. The caller owns the scroll state (just declare static int16_t off = 0;).

Parameters:

  • ctx Context.
  • text Null-terminated string.
  • offset Pointer to caller-owned scroll offset (auto-advanced).
  • x Top-left corner.
  • w Available width (clips text beyond this).
  • speed Pixels per frame (1–2 typical).

function syn_imgui_text_wrapped

Render word-wrapped text within a width.

void syn_imgui_text_wrapped (
    SYN_IMGUI_Context * ctx,
    const char * text,
    int16_t x,
    int16_t y,
    int16_t w
) 

Parameters:

  • ctx Context.
  • text Null-terminated string.
  • x Top-left corner.
  • w Maximum width (wraps at word boundaries).

function syn_imgui_toggle

ON/OFF toggle switch.

bool syn_imgui_toggle (
    SYN_IMGUI_Context * ctx,
    const char * label,
    bool * state,
    int16_t x,
    int16_t y,
    int16_t w,
    int16_t h
) 

Parameters:

  • ctx Context.
  • label Label text.
  • state Pointer to boolean state.
  • x Bounds (0 = auto-layout).

Returns:

true if state was toggled this frame.


function syn_imgui_value_int

Draw a non-interactive "label: value" pair.

void syn_imgui_value_int (
    SYN_IMGUI_Context * ctx,
    const char * label,
    int32_t value,
    int16_t x,
    int16_t y
) 

Parameters:

  • ctx Context.
  • label Key text.
  • value Integer value.
  • x Position.

function syn_imgui_widget_visible

Check if a widget at (y, h) is visible in the scroll viewport.

bool syn_imgui_widget_visible (
    const SYN_IMGUI_Context * ctx,
    int16_t y,
    int16_t h
) 

Returns true if not in a scroll region or if any part is visible. Widgets that return false should still call next_id++ for focus.

Parameters:

  • ctx Context.
  • y Widget top edge.
  • h Widget height.

Returns:

true if any part of the widget is visible (or no scroll active).


Macro Definition Documentation

define SYN_IMGUI_MAX_ROW_COLS

Maximum number of columns in a layout_row call.

#define SYN_IMGUI_MAX_ROW_COLS `8`



The documentation for this class was generated from the following file src/syntropic/ui/syn_imgui.h