Skip to content
Jan Boon edited this page Jul 21, 2026 · 4 revisions

title: Display Widgets (Views) description: Text views, bitmaps, database-driven numbers and gauges published: true editor: markdown

Views are display-only elements: they draw, they never take input. All of them accept the common element attributes; this page lists what each type adds. Color attributes everywhere take "R G B A" decimal or #RRGGBBAA hex — and an unparsable color silently becomes white, not black.

The views showcase window: text sizes and modes, bitmaps at natural and scaled size, and database-driven number views

text — CViewText

The static text view. Its size always comes from its content: w/h are ignored (zeroed at parse).

<view type="text" id="t1" posref="TL TL" x="12" y="-10" fontsize="18" shadow="true"
      global_color="false" color="255 255 255 255" hardtext="Plain text 18" />

Core attributes:

attribute default meaning
hardtext the text; strings starting with ui are looked up as translation keys
hardtext_format translated text parsed for inline @{...} format tags (colors)
color white text color
fontsize 12 size in pixels (plus the global font coefficient option; fontsize_coef="false" opts out)
fontweight / fontstyle normal only bold / oblique are recognized
shadow false 1px drop shadow; shadow_outline for all-directions, shadow_color (default black), shadow_x/shadow_y offsets
case_mode 0 numeric case transform, see below
underlined / strikethrough false decorations

Multi-line:

attribute default meaning
multi_line false enable word wrap
line_maxw unlimited wrap width in pixels — but clamped by the parent's inner width unless multi_line_maxw_only="true"
multi_line_space 8 extra pixels between lines
multi_max_line 0 = off line cap; overflow gets "..."
justification dont_clip_word wrap mode: clip_word, dont_clip_word, justified, centered
continuous_update false re-wrap every frame while an ancestor resizer is being dragged

Single-line overflow handling: auto_clamp shrinks the text to its ancestor's width with "..." (clamp_right picks the end to cut); over_extend_view_text pops the full string in an overlay on hover.

Case modes

case_mode is a number: 0 normal, 1 lower, 2 UPPER, 3 first letter of the string up, 4 first letter of each sentence up, 5 First Letter Of Each Word Up. The client-style %case_upper names are defines you must declare yourself.

Variants

  • text_formated — adds format (default "$t"); the format string is expanded by an application-installed formatter (the client substitutes player names and the like). Without a formatter installed the text passes through.
  • text_id / text_id_formated — the text comes from a server string id: textid is either a literal id or a database leaf holding one; dynamic_string selects the dynamic-string table. These need the application to install a text provider (client-only in practice).

bitmap — CViewBitmap

<view type="bitmap" id="b2" texture="w_slot_item.tga" scale="true" w="64" h="64" global_color="false" />
attribute default meaning
texture atlas entry or file name
color white modulation color
scale false stretch to w/h instead of drawing at texture size
tile false repeat instead of stretching
rot 0 quarter turns (0–3)
flip false horizontal flip
align bottom-left letters l r b t, later letters win (e.g. align="tr")
txtoffsetx/y, txtwidth/height 0 / natural draw a sub-rectangle of the texture
inherit_gc_alpha false multiply alpha by the enclosing container's content alpha (fade with the window)

A blank.tga white texture with scale="true" plus a color is the standard way to draw solid panels and bars — the layout demos on this wiki are built from exactly that.

bitmap_combo is the database-driven cousin: texture/color lists (tx_normal, col_normal, …) indexed by a selected database value, with grid unroll parameters. Rarely authored outside the client.

Database-driven views

These bind to interface database leaves and track them automatically. value must be a database path (UI:..., SERVER:..., LOCAL:...) — a literal number is a parse error for text_number and digit.

text_number — a CViewText displaying a leaf:

attribute default meaning
value required database leaf
format false thousands separators
divisor / modulo 1 / off display (value/divisor) % modulo
prefix / suffix literal text around the number
positive false negative values display as ?

digit — fixed-width digit display using the renderer's pre-rendered digit textures (the Minesweeper counters): value (leaf), numdigit (1–10, default 2), wspace (per-digit spacing, may be negative), color.

text_quantity — displays value/valuemax from two leaves (155/200 style), with emptytext shown when the value is zero.

bar — a gauge; fill ratio = (value − reference) / (range − reference):

<view type="bar" id="g1" value="UI:TEMP:SLIDERH" range="255" color="80 160 255 255" ... />

value, range (default 255), reference (default 0) each accept a literal or a database path. mini, ultra_mini, mini_thick switch to the smaller gauge skins; color_negative (when given an alpha) draws negative ratios. The slot and fill textures are hard-coded gauge skin names (w_jauge_*), so the atlas must contain them.

bar3 — three stacked segments in one slot: value1..3, range1..3, color1..3, mini.

In bar3, omitting a colorN_negative attribute enables negative display in white rather than disabling it (a missing color parses as white). Set colorN_negative="0 0 0 0" explicitly to disable. {.is-warning}

The mouse pointer

generic_pointer is the cursor view — one per interface, drawn last. Its tx_* attributes name cursor textures per context (tx_default, tx_move_window, resize variants, tx_colpick, …); x/y are the hotspot offset. If no pointer view is declared the parser creates a bare one automatically. Note the parser only wires a type="pointer" view (a client-registered class) as the pointer — a type="generic_pointer" element in XML is decorative; rely on the auto-created one or the embedder's registration. See the embedding notes.

Not XML-creatable (script/code only): polygon and quad views, the HTML link view.

Clone this wiki locally