<--- Cannot embed stylesheet: [Errno 2] No such file or directory: '../../../../aros.css' --->

Gauge.mui

MUIA_Gauge_Current

Function

Set or retrieve the stored progress value.

Inputs

Initialize, set and get. Header type LONG; actual storage ULONG. Default
zero.

Notes

At construction the supplied value is divided by Divide when nonzero,
then limited to Max. On set, comparison uses the incoming tag value
against the already transformed stored value. An equal tag becomes
TAG_IGNORE; a different value is stored and requests text reformatting
and full redraw. Division and upper clamping then run after the entire
tag list, including on equal or unrelated set calls.
Get returns the transformed value. The forwarded Current tag retains its
raw argument, so a notification can receive a value different from Get.
Repeated division or clamping does not synthesize a new Current
notification. For example, Current 80 with Divide 2 constructs a stored
value of 40; a later unrelated set changes it to 20 without a local
redraw request.

MUIA_Gauge_Divide

Function

Set or retrieve the divisor applied to Current.

Inputs

Initialize, set and get. Header type LONG; actual storage ULONG. Default
1. Zero disables division.

Notes

The divisor applies after all tags have been processed, not immediately
when encountered. A changed divisor requests reformatting and redraw; an
unchanged tag is ignored for superclass notification processing.
Regardless of whether it changes, every set call divides the existing
Current again when the divisor is nonzero. Changing Divide does not
recover an earlier raw Current. Use 1 to avoid repeated scaling of
stored values.

MUIA_Gauge_DupInfoText

Function

Choose whether Gauge owns a copy of InfoText.

Inputs

Initialize, BOOL, default FALSE. AROS also implements get although the
header marks this attribute initialize-only. No local setter is
implemented.

Notes

TRUE duplicates the final constructor InfoText and changed replacement
strings with StrDup. The class frees its old copy on replacement and its
surviving copy on disposal. NULL input or allocation failure leaves no
stored string; constructor allocation failure does not fail object
creation. FALSE borrows the string and never frees it.
The flag is read after all constructor tags, so its order relative to
InfoText does not alter copying. Get returns the stored flag. A pointer
returned by InfoText remains class-owned in copy mode and must not be
freed or modified by the caller.

MUIA_Gauge_Horiz

Function

Select the bar orientation during construction.

Inputs

Initialize only, BOOL. Default FALSE for vertical; TRUE selects
horizontal.

Notes

The constructor stores the value. This class has no setter or getter for
Horiz; later tags do not change its orientation. Horizontal fill grows
from the left, vertical fill from the bottom. Orientation also
determines which size dimension can expand when text is present.

MUIA_Gauge_InfoText

Function

Provide the format string used to display Current.

Inputs

Initialize, set and get, STRPTR. Default NULL. Supply a readable
NUL-terminated printf format compatible with the single ULONG Current
argument, such as "%lu%%", or literal text with no conversions.

Notes

Formatting uses snprintf into an internal 256-byte buffer, including the
terminator. Get returns the format pointer, not the rendered buffer.
Construction permits NULL for no text. DupInfoText decides whether the
format is borrowed or copied. With borrowing, keep it valid until
replacement or disposal; do not modify it in place to request an update.
Setting compares string contents. Equal text becomes TAG_IGNORE and
retains the old pointer, even if a different pointer was supplied.
Replacing an existing non-NULL string with NULL reaches strcmp with NULL
and is unsafe. An empty string can display no characters but still
counts as a present InfoText for sizing.
A changed string is formatted with the post-division Current and
requests redraw, but no size remeasurement. Copy failure leaves InfoText
NULL without reporting setter failure. In copy mode the old string is
freed before duplication; a replacement must not point inside that owned
allocation. Current and Divide changes also reformat; Max alone does
not.

MUIA_Gauge_Max

Function

Set or retrieve the upper bound and fill denominator.

Inputs

Initialize, set and get. Header type LONG; actual storage ULONG. Default
100.

Notes

Current is upper-clamped after construction and every set call. Changing
Max requests full redraw but does not itself reformat InfoText; text can
therefore show an old value after clamping. An unchanged Max tag becomes
TAG_IGNORE. No Current notification is generated for the clamp.
Vertical drawing requires Max greater than zero; it has no
zero-denominator guard. Horizontal drawing handles zero by selecting a
zero fill width. Max does not change size requirements.

MUIC_Gauge

Superclass

Area.mui

Description

Display a filled progress bar with optional formatted text. The default
is vertical, with Current zero, Max 100 and Divide 1. This is an Area
subclass, not a Numeric subclass. No automatic progress source, timer or
binding to another object is installed.
Current, Max and Divide are stored as ULONG despite the public header's
LONG annotations. Supply nonnegative representable values; negative
inputs are not rejected. Construction first reads all tags, then divides
Current if Divide is nonzero and clamps it to Max. Every subsequent
OM_SET repeats division and clamping, even if no Gauge attribute
changes. The stored value is therefore not a retained raw progress
count.

Methods

Setup calls Area and measures the current formatted string once using
TextLength and the current font. AskMinMax uses those cached dimensions
and orientation, allowing expansion along the bar. With no InfoText it
permits expansion in both directions. Later value or text changes do not
recompute the cached dimensions or request relayout.
Draw calls Area, paints the horizontal fill from the left or vertical
fill from the bottom, and centers formatted text through the Zune text
engine. It does not test drawing flags locally. Temporary text-engine
objects are destroyed after drawing; allocation failure skips text. Draw
and AskMinMax return zero. Setup returns zero on superclass failure,
otherwise one.

Notes

Dispose frees InfoText only when DupInfoText was enabled at
construction. Otherwise the format string remains borrowed. Getters
return stored values or a borrowed format pointer; there is no getter
for Horiz. Setter return values come from Area and do not report
string-copy failure.
Use a nonzero Max for vertical drawing. The vertical path divides by Max
without a zero check; the horizontal path uses zero fill when Max is
zero. Fill-size multiplication is not widened to 64 bits and can
overflow. Keep dimensions and values within that arithmetic range. These
implementation limits are not corrected by this class.