The REAL family name of the primary stack (read from its source file's name table) — what the weight axis resolves a nil family against. Nil headless / for synthetic stacks: no cuts then.
Egui::Context
Inherits Reference < Object
Constants
Panel resizing (egui Panel::resizable, default there too): a
drag grip on the panel's inner edge grows/shrinks it, persisted per
panel id in Memory. height:/width: become the INITIAL size.
also the minimum default panel extent
A titled, movable, resizable window. egui order preserved: reserve the background slot, interact with the title bar (drag → Areas state moves the window; click/hover → bring to top), build contents, back-fill the frame, title.
Constructors
Instance methods
Was action fired this frame (hotkey or menu click)? Does not
claim it — use #consume_action for exactly-once handling.
egui Context::animate_value_with_time: smoothly move value
towards its new target; state keyed by widget id.
egui Area (containers/area.rs) — an explicit positioned region
in its own Middle layer: the building block window/popup are made
of, exposed for custom floating content. Position persists in
Areas (bring-to-top on interaction, like a window without chrome).
egui Context::available_rect: screen area not yet claimed by
panels. Reset each begin_frame; every panel takes a bite; the
central panel takes what's left (panels must be added first —
the upstream ordering rule).
REAL variant faces of the primary stack — what bold/italic text
measures and draws through (Sokol.select_fonts(bold:/italic:/
bold_italic:)). Nil = the variant isn't installed: the text
serves through the base #fonts' own glyphs, never an emulated one.
REAL variant faces of the primary stack — what bold/italic text
measures and draws through (Sokol.select_fonts(bold:/italic:/
bold_italic:)). Nil = the variant isn't installed: the text
serves through the base #fonts' own glyphs, never an emulated one.
egui CentralPanel::show — the remainder. Returns its rect.
fill overrides the panel background (nil → the style's
panel_fill) — Color32.transparent makes the central panel paint
nothing, so a widget that draws its own (possibly translucent)
background shows the desktop through a transparent window.
DEFERRED (egui.cr fix, no upstream counterpart): the block does not run here — #end_frame renders it after every other panel has bitten #available_rect, so the central panel ends up with the true remainder whatever order the app declared panels in (a bottom status bar after the central panel used to paint OVER its content). The return value is the remainder at CALL time — exact when the central panel is declared last (the recommended style), approximate if later panels still bite.
Claim id for a widget created with the explicit name name
(kind is the widget class, for the error message). Ids are
claimed once per frame; a second claim of the same id raises —
explicit ids are the developer's addressing tool and must be
unique. Auto ids skip this (their collisions stay on the silent
Memory duplicate accounting).
Remove one key (nil = wipe every key of every state) from a per-element override; the slot goes back to inheriting the cascade. Empty bags are dropped entirely.
egui consume_key semantics for actions: the first caller claims
the fired action; later callers this frame see false. Actions
live for one frame — an unconsumed firing expires.
The widget currently running through Ui#add (set there, read
by #interact for inspector meta recording). Internal.
The cursor the frame asked the integration to show (upstream
PlatformOutput::cursor_icon): reset to Default each
begin_frame, set by widgets via #set_cursor_icon / hover.
Upstream PlatformOutput::cursor_image: when set, the
integration should display this RGBA bitmap as the OS cursor
instead of #cursor_icon (backends without support fall back to
the icon). Reset each begin_frame, set via #set_cursor_image.
Register (once) the deferred stack for one font FILE and return its family name — the "wght:<path>" cut stacks of the weight axis measure through #fonts_for(name) and draw through the backend's registry.
Font families whose stack is NOT loaded yet: family name → font file paths (the system scan's output). Materialized into #font_families by #fonts_for on FIRST USE through #font_loader — startup pays for names only; the parse happens for the families actually picked. The reserved names are not deferrable (they are the built-in slots).
Font families whose stack is NOT loaded yet: family name → font file paths (the system scan's output). Materialized into #font_families by #fonts_for on FIRST USE through #font_loader — startup pays for names only; the parse happens for the families actually picked. The reserved names are not deferrable (they are the built-in slots).
egui popup (containers/popup.rs): rides the Foreground layer,
closes when a click lands outside it (Memory#end_frame). pad
overrides the frame's inner padding (menus pass a zero vertical
pad so the frame hugs the first/last item).
Dropdown anchor (upstream popup::above_or_below): the popup
opens below button, but flips above it when the button sits too
close to the screen's bottom for the popup's last measured height
(Memory#layer_sizes). The very first frame always opens below —
#popup measures the content, and from the next frame on the
side is re-picked every frame, so a button that moves (scroll,
window drag) flips back and forth as space allows.
An embedded window — a MODAL window with chrome: what #modal is for content dialogs, this is for an app's dialog WINDOWS (Settings, Theme…): it dims the screen and blocks interaction below the Foreground layer (Memory#mark_modal) while floating as a titled, DRAGGABLE window with a ✕ — the caller keeps the open flag and drops it when this returns true.
Centered on the measured size every frame until the user drags the
window (the very first frame of a session uses a height estimate,
so the card settles once when its content is first measured),
auto-fits its content like #window without a resize grip (dialogs
are content-sized), stays on screen (#constrain_floating — the top
never goes above the screen, so a dialog taller than the screen
pins at the top). title: nil drops the title bar down to a slim
drag handle.
Returns true the frame the user asked to close it: the ✕, the
scrim (when close_on_scrim:, the dimmed area IS the dismiss
target) or Escape (close_on_escape:).
Fire action programmatically this frame (what a menu-item click
does): the app's #consume_action handler sees it, wherever the
app polls actions from.
Actions fired this frame (hotkey presses + #fire_action),
oldest first. Read-only view of the frame's action events.
Named font families (upstream FontDefinitions::families): a
family name → font stack registry, so a GROUP of widgets can swap
fonts through the style cascade (font_family key). The backend
registers stacks via Sokol.register_font; two names are
reserved for the built-in slots — "system" → the primary #fonts
(whatever the backend loaded: the system face, a preselected
stack…), "monospace" → #mono_font.
Named font families (upstream FontDefinitions::families): a
family name → font stack registry, so a GROUP of widgets can swap
fonts through the style cascade (font_family key). The backend
registers stacks via Sokol.register_font; two names are
reserved for the built-in slots — "system" → the primary #fonts
(whatever the backend loaded: the system face, a preselected
stack…), "monospace" → #mono_font.
The catalog of family names a font_family style key can be set
to: every registered named stack, every deferred (not yet
materialized) family, plus the reserved "system" (the primary —
always resolvable, whatever the backend loaded) and "monospace"
(resolvable even when no mono stack is installed — it degrades
to the primary). Sorted; what a font picker offers. "unset the
key" is how a picker returns to the theme slot
(Style#font_family, nil by default → the primary).
The stack builder for #deferred_font_paths — the backend's from_system chain, installed at on_init. Nil headless: a deferred family degrades to the primary stack there.
The stack builder for #deferred_font_paths — the backend's from_system chain, installed at on_init. Nil headless: a deferred family degrades to the primary stack there.
Draw-side twin of #register_deferred_font, installed by the backend at on_init: a deferred family must be resolvable when a TextCmd NAMES it, and the measure side (#fonts_for) alone doesn't register anything the backend knows. Cut stacks created lazily by #fonts_for_weight go through here too.
Draw-side twin of #register_deferred_font, installed by the backend at on_init: a deferred family must be resolvable when a TextCmd NAMES it, and the measure side (#fonts_for) alone doesn't register anything the backend knows. Cut stacks created lazily by #fonts_for_weight go through here too.
The weight axis a family REALLY has on this system — the distinct roman cuts of its installed files (Thin 100 … Black 900), empty for unknown families and the mono slot. This is what the inspector's smart weight selector offers.
The stack a family-tagged text measures/draws through: nil or
an unknown name → the primary #fonts (a typo degrades to the
default, CSS vibes), "system" → the primary, "monospace" →
#mono_font. A deferred family materializes HERE — the first
resolution parses the files, swaps the placeholder out of
#deferred_font_paths and never pays again.
bold/italic shift the PRIMARY resolution to a real variant
face when one is installed (#bold_fonts & co — the measure-side
twin of the backend's #fonts_for_cmd); a missing variant degrades
to the nearest real face (bold+italic → bold → base), headless
Contexts included: #fonts serves everything there.
Resolve (family, weight, bold) to what a widget lays out and draws its base text through — a REAL cut face when the family has one for the target weight, else the family's own stack with a bold flag (the primary's variant faces pick that up; a family without variants degrades to its regular face, no emulation). Returns {fonts, family-for-commands, bold-flag}.
The target: the cascade weight when one is set (the inspector / class-rule value beats a .bold RichText), else the CSS bold slot 700 for bold markup, else 400. A target that lands on the family's own regular file never substitutes — the curated primary stack keeps serving unstyled text.
egui CacheStorage-lite: memoize an expensive computation for the current frame only (cleared in begin_frame).
A HotkeyEdit is capturing the next key press: pause global hotkey dispatch for the next frame so the combo being recorded cannot trigger an action. Called every frame while capturing.
The app-global hotkey → action bindings (see hotkeys.cr).
Actions fired this frame (key press or #fire_action) live for
exactly one frame and are claimed with #consume_action.
Runtime per-element style overrides (the inspector's Element
tab). The top layer of the cascade — see Widget#effective_style.
The per-element override bag for state: base keys with the
state overlay merged on top (a fresh copy — safe to mutate).
Nil when the id has no overrides at all.
True while the frame is being built (begin_frame…end_frame). The reactive layer uses it to skip pointless repaint requests for signal writes made during update.
The inspector state (built on first enable — zero cost while
off). The backend drives its frame hooks; see inspector.cr.
Enable/disable the inspector at runtime (Sokol.run(…, inspector: :on) flips this on before the first frame).
egui Context::load_texture: decode an image file and cache it
per path; 0 means "couldn't load".
egui modal (containers/modal.rs): dims the screen and blocks all interaction below the Foreground layer (Memory#mark_modal).
Windows 11 CONTENT-dialog look (no caption bar, no close button —
like the Settings/Explorer dialogs), TWO zones: the h1 title and
the caller's content as ONE block on the plain window fill, and a
raised footer band at most a quarter of the dialog tall carrying
the buttons as an equal-width stretched row. Returns the label of
the footer button clicked this frame (nil otherwise); title:
nil skips the h1, an empty buttons array skips the footer.
on_scrim_click: fires on a click on the dimmed area OUTSIDE the
card (modal pages use it as their "back" — the scrim IS the back
button; the card's own widgets are hit-tested above it).
The font stack mono text measures/draws through: #mono_fonts when the backend installed one, #fonts otherwise.
The monospace font stack (terminal grids, code) — nil means "same
as #fonts". The backend installs a second stack via
Sokol.select_fonts(font, mono:); widgets that need mono METRICS
read #mono_font, never this nullable property.
The monospace font stack (terminal grids, code) — nil means "same
as #fonts". The backend installs a second stack via
Sokol.select_fonts(font, mono:); widgets that need mono METRICS
read #mono_font, never this nullable property.
A full-window page below the caption (see Egui::Page). The
app owns navigation — this only renders the page it is asked
for. title: draws the header title; on_back: arms the round
back button and fires the callback on click. The page bites the
whole remainder, like any other panel — but only AFTER the
deferred central panel registered inside it is flushed, so a
page containing ctx-level panels behaves like a frame of its own.
Framebuffer pixels per UI point (retina: 2.0), set by the backend each frame — 1.0 headless. Raster caches (Svg textures, like the font atlas) bake at this scale so a 2x display gets 2x-texel rasters, not upscaled blur.
Framebuffer pixels per UI point (retina: 2.0), set by the backend each frame — 1.0 headless. Raster caches (Svg textures, like the font atlas) bake at this scale so a 2x display gets 2x-texel rasters, not upscaled blur.
Did the app open a popup this frame (its own context menu)? The inspector pick menu yields to app menus. Internal.
egui repaint scheduling: an immediate request buys two repaints so frame-delayed responses settle. The backend honors this — on an idle frame (no events, no request, nothing animating) it skips app.update/tessellation and re-emits the last paint commands.
The app's route stack (see Egui::Router). Lazy: apps that never
call #routes never allocate one.
Declare this frame's pages and render the current route stack
when the block ends (see Egui::Router):
ctx.routes do |r| r.page "root/root" { |ui| … } r.modal "root/confirm", title: "Sure?" { |ui| … } end
egui Context::set_cursor_icon: a widget requests the cursor
while hovered/dragged; the backend reads #cursor_icon after
end_frame.
egui Context::set_cursor_image: display this RGBA bitmap as the
OS cursor for the frame, instead of the standard #cursor_icon —
the CSS cursor: url(…) equivalent. Backends without
bitmap-cursor support silently fall back to the icon. Pass nil to
clear. Reset each begin_frame.
Set one per-element style key (inspector Element tab), optionally scoped to an interaction state ("hover"/"active"; nil = base — applies to every state unless the same layer defines a state value, CSS inline-style semantics). Applies on the next frame — immediate mode needs no apply step.
The active global theme. Widgets read its #style every frame, so
assigning a new theme (ctx.theme = Theme.light) restyles the
entire UI on the very next frame — an instant swap.
Instant theme swap (see #theme) — takes effect next frame. Idempotent: assigning the theme already in place (compared by name) is a no-op and does not request a repaint, so an app may re-assign unconditionally every frame.
height pins the strip height (nil → #default_strip_height); the client-side window frame uses it for its caption. resizable (default) adds the drag grip on the inner edge — the size persists across frames and restarts-of-frame-loop; pass false for fixed chrome strips (the window frame does).
Run the block with widget as the current_widget — the manual
twin of what Ui#add does around widget.ui. Paint-in-place
sites (menu rows, title-bar tab cards) wrap their direct
#interact calls in this so the inspector records meta for them;
with the inspector off it is a plain yield (zero cost).