Expand description
Platform-independent core of the Nifty runtime: a retained tree of native widgets with
flexbox layout, and the engine that keeps an app’s windows in step with its state. Each
platform crate implements Backend with that OS’s widgets.
Modules§
- backend 🔒
- The contract each platform (
AppKit,Win32,GTK) implements with its own native widgets. - coded 🔒
- Enums compiled apps store by number.
- dialog 🔒
- File dialogs, shared by the interpreter and compiled apps. Code asks for one during an event; it is shown once the event has finished and the UI caught up, and the user’s answer comes back through the app’s waker, like a download’s reports.
- download 🔒
- What a
download(…)call can bind, shared by the checker, which reads the call, and everything that runs it. - failure 🔒
- Why running an app’s code can fail. The interpreter and compiled apps both report these, so an app fails the same way however it runs.
- geometry 🔒
- Geometry in logical points, origin top-left, y growing downward.
- layout 🔒
- Flexbox layout over native widgets: Taffy computes frames, the caller applies them.
- menu 🔒
- Menus and the keyboard shortcuts of their items, which every platform builds with its own menus.
- path 🔒
- Paths into a value, shared by the interpreter’s and compiled apps’ places.
- paths 🔒
- Paths as apps write them, shared by downloads and file dialogs.
- reactive 🔒
- Shows an app’s windows from templates and keeps them in step with its state.
- state 🔒
- Which app state a part of the UI reads, so it can be shown again when that state changes.
- style 🔒
- Appearance options shared by every backend.
- ui 🔒
- The retained UI that apps drive: create native widgets, arrange them, update them.
Changes are laid out together when
Ui::flushruns, once per event.
Structs§
- AppTemplate
- Everything an app shows: its windows, and the menus of its menu bar.
- Dialogs
- The dialogs an app has asked for, and the answers that have come back.
Tsays where each answer goes, in whatever terms the app uses. - Engine
- A running app: its logic, its windows, and what each widget shows.
- File
Dialog - A dialog as the platform shows it.
- Frame
- Image
Size - The size an image is shown at: a fixed
widthorheightin points, orImageSize::FITfor the image’s own. Fixing only one keeps the image’s shape.repr(C)because compiled apps store it as is. - Label
Style repr(C)because compiled apps store it as is.- Menu
- A menu: its title, and its entries in order.
Ais what an item does: an action the app runs, or, as backends receive it, the number of the item. - MenuBar
- The app’s menus, whose items run their actions with
frameas their locals. - NoHome
Folder - Node
- A widget, stack or spacer inside one window.
- Point
- Position
- Where a new node goes: at
indexamong the children ofparent. - Shortcut
- A keyboard shortcut: the platform’s command key, Cmd on macOS and Ctrl on Windows,
with
key, and Shift or Alt (Option on macOS) when set.repr(C)because compiled apps store it as is. - Shown
- Part of what a region shows:
templates, withframeas their locals. - Size
- Stack
Style repr(C)because compiled apps store it as is.- StateId
- One
statedeclaration of the app, numbered in the order they are declared. - State
Set - States read by a dynamic part of the UI, sorted and without duplicates.
- Ui
- A shared handle to the app’s windows; clones refer to the same UI.
- Window
Id - Window
Request - A request for the app’s window at
window, its position among the app’s windows. - Window
Template - A window and the column it shows its content in.
Enums§
- Align
- Placement of children across a stack’s axis.
- Axis
- Backdrop
- What a window is drawn on, in each platform’s own materials.
- Button
Style - Dialog
Kind - What a dialog asks the user to pick. Compiled code passes it to the runtime as a
u32, which every platform’s C calling convention passes without widening. - Download
Command - What code asks of a running download, by its id.
repr(u32)because compiled apps pass it to the runtime, which every platform’s C calling convention passes without widening. - Download
Field - A piece of state a download reports into. Compiled apps pass it to the runtime by its code.
- Failure
- Icon
- Symbols from the platform’s own icon set: SF Symbols on macOS, Segoe Fluent Icons on Windows. Nothing is bundled with the app.
- Justify
- Distribution of children along a stack’s axis.
- Key
- A key a shortcut presses with the platform’s command key.
- Menu
Entry - Parent
- Where a new widget goes: straight into a window’s content area, or into the content of a scroll area, which scrolls with it. Frames are relative to that parent’s content.
- Picked
- How a dialog closed.
- Shortcut
Error - Why a shortcut can’t be read.
- Step
- One step from a value into part of it: a struct’s field, or a list’s item, by position.
- Surface
- What a stack is drawn on. Each surface is one native view behind the stack’s children, using the platform’s own materials and colors.
- System
Command - The commands the system’s own menus and text fields take shortcuts for, which an app’s menus leave alone.
- Template
- One element of a window’s UI, before it is shown.
- Text
Align - Placement of text within its frame.
- Text
Color - Semantic text colors, so text follows the system appearance and accent color.
- Text
Style - The platform’s system text styles, so apps follow the system font and accessibility sizes.
- Toggle
Style - How a control that turns a
boolon and off looks. - Widget
- Window
Action - What code asks of a window.
repr(u32)because compiled apps pass it to the runtime, which every platform’s C calling convention passes without widening.
Constants§
- ALT
- MAX_
CALL_ DEPTH - How deeply functions may call each other before the app stops with an error. The interpreter takes roughly 10 KB of native stack per call in debug builds, so this stops runaway recursion well before a 2 MB thread stack overflows.
- SHIFT
- The modifiers a shortcut may add to the command key, as code writes them.
Traits§
- Backend
- Logic
- The program behind an app’s UI. Templates hold its handles to values, bindings, actions and regions, and the engine asks it to evaluate them against a frame of locals.
- Show
Dialog - Shows file dialogs; every
Backendis one, so code that isn’t generic over the backend can hold it asRc<dyn ShowDialog>. - Waker
- Asks the UI thread to run its wake handler; see
Backend::waker.
Functions§
- expand_
home pathwith a leading~standing for the user’s home folder.
Type Aliases§
- Click
Handler - Close
Handler - Runs when the user asks to close a window.
- Dialog
Handler - Drop
Handler - Runs with what the user dropped: a path for each file, an address for each link.
- Error
Handler - Menu
Handler - Runs with the number of the menu item the user chose.
- Number
Handler - Resize
Handler - Templates
- Text
Handler - Toggle
Handler - Wake
Handler - Window
Close Handler - Decides what happens when the user asks to close a window.