RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
Loading...
Searching...
No Matches
progress.h File Reference

Caller-owned progress activity, geometry, painting and accessibility data. More...

#include <stdint.h>
#include "fb.h"
#include "font.h"
#include "geom.h"
#include "style.h"
#include "draw_target.h"
#include "ui_context.h"

Data Structures

struct  rmgui_progress_t
 maximum is positive and value <= maximum. More...
struct  rmgui_progress_accessibility_t
 Plain bytes-out progressbar metadata. More...

Enumerations

enum  rmgui_progress_mode_t { RMGUI_PROGRESS_DETERMINATE , RMGUI_PROGRESS_INDETERMINATE }
 Activity mode is independent of the resolved fill presentation. More...
enum  rmgui_progress_orientation_t { RMGUI_PROGRESS_HORIZONTAL , RMGUI_PROGRESS_VERTICAL }
 Horizontal fills left-to-right; vertical fills bottom-to-top. More...
enum  rmgui_progress_fill_t { RMGUI_PROGRESS_FILL_SMOOTH , RMGUI_PROGRESS_FILL_SEGMENTED , RMGUI_PROGRESS_FILL_BARBERSHOP }
 Style fill-mode values, applicable to either activity mode. More...

Functions

int rmgui_progress_prepare (const rmgui_ui_t *ui, const rmgui_progress_t *progress, const char *text)
 Prepare the optional NUL-terminated display text before recording.
int rmgui_progress_draw (const rmgui_ui_t *ui, const rmgui_progress_t *progress, rmgui_rect_t box, const char *text)
 Draw the current bar with optional NUL-terminated display text.
int rmgui_progress_init (rmgui_progress_t *self, uint32_t maximum, uint32_t value, rmgui_progress_mode_t mode, rmgui_progress_orientation_t orientation, const char *label)
 Initialize phases/reduced_motion to zero.
int rmgui_progress_set_value (rmgui_progress_t *self, uint32_t value)
 Returns 0 for a valid value; -1 for invalid self/value, unchanged.
int rmgui_progress_measure (const rmgui_style_resolved_t *rs, rmgui_progress_orientation_t orientation, rmgui_size_t *minimum, rmgui_size_t *preferred)
 Return resolved length/thickness sizes, swapped for vertical.
void rmgui_progress_paint (rmgui_fb_t *fb, rmgui_font_t *font, const rmgui_style_resolved_t *rs, rmgui_rect_t rect, rmgui_rect_t clip, const rmgui_progress_t *self, const char *text)
 Paint clipped to rect, clip and framebuffer.
int rmgui_progress_step (rmgui_progress_t *self, const rmgui_style_resolved_t *rs, uint16_t dt_ms)
 Advance activity only if indeterminate, stripes only if BARBERSHOP, normalizing retained phases modulo current positive style periods first.
int rmgui_progress_accessibility (const rmgui_progress_t *self, rmgui_progress_accessibility_t *out)
 Write minimum=0, exact maximum/value/name and indeterminate flag.
void rmgui_progress_paint_to (rmgui_target_t *, rmgui_font_t *, const rmgui_style_resolved_t *, rmgui_rect_t, rmgui_rect_t, const rmgui_progress_t *, const char *)
 Explicit progress destination with identical track, fill and phase behavior.

Detailed Description

Caller-owned progress activity, geometry, painting and accessibility data.

Enumeration Type Documentation

◆ rmgui_progress_mode_t

Activity mode is independent of the resolved fill presentation.

Enumerator
RMGUI_PROGRESS_DETERMINATE 
RMGUI_PROGRESS_INDETERMINATE 

◆ rmgui_progress_orientation_t

Horizontal fills left-to-right; vertical fills bottom-to-top.

Enumerator
RMGUI_PROGRESS_HORIZONTAL 
RMGUI_PROGRESS_VERTICAL 

◆ rmgui_progress_fill_t

Style fill-mode values, applicable to either activity mode.

Enumerator
RMGUI_PROGRESS_FILL_SMOOTH 
RMGUI_PROGRESS_FILL_SEGMENTED 
RMGUI_PROGRESS_FILL_BARBERSHOP 

Function Documentation

◆ rmgui_progress_prepare()

int rmgui_progress_prepare ( const rmgui_ui_t * ui,
const rmgui_progress_t * progress,
const char * text )

Prepare the optional NUL-terminated display text before recording.

The retained label remains the accessibility name. Emits no commands; returns 0 or -1 for invalid arguments, style or preparation.

◆ rmgui_progress_draw()

int rmgui_progress_draw ( const rmgui_ui_t * ui,
const rmgui_progress_t * progress,
rmgui_rect_t box,
const char * text )

Draw the current bar with optional NUL-terminated display text.

Does not advance animation. Returns 0 or -1 for invalid arguments or style; paint errors latch on the target.

◆ rmgui_progress_init()

int rmgui_progress_init ( rmgui_progress_t * self,
uint32_t maximum,
uint32_t value,
rmgui_progress_mode_t mode,
rmgui_progress_orientation_t orientation,
const char * label )

Initialize phases/reduced_motion to zero.

NULL label means empty name. Returns 0; invalid self, zero maximum, value > maximum or invalid enum returns -1 with self unchanged.

◆ rmgui_progress_set_value()

int rmgui_progress_set_value ( rmgui_progress_t * self,
uint32_t value )

Returns 0 for a valid value; -1 for invalid self/value, unchanged.

◆ rmgui_progress_measure()

int rmgui_progress_measure ( const rmgui_style_resolved_t * rs,
rmgui_progress_orientation_t orientation,
rmgui_size_t * minimum,
rmgui_size_t * preferred )

Return resolved length/thickness sizes, swapped for vertical.

Minimum thickness is at least 2*(border_width+padding)+1, and preferred thickness is at least that raised minimum even at small UI scales. Font/text do not affect sizes. Invalid/NULL inputs return -1 leaving both outputs unchanged.

◆ rmgui_progress_paint()

void rmgui_progress_paint ( rmgui_fb_t * fb,
rmgui_font_t * font,
const rmgui_style_resolved_t * rs,
rmgui_rect_t rect,
rmgui_rect_t clip,
const rmgui_progress_t * self,
const char * text )

Paint clipped to rect, clip and framebuffer.

NULL font or empty/NULL text paints no text; other NULL/invalid inputs paint nothing. Determinate extent is floor(inner_extent*value/maximum). Segments light only complete visible candidates. Indeterminate sweeps triangularly; reduced motion centres it. BARBERSHOP tiles stripes with phase-anchored device origin; reduced motion uses offset zero. Missing skins paint each complete procedural part. No allocation or mutation of self or borrowed assets occurs.

◆ rmgui_progress_step()

int rmgui_progress_step ( rmgui_progress_t * self,
const rmgui_style_resolved_t * rs,
uint16_t dt_ms )

Advance activity only if indeterminate, stripes only if BARBERSHOP, normalizing retained phases modulo current positive style periods first.

Fixed valid style/mode/preferences preserve partition invariance. Returns 1 if either phase changes; NULL/invalid, dt=0, DISABLED or reduced motion changes nothing and returns 0. No clocks/timers/allocation.

◆ rmgui_progress_accessibility()

int rmgui_progress_accessibility ( const rmgui_progress_t * self,
rmgui_progress_accessibility_t * out )

Write minimum=0, exact maximum/value/name and indeterminate flag.

Invalid self or NULL output returns -1 unchanged; success returns 0.

◆ rmgui_progress_paint_to()

void rmgui_progress_paint_to ( rmgui_target_t * ,
rmgui_font_t * ,
const rmgui_style_resolved_t * ,
rmgui_rect_t ,
rmgui_rect_t ,
const rmgui_progress_t * ,
const char *  )

Explicit progress destination with identical track, fill and phase behavior.

RECORD requires prepared text glyphs and immutable sheets; failures latch.