UXProgressBar
UXProgressBar displays a UXProgress
model. It fills the track to the model’s fraction, or shows the indeterminate
treatment when the total is unknown. A long
UXOperationQueue job reports
through it. The fill-width arithmetic is pure and unit-testable, and drawing
goes through the UXControl seam. On
backends with a native indicator (macOS NSProgressIndicator, Win32
progress32, iOS UIProgressView, Android ProgressBar, GTK
GtkProgressBar) the driver realizes one. On GEM and the web the control
draws the theme’s own bezel, bar, and striped indeterminate fill.
#use <UXKit>Overview
Section titled “Overview”UXProgress* p = new UXProgress();p.setTotal(fileCount);
UXProgressBar* bar = new UXProgressBar();bar.setProgress(p);content.addSubview(bar, UXGeom.make(8, 8, 200, 16));
// as work completes:p.incrementBy(1);bar.setNeedsDisplay();A bar with no progress model, or one whose total is zero, is indeterminate: the platform’s barber pole where there is one, the theme’s striped fill where the control draws itself.
Conforms to
Section titled “Conforms to”- Inherits
UXControl: geometry, enablement, the realization seam. There is no action, because a progress bar only reports.
Topics
Section titled “Topics”Model · setProgress · isIndeterminate Geometry · filledWidth Realization · kind
setProgress
Section titled “setProgress”void setProgress(UXProgress* p)Attaches the model. The bar reads it at draw time, so there is no copy to fall out of date.
isIndeterminate
Section titled “isIndeterminate”bool isIndeterminate(void)True with no model, or when the model itself says so (zero total).
filledWidth
Section titled “filledWidth”i32 filledWidth(i16 trackW)Width of the filled portion for a track trackW wide, from the model’s
per-mille fraction. This is pure arithmetic, and the tests call it without a
window.
UXKind kind(void)UXKindProgress: native where the backend has an indicator, the theme’s
art everywhere else. The driver decides; the control does not know which.
Platform appearance
Section titled “Platform appearance”
The theme’s bezel trough and blue bar fill, drawn on canvas with the same Aristo art GEM draws.

A real UIProgressView, its fraction synced from the model per mille.

A real horizontal ProgressBar (max 1000, so the per-mille fraction maps exactly).

A real NSProgressIndicator.

A real msctls_progress32.

A real GtkProgressBar. GTK draws its own widgets, so this capture is the Linux look wherever GTK4 runs.

The same themed trough and fill, drawn by the same drawRect.
Example
Section titled “Example”An operation queue reporting into the bar from the run loop:
UXProgress* p = new UXProgress();p.setTotal(steps);bar.setProgress(p);
for (i32 i = (i32)0; i < steps; i = i + (i32)1) { doStep(i); p.incrementBy(1); bar.setNeedsDisplay(); gApp.displayIfNeeded();}