Expand description
Visual kits (docs/kit.md): what a component looks like, as data from
the theme and drawing handlers, compiled once when the theme is
installed.
egui-pop’s widgets keep the behaviour (clicks, drags, focus, the
keyboard, accessibility) and compute a State; the kit measures and
paints. Every component is described with the same words: per state
(rest, hover, active, focus, selected, disabled) a box
(BoxStyle: fill, border, radius, text colour, indicator), plus a
shape, the name of the handler that draws it (Primitive). A
token is always component.state.term (tab.hover.fill), or
component.term for what does not change with the state
(tab.shape, tab.padding-x).
Nothing is resolved while drawing: install compiles the theme into
a Kit of plain values, with every combination of states merged
ahead (32 boxes per component), and the handlers picked by name.
Drawing reads fields and makes one call per part.
The default look is a kit like any other: the tab.* tokens of the
built-in pop-dark theme, which every theme extends, drawn by the
handlers shipped here (box, underline). An application adds its
own handlers with register_tab_shape before installing a theme
that names them.
Structs§
- Area
Line Kit - The line between two areas while hovered or focused (
hover) and while dragged (active), fromside-area.hover.border-width,side-area.hover.border-colorand theiractivetwins. A state whose tokens say nothing is drawn with egui’s widget stroke, as before the tokens existed (Kit::area_line_stroke). The guide shown while a side area’s line is dragged far enough to fold the area on release (fold) takesside-area.fold.border-widthandborder-color(Kit::fold_guide_stroke). - BoxStyle
- What a part looks like in one state.
- Component
- A component’s data and the handler that draws it.
- Component
Kit - The data of a component: its boxes per state, and what does not change with the state.
- Drag
Cursor Kit - The drag cursors of a kit, by kind.
- Fold
Guide - The fold guide’s terms, from
side-area.fold.border-widthandside-area.fold.border-color: each one the theme leaves out keeps egui_stack’s guide stroke (LayoutStyle::snap_guide). - Glyphs
- The icon of each role, compiled from the kit’s tokens: read by index while drawing.
- Kit
- A compiled kit: every component egui-pop draws through one.
- KitCx
- What a handler paints with.
- KitSource
- A kit to install: its data and its handlers.
- Kits
- The kits installed, one per egui theme (the same one twice for a theme alone).
- Part
- What a part is asked to paint.
- Scoped
Kit - The scoped visuals of every
Stockkind, per tone (one entry for a component whose tokens give no tone), compiled with the kit. - Scoped
Visuals - egui’s visuals for a component in one tone, compiled with the kit.
ScopedVisuals::applywrites them into a scope’s [Visuals]; a field leftNonekeeps egui’s value. - Scroll
BarKit - The scroll bars’ terms of a kit.
- Sections
Kit - The sections’ terms of a kit beside their components’ boxes.
- Shapes
- The handlers a kit’s
shapetokens can name, per component. - State
- The states a part can be in, combined (a selected tab under the
pointer is
SELECTED | HOVER). No flag is the resting state. - States
- A component’s boxes for every combination of states, merged when the
kit is compiled, and per tone when its tokens give tones
(
Tone,kit/tone.rs). - Window
Edge Kit - The rest of a window’s edge, beside
WindowKit::outline: the line while another window has the focus and the corners rounded while the window floats free. - Window
Kit - The window’s terms of a kit.
Enums§
- Align
- Where a label goes along its part.
- Area
Line State - The line between two areas in one state.
- Buttons
Hover - Which window buttons are drawn
hover(title-bar.buttons-hover). - Buttons
Side - Where the window buttons go on the title bar (
title-bar.buttons-side). - Corners
- Which corners of a box are rounded.
- Count
Placement - Where a section’s count goes on its band (
section-count.placement). - Glyph
- What a small mark means. The vocabulary is fixed: a widget needing a new mark adds a role here, never a shape of its own.
- Placement
- Where a scroll bar goes (
scroll-bar.placement). - Side
- A side of a box.
- Stock
- The egui widgets a kit restyles in a scope, each through a component
of the kit (the
scopedmapping of its boxes). - Tone
- What a part says, the same names for every component.
Neutralis the component’s own box (no tone); the others are read fromcomponent.tone.<name>, their defaults aliasing the system’s status tokens (accent.default,info,success,warning,danger,text.muted;recordaliasesdangertoo). Serialized by its token name ("danger"). - Visibility
- When a scroll bar shows (
scroll-bar.visibility). - Window
Corners - The corners asked of the system for a window drawn by the application
(
window.corners), where it can round them (Windows 11).
Constants§
- COMPONENTS
- The components a kit has (their token name), with the handler drawn when a theme names none it knows.
Traits§
- Primitive
- A component’s drawing handler. Every component’s handlers have this
shape;
Dis the component’s data.
Functions§
- install
- Compiles the kit of
tokenswith the registered handlers and installs it for both of egui’s themes. - install_
variants - Compiles the kits of a dark and a light theme (one kit when they are
the same set) and installs them. Called by
theme::install_variants, between frames. - label_
rect - Where a label of
sizegoes in a part: along it by the component’salign, inside its room less the padding, centred across; on whole physical pixels is the painter’s business. - paint_
box - Paints a box: its fill and border with
cornersrounded by its radius, and its indicator onside. Strokes are whole physical pixels. - paint_
indicator - paint_
label - Paints a part’s label where
label_rectputs it, in its state’stext, on whole physical pixels. What handlers do unless they draw labels their own way. - paint_
ring - Paints a box’s focus ring, if its state gives one: an outline
ring_offsetoutside the box, following its corners. Every handler calls it last, so the ring is above the box and its label. - register_
shape - Registers a handler for a component (one of
COMPONENTS) under a name itsshapetoken can give. In use from the next theme install. - register_
tab_ shape - Registers a tab handler (
register_shapefortab).