Module: ui.widgets.progress

Source: ./ui/widgets/progress.reef


Overview

ui/widgets/progress.reef - Progress bar display Part of reef-stdlib UI module

The Progress widget displays the progress of an operation. It shows a bar that fills based on a percentage value.

Progress bars support:

  • Determinate progress (0-100%)
  • Indeterminate progress (animated)
  • Horizontal and vertical orientations
  • Custom colors
  • Text labels showing percentage

Types

ProgressStyle (enum)

Variants:

  • Horizontal
  • Vertical
  • Circular

Objects

Progress

Extends: widget.Widget

Fields:

Name Type
value float
indeterminate bool
style ProgressStyle
show_label bool
custom_color core.Color
use_custom_color bool
track_color core.Color
use_custom_track bool
bar_height float

proc init(id: widget.WidgetId)

Methods:

override shared fn kind(): string

exclusive proc set_value(value: float)

exclusive proc set_indeterminate(indeterminate: bool)

exclusive proc set_style(style: ProgressStyle)

exclusive proc set_show_label(show: bool)

exclusive proc set_color(color: core.Color)

exclusive proc set_track_color(color: core.Color)

shared fn clone(): Progress

D2 (docs/design/2026-09-08-ui-modernization.md): a SHALLOW copy. Setters mutate the receiver (reef-lang#62), so "give me a variant and leave the original alone" has to be asked for explicitly. Referenced objects are shared, not deep-copied.

shared fn preferred_size(th: theme.Theme): core.Size

exclusive proc layout(constraints: layout.Constraints, th: theme.Theme)

override exclusive fn handle_event(e: event.Event): widget.EventResult

override exclusive proc paint(surf: surface.Surface, th: theme.Theme)


Functions

fn progress_style_horizontal(): ProgressStyle

fn progress_style_vertical(): ProgressStyle

fn progress_style_circular(): ProgressStyle

fn is_horizontal(s: ProgressStyle): bool

fn is_vertical(s: ProgressStyle): bool

fn is_circular(s: ProgressStyle): bool

fn progress(): Progress

fn progress_with_value(value: float): Progress

fn progress_indeterminate(): Progress

fn get_bar_color(p: Progress, colors: theme.ThemeColors): core.Color

fn get_track_color(p: Progress, colors: theme.ThemeColors): core.Color

fn sin_approx(x: float): float

Simple sine approximation (Taylor series, first 3 terms)

fn cos_approx(x: float): float

Simple cosine approximation


Procedures

proc paint_horizontal(p: Progress, surf: surface.Surface, bounds: core.Rect, bar_color: core.Color, track_color: core.Color, th: theme.Theme)

proc paint_vertical(p: Progress, surf: surface.Surface, bounds: core.Rect, bar_color: core.Color, track_color: core.Color)

proc paint_circular(p: Progress, surf: surface.Surface, bounds: core.Rect, bar_color: core.Color, track_color: core.Color)

proc draw_ring_segment(surf: surface.Surface, cx: float, cy: float, radius: float, width: float, color: core.Color, start: float, amount: float)


Generated by reefc doc