Repository navigation
CPUI 0.1.0
The first release.
Added
Framework
- Immediate mode. The interface is declared every frame, and a frame is rebuilt until it settles, so what is presented always matches the state.
- Efficient redraws. Nothing is drawn while idle, only changed regions are redrawn, large redraws use several threads, and a stable frame allocates no memory.
- Windows and applications. Window options, full screen, window icons, several windows per application, wake-ups from background threads, close confirmation and system file dialogs on macOS, Windows and Linux.
- Offscreen rendering for tests and screenshots through
Offscreen.
Layout
- Rows, columns and stacks whose children fit their content, fill the remaining space or take a fixed size, with minimum and maximum sizes and aspect ratios.
- Alignment along and across the main axis, including baselines and even spacing; per-child alignment, layout priority and offset; separate horizontal and vertical gaps.
- Wrapping flows, adaptive and fixed-column grids with spans, layouts chosen by available width, overlays, scrolling in either direction, virtual lists and resizable panes.
Widgets
- Text and display: text, headings and titles; icons (290 built in, in 17 categories) and images; avatars and avatar groups; badges, alerts, key hints, skeletons, spinners, progress bars and empty states.
- Inputs: buttons in six variants and three sizes; text inputs (single-line, multi-line, password, read-only, with icons and a clear button); number inputs; checkboxes with an indeterminate state; radio buttons; switches; toggles and toggle groups; sliders and range sliders; color pickers; selects and comboboxes with single or multiple selection; calendars and date pickers for single days or ranges.
- Navigation: tabs in two variants, sidebar items, collapsible sections and accordions.
- Forms: fields with a label, description and error, and forms that align their labels.
- Data: tables with sorting, multiple selection and resizable columns; trees; virtual lists.
- Overlays and menus: popovers, dialogs, sheets, drawers, alert dialogs, dropdown menus, context menus, a menu bar, tooltips, and toasts at any of six positions.
- Custom drawing: canvases and custom-drawn areas.
Text
- Line breaking for Chinese, Japanese and Korean with punctuation rules, and by word for Thai, Lao, Khmer and Myanmar behind the
word-breakfeature. - Shaping and bidirectional layout for Arabic, Hebrew and similar scripts; kerning and ligatures for Latin, Greek and Cyrillic, with ligatures disabled in monospaced text.
- Emoji, nine font weights from thin to black, and automatic fallback to system fonts for characters the configured fonts lack. On Linux, fonts are found through fontconfig.
- Truncation, selection, the clipboard and input methods, with touch selection handles and an edit menu on phones.
Fonts
Options::fontandOptions::mono_fontadd fonts by name, file, bytes or generic family ahead of the system fonts.Options::fontstakes a completeFontSet, including the language used for Han glyph forms (cjk_language) and additionalFontStacks for other kinds of text.- Text widgets choose a font kind with
.fontand a weight with.font_weightor.font_thinto.font_black. AFontdraws and measures text in aPainterorFrame. installed_fontslists the installed families, andOutlineFontsprovides glyph outlines.
Input
- Mouse, wheel, and touch with inertia and long press; keyboard focus and navigation; dropped files.
- Actions with user-configurable keymaps.
Themes
- Light and dark themes built from design tokens, following the system appearance as it changes, including through the XDG desktop portal on Linux.
- Custom themes, five gray families (
BaseColor), accent color, font size, radius and compact density. - A shared control height, row height, radius and focus ring for every widget, with transitions for hover, focus, state and theme changes.
Accessibility
- Roles, names and states for every widget through AccessKit, and actions from assistive technology: clicking, focusing and setting values.
aria_labelandaltset names. - Arrow-key navigation within radio and toggle groups, each a single Tab stop. Focus returns to the trigger when a dialog or sheet closes.
Internationalization
- The framework's own text comes from a
Locale, with English, Simplified Chinese, Traditional Chinese, Japanese and Korean built in.Locale::for_languageandLocale::systemselect one by language tag or system language, andpreferred_languagesreturns the user's languages. - Application text is translated with Fluent files behind the
i18nfeature.Translationsinstalls them in the user's language,t!looks up messages with arguments and plural forms,Ui::set_languageswitches languages at runtime, andTranslations::checkreports missing or inconsistent messages. Messages without arguments do not allocate.
Custom widgets
- A canvas can take keyboard focus and keys (
focusable,keys,Ui::key_pressed_on) and describe itself to assistive technology (aria_role,aria_value,aria_range, also available on anyElement). Element::withlets widget libraries add chained settings,Ui::tooltipshows a tooltip that follows the pointer, andStyle::focus_ring,Style::itemandStyle::dimmedprovide the built-in looks.
Icons
cpui-icons, a crate with no dependencies that supportsno_std: 290 line icons on a 24 × 24 grid asShapes (lines, circles and arcs), each with a name, search keywords and aCategory, and, with thestdfeature, SVG output. CPUI re-exportsIconNameandIconCategoryand draws the icons from them.
Images and dates
Bitmap::from_pngandBitmap::from_jpeg, behind thepngandjpegfeatures.Date, a calendar day without a time or time zone.
Rendering (cpui-render)
- Monospaced cell drawing for terminals and editors:
Frame::cell_char,cell_text,cell_sequenceandcell_ligatures, withclustersreturningTextClusters and the number of cells each needs. - Window background images through
WallpaperandRenderer::set_wallpaper. - Effects:
Frame::captureto restore or blend drawn pixels,with_fade,checkerfor transparency backdrops,Renderer::set_zoom, anddraw_transparentfor icons with alpha. FontSystemloads fonts and measures text independently of any window, and can be shared between renderers.
Platforms
- macOS, Windows and Linux.
- Experimental iOS and Android support, including input methods and system insets, with Xcode and Gradle projects to copy for packaging.
Documentation
- Guides in English and Chinese, published at cpui.io, and a runnable example for every public item.