Skip to main content

Ui

Struct Ui 

Source
pub struct Ui {
    pub desc: AppDesc,
    pub style: &'static dyn Style,
    pub text: Text,
    pub dc: Dc,
    /* private fields */
}
Expand description

the UI context: everything ASMLIB keeps in g_* variables

Fields§

§desc: AppDesc§style: &'static dyn Style§text: Text

fonts, glyph cache, text runs (shared: the asm’s font module)

§dc: Dc

the gfx draw context (the asm’s g_dc; render time only)

Implementations§

Source§

impl Ui

Source

pub fn a11y_tree(&self) -> Snapshot

The accessibility tree of the last pass as assistive technology gets it (screen readers through AT-SPI2 / UI Automation): every shown window with its nodes (roles, names, states, values, rectangles), built from the semantic records (see sem()).

Source

pub fn a11y_value(&mut self, id: u32) -> Option<i32>

A value a screen reader set for slider-like widget id (its record’s value scale), taken once: the built-in sliders apply it themselves; a widget of its own applies it like keyboard input (clamped) in the pass it is built.

Source

pub fn a11y_text(&mut self, id: u32) -> Option<String>

A text a screen reader set for text widget id, taken once (the built-in text boxes apply it themselves).

Source§

impl Ui

Source

pub fn dump(&mut self, path: Option<&[u8]>)

ui_dump(path): JSON lines – a header, one line per shown secondary window, then one line per semantic record (None = stdout)

Source§

impl Ui

Source

pub fn agent_enabled(&self) -> bool

Whether external control was explicitly activated. No endpoint opens by reading this.

Source

pub fn agent_connected(&self) -> bool

Whether the active control session has received a client request.

Source

pub fn set_agent_enabled(&mut self, enabled: bool)

Enable or revoke external control. Revocation also discards screenshot resources.

Source§

impl Ui

Source

pub fn hair(&self) -> i32

ui_hair: max(1, (dpi + 24) / 96)

Source

pub fn focus_ring_draw(&mut self, ev: u32)

ui_focus_ring_draw(ev): the style’s focus visual around last_rect when it is shown (ev: the widget’s events; custom widgets built on hit_rect / behave call it last)

Source

pub fn text(&mut self, style: u32, s: &str)

ui_text(style, s): a text in a text style (TS_* | TX_*)

Source

pub fn heading(&mut self, level: u32, style: u32, s: &str)

A section title: text(style, s) that screen readers know as a heading of level (1 the top level ..= 9; record K_HEADING, value: the level) – their heading navigation finds it.

Source

pub fn button(&mut self, id: u32, label: &str) -> u32

ui_button(id, label) -> EV_* (EV_ACT on click)

Source

pub fn label_button( &mut self, id: u32, label: &str, typography: u32, inset: i32, ) -> u32

A focusable text action with explicit TS_/TX_ typography and horizontal inset in DIP. Uses the style’s button surface and ordinary button semantics. Long labels are ellipsized visually; accessibility and agent inspection retain the full label.

A hyperlink-style text action: accent-coloured text (T_ACCENT_TEXT), underlined while the pointer is over it, hand cursor, focus ring, no button surface. TS_/TX_ typography as in text(); a narrower slot than the text ellipsizes it.

Source

pub fn accent_button(&mut self, id: u32, label: &str) -> u32

ui_accent_button(id, label) -> EV_*: the accent (primary) button

Source

pub fn icon_button(&mut self, id: u32, icon: u32, label: &str) -> u32

ui_icon_button(id, icon, label) -> EV_*: subtle toolbar button

Source

pub fn toggle_button(&mut self, id: u32, label: &str, v: &mut i32) -> u32

ui_toggle_button(id, label, &mut v) -> EV_*: checked look while v != 0; toggles v

Source

pub fn tool_button( &mut self, id: u32, icon: u32, label: &str, sel: &mut i32, mine: i32, ) -> u32

ui_tool_button(id, icon, label, &mut sel, mine) -> EV_*: subtle icon button, checked when sel == mine; the tool buttons of one variable are one Tab stop (arrows inside)

Source

pub fn checkbox(&mut self, id: u32, label: &str, v: &mut i32) -> u32

ui_checkbox(id, label, &mut v) -> EV_*: v 0, 1, 2 = indeterminate (Space toggles, Enter is the dialog’s)

Source

pub fn checkbox_wrap(&mut self, id: u32, label: &str, v: &mut i32) -> u32

ui_checkbox_wrap(id, label, &mut v) -> EV_*: a check box for a text that may be long: the mark, beside it the label wrapped at the width the layout gives (next_size(-1, 0)); a click on the text toggles too; the record is the check box’s, named by the text

Source

pub fn radio_wrap( &mut self, id: u32, label: &str, v: &mut i32, mine: i32, ) -> u32

ui_radio_wrap(id, label, &mut v, mine) -> EV_*: a radio for a text that may be long, as checkbox_wrap

Source

pub fn radio(&mut self, id: u32, label: &str, v: &mut i32, mine: i32) -> u32

ui_radio(id, label, &mut v, mine) -> EV_*: v = mine when clicked; the radios of one variable are one Tab stop, the arrows select inside (kbnav.rs)

Source

pub fn switch(&mut self, id: u32, label: &str, v: &mut i32) -> u32

ui_switch(id, label, &mut v) -> EV_*: toggle switch

Source

pub fn slider(&mut self, id: u32, v: &mut i32, rg: &Range) -> u32

ui_slider(id, &mut v, &range) -> EV_*: EV_ACT while the value changes, EV_COMMIT on release

Source

pub fn progress(&mut self, id: u32, v: i32, max: i32)

ui_progress(id, v, max): progress bar

Source

pub fn separator(&mut self)

ui_separator: divider across the current box (the style draws it)

Source

pub fn icon(&mut self, cp: u32, size: i32)

ui_icon(cp, size_dip): an icon in the text colour

Source

pub fn image(&mut self, id: u32, sf: &Rc<Surface>, ver: u32) -> u32

ui_image(id, sf, ver) -> EV_* (clickable when id != 0): a surface at its natural size (or next_size); ver stands for its SF_AUX version

Source

pub fn canvas( &mut self, id: u32, draw: Option<DrawRef>, user: usize, version: u32, ) -> &UiInput

ui_canvas(id, draw, user, version) -> &UiInput: a custom area. The hit box wants every pointer move; the cursor comes from next_flags bits 12..15 (CUR_* << HB_CURSOR_SHIFT), default crosshair.

Source§

impl Ui

Source

pub fn sparkline(&mut self, id: u32, values: &[f32], color: u32)

ui_sparkline(id, values, color): area + line over the values (min .. max scaled)

Source

pub fn bar_chart( &mut self, id: u32, labels: &[&str], series: &[BarSeries<'_>], stacked: bool, ) -> i32

ui_bar_chart(id, labels, series, stacked) -> the hovered column (-1 = none)

Source

pub fn donut( &mut self, id: u32, slices: &[DonutSlice<'_>], center: &str, sub: &str, )

ui_donut(id, slices, center, sub): ring of slices (fractions of their sum) with a centre text (TS_SUBTITLE; TS_BODY_STRONG where that is wider than the hole) and a caption below it (left out where the hole is too low for both)

Source

pub fn legend(&mut self, items: &[(&str, u32)])

ui_legend(items): a colour dot and a label per item (colour 0 = palette by index), laid out in a wrapping row; an item wider than the row has its label cut with “…”

Source

pub fn line_chart(&mut self, id: u32, c: &LineChart<'_>) -> Option<(usize, f64)>

ui_line_chart(id, chart) -> the hovered series and the x it snapped to: series over time (or plain numbers) with axes, grid, legend, markers, thresholds and a hover card (see the module header of chart.rs)

Source§

impl Ui

Source

pub fn dialog_begin(&mut self, id: u32, title: &str, open: &Shared<i32>) -> bool

ui_dialog_begin(id, title, open) -> true if the dialog is open

Source

pub fn dialog_buttons( &mut self, primary: Option<&str>, secondary: Option<&str>, close: Option<&str>, ) -> u32

ui_dialog_buttons(primary, secondary, close) -> DLG_* (any result clears the open flag). Inside a content dialog: its footer. Otherwise, inside a WF_DIALOG window: a footer pinned to the window’s bottom; a result clears the window’s open flag.

Source

pub fn dialog_end(&mut self)

ui_dialog_end

Source

pub fn infobar(&mut self, id: u32, severity: u32, title: &str, msg: &str) -> u32

ui_infobar(id, severity, title, msg) -> EV (EV_ACT when the close button was clicked)

Source

pub fn statusbar_begin(&mut self)

ui_statusbar_begin: a 32 DIP bar; call it last in a vertical layout (after a fill)

Source

pub fn statusbar_end(&mut self)

ui_statusbar_end

Source

pub fn titlebar_begin(&mut self, title: &str, icon: u32)

ui_titlebar_begin(title, icon): a title bar row (icon 0 = none)

Source

pub fn titlebar_begin_opt(&mut self, title: Option<&str>, icon: u32)

ui_titlebar_begin with title 0: no title text (the record has no label) // pn-core

Source

pub fn titlebar_begin_overlay(&mut self, title: Option<&str>, icon: u32)

Overlay native window controls and a drag region without painting a titlebar surface. Use next_rect_px to place it over the empty top edge of a file/start screen. The agent indicator remains visible beside the caption buttons when control is enabled.

Source

pub fn titlebar_end(&mut self)

ui_titlebar_end: caption buttons at the right end (unless the style puts them at the left: SM_CAP_LEFT)

Source

pub fn titlebar_open(&self) -> Option<([i32; 4], bool)>

The title bar being built, between titlebar_begin and titlebar_end (None elsewhere and on an overlay, which paints no bar): its rectangle (px) and whether the window is active. For a style whose bar has the same colours in every theme (classic): a widget drawn right on it cannot use the theme’s T_TEXT.

Source§

impl Ui

Source

pub fn clip_set_image(&mut self, sf: &Surface) -> i32

ui_clip_set_image(sf) -> 0 / -1: sf as CLIP_IMAGE (PNG level 1 + BMP)

Source

pub fn clip_get_image(&mut self) -> Result<Surface, i32>

ui_clip_get_image -> the clipboard image in a new FMT_ARGB surface, or ERR_* (-1 = no image)

Source§

impl Ui

Source

pub fn cmd_layer(&mut self, l: u32) -> u32

cmd_layer(l) -> previous layer

Source

pub fn draw_color(&mut self, argb: u32)

ui_draw_color(argb): colour for the following draw_* calls

Source

pub fn draw_color_get(&self) -> u32

the colour of the following draw_* calls (g_dcol)

Source

pub fn draw_rect(&mut self, x: i32, y: i32, w: i32, h: i32)

ui_draw_rect(x, y, w, h)

Source

pub fn draw_rrect(&mut self, x: i32, y: i32, w: i32, h: i32, r: i32)

ui_draw_rrect(x, y, w, h, r): filled rounded rectangle in the draw colour

Source

pub fn draw_frame(&mut self, x: i32, y: i32, w: i32, h: i32, r: i32, t: i32)

ui_draw_frame(x, y, w, h, r, t): border only, in the draw colour

Source

pub fn cmd_rrect( &mut self, x: i32, y: i32, w: i32, h: i32, r: i32, t: i32, fill: u32, stroke: u32, stroke2: u32, )

cmd_rrect(x, y, w, h, r, t, fill, stroke, stroke2): rounded rectangle with an optional fill and border (stroke2: the bottom edge)

Source

pub fn cmd_panel_fx( &mut self, x: i32, y: i32, w: i32, h: i32, r: i32, t: i32, fill: u32, stroke: u32, )

Rounded fill/border with 24.8 pixel geometry and a single coverage composite. Fractional bounds participate in dirty-region hashing and clipping.

Source

pub fn draw_text(&mut self, x: i32, y: i32, s: &str, font_size: u32)

ui_draw_text(x, y, s, font_size): font_size = FONT_* | size_fx << 8

Source

pub fn cmd_text( &mut self, x: i32, y: i32, s: &[u8], font: u32, size: i32, c: u32, maxw: i32, )

cmd_text(x, y, s, font, size_fx, colour, maxw): at most 4000 bytes, never cut inside a UTF-8 sequence

Source

pub fn emit_text(&mut self, x: i32, y: i32, s: &str, c: u32)

emit_text(x, baseline, s, colour): text in the current text font (styles)

Source

pub fn draw_icon(&mut self, cp: u32, x: i32, y: i32, size: i32)

ui_draw_icon(cp, x, y, size_fx)

Source

pub fn draw_circle(&mut self, x: i32, y: i32, r: i32, t: i32)

ui_draw_circle(cx, cy, r, t): 24.8 fixed, t = 0 fills

Source

pub fn draw_line(&mut self, x0: i32, y0: i32, x1: i32, y1: i32, w: i32)

ui_draw_line(x0, y0, x1, y1, width): 24.8 fixed

Source

pub fn draw_image( &mut self, sf: &Rc<Surface>, ver: u32, x: i32, y: i32, w: i32, h: i32, )

ui_draw_image(sf, x, y, w, h): w / h 0 = natural size; ver stands for the surface’s SF_AUX version (bump it when the pixels change)

Source

pub fn draw_clip(&mut self, x: i32, y: i32, w: i32, h: i32)

ui_draw_clip(x, y, w, h)

Source

pub fn draw_unclip(&mut self)

ui_draw_unclip

Source

pub fn icon_hook(&mut self, f: Option<IconHook>)

ui_icon_hook(f): an app draws chosen icons itself (None removes the hook)

Source

pub fn cmd_custom( &mut self, x: i32, y: i32, w: i32, h: i32, f: Option<DrawRef>, user: usize, ver: u32, )

cmd_custom(x, y, w, h, f, user, version): f.draw(g, rect) at render time, clipped

Source

pub fn cmd_shadow(&mut self, x: i32, y: i32, w: i32, h: i32, r: i32, depth: i32)

cmd_shadow(x, y, w, h, r, depth): soft shadow in the draw colour

Source§

impl Ui

Source

pub fn swatch(&mut self, id: u32, argb: u32, selected: bool) -> u32

ui_swatch(id, argb, selected) -> EV_*: the swatches of one box are one Tab stop (the selected one; arrows move inside, Space / Enter act, the menu key is a right click); next_flags(ST_NOFOCUS): a picture only, no Tab stop

Source

pub fn color_picker(&mut self, id: u32, argb: &mut u32) -> u32

ui_color_picker(id, &mut argb) -> EV_*

Source

pub fn color_picker_ex(&mut self, id: u32, argb: &mut u32, flags: u32) -> u32

ui_color_picker_ex(id, &mut argb, flags) -> EV_* (CP_ALPHA, CP_FIELDS, CP_PIPETTE)

Source

pub fn color_wheel(&mut self, id: u32, color: &mut [u32], flags: u32) -> u32

ui_color_wheel(id, &mut color, flags) -> EV_*: color = [argb], or [h, s, v] with CW_HSV

Source§

impl Ui

Source

pub fn now(&self) -> u32

ui_now: milliseconds since start (virtual clock in headless runs)

Source

pub fn mods(&self) -> u32

ui_mods: MOD_* bits of the current input

Source

pub fn mouse(&self) -> (i32, i32)

ui_mouse: pointer position in px (-1 when outside)

Source

pub fn pen(&self) -> (u32, u32)

ui_pen: (pressure 0 = none / 1..UI_PRESSURE_ONE, PTR_*) of the last pointer event

Source

pub fn focus(&mut self, id: u32)

ui_focus(id): give the keyboard focus to a widget (focus ring shown). The id is looked up in whichever window emits it in the next pass (that window is activated).

Source

pub fn focus_quiet(&mut self, id: u32)

the keyboard focus to a widget of this window without the focus ring: the keyboard goes back to it after a pointer gesture (a ring only follows keyboard navigation)

Source

pub fn focused(&self) -> u32

ui_focused: id of the focused widget (0 = none)

Source

pub fn key(&mut self, vk: u32) -> bool

ui_key(vk): pressed this frame and not yet consumed (consumes it)

Source

pub fn capture_shortcut(&mut self, vk: u32, mods: u32) -> bool

Capture an exact application shortcut before text widgets handle it. Unlike key(), this bypasses the focused textbox’s key reservation. Use only for an editing surface whose history/commands the application owns, and not while a modal draft dialog owns input. Other shortcuts and the normal key() behavior are unchanged.

Source

pub fn key_peek(&mut self, vk: u32) -> bool

ui_key_peek(vk): pressed this frame and unconsumed (not consumed)

Source

pub fn key_down(&self, vk: u32) -> bool

ui_key_down(vk): held (mods: VK_SHIFT / VK_CONTROL / VK_MENU)

Source

pub fn key_first(&self) -> u32

ui_key_first: the first unconsumed key this frame (VK | mods << 16) or 0

Source

pub fn text_take(&mut self, cap: usize) -> Vec<u32>

ui_text_take(cap): the typed codepoints (at most cap), consumed; when cap leaves some, they come in the next pass (nothing typed is lost)

Source

pub fn hit_flags_at(&mut self, x: i32, y: i32) -> u32

ui_hit_flags_at(x, y): HB_* flags of the topmost hit box at a point of the main window (previous pass) – non-client hit testing of the platform

Source

pub fn hit(&mut self, id: u32, hbflags: u32)

ui_hit(id, hbflags): register last_rect (clipped) as a hit box of the current layer

Source

pub fn behave(&mut self, id: u32, hbflags: u32) -> u32

ui_behave(id, hbflags) -> EV_*: the standard pointer / keyboard behaviour of a widget occupying last_rect

Source

pub fn hit_rect( &mut self, id: u32, x: i32, y: i32, w: i32, h: i32, hbflags: u32, ) -> u32

ui_hit_rect(id, x, y, w, h, hbflags) -> EV_*: behave on an explicit rectangle (px)

Source

pub fn focus_ring(&self, ev: u32) -> bool

ui_focus_ring(ev): the focus visual should be drawn for the widget that just called behave (its events)

Source

pub fn slot(&mut self, id: u32) -> &mut Slot

ui_slot(id): persistent per-id state (created on first use)

Source

pub fn anim(&mut self, id: u32, target: u32, ms: u32) -> u32

ui_anim(id, target, ms) -> current value (0..65535, usually 0..256) moving towards target (ease-out)

Source

pub fn anim_ex(&mut self, id: u32, target: u32, ms: u32, curve: u32) -> u32

anim_ex(id, target, ms, curve) -> current value moving towards target along an EASE_* curve (EASE_OUT_BACK may overshoot; the value stays >= 0)

Source

pub fn anim_color(&mut self, id: u32, argb: u32, ms: u32, curve: u32) -> u32

anim_color(id, argb, ms, curve) -> the colour on its way to argb (a transition: hover fills, state colours); the first call starts at argb

Source

pub fn cmd_run(&mut self, id: u32, arg: u32)

ui_cmd_run(id, arg): queue a command for App::command after this frame (in order)

Source

pub fn timer(&mut self, id: u32, ms: u32)

ui_timer(id, ms): App::command(UIC_TIMER, id) after ms (replaces a timer with the same id)

Source

pub fn last_reset(&mut self)

g_last_rect = 0, g_last_state = 0: the apps’ hidden probe records (PaintCraft’s *_sem helpers zero both before ui_sem; later records of the pass see the zeroes too) // pn-core

Source

pub fn last_set(&mut self, rect: [i32; 4], state: u32)

g_last_rect = rect, g_last_state = state (apps that build a widget from drawing calls set the record’s rectangle and state before ui_sem) // pn-core

Source

pub fn last_state(&self) -> u32

g_last_state: the SS_* state of the last behave // pn-core

Source

pub fn mbtn(&self) -> u32

g_mbtn / g_pressed / g_released: mouse buttons held / pressed / released this frame (bit 1 << BTN_*) // pn-core

Source

pub fn pressed(&self) -> u32

Source

pub fn released(&self) -> u32

Source

pub fn sem( &mut self, kind: u16, id: u32, label: Option<&str>, value: i32, ) -> &mut Sem

ui_sem(kind, id, label, value) -> the record (rect = last_rect, state from the last behave); the label is copied

Source

pub fn clip_push(&mut self, x: i32, y: i32, w: i32, h: i32)

ui_clip_push(x, y, w, h): px; intersects drawing and hit clipping

Source

pub fn clip_pop(&mut self)

ui_clip_pop

Source

pub fn layer_set(&mut self, layer: u32) -> u32

ui_layer_set(layer) -> previous: switch the command layer and hit layer together

Source

pub fn begin_pass(&mut self, w: i32, h: i32)

ui_begin_pass(w, h): start recording a frame for a w x h px window (one window)

Source

pub fn end_pass(&mut self) -> bool

ui_end_pass -> another pass is needed (one window)

Source

pub fn repass(&mut self)

ui_repass: request another pass before this frame is shown

Source

pub fn modal(&mut self, layer: u32)

ui_modal(layer): a modal element (dialog) is open on layer this pass

Source

pub fn modal_active(&self) -> u32

ui_modal_active -> layer of the modal element of the last pass (0 = none)

Source

pub fn disabled_push(&mut self)

ui_disabled_push / ui_disabled_pop: widgets in between are disabled

Source

pub fn disabled_pop(&mut self)

Source

pub fn warn(&mut self, msg: &str)

ui_warn: “UIWARN f: ” on stderr

Source§

impl Ui

Source

pub fn cursor_new(&mut self, f: CursorDraw, w: u32, h: u32, hot: u32) -> u32

ui_cursor_new(f, w, h, hot) -> handle (0 = none)

Source

pub fn cursor_custom(&mut self, h: u32)

ui_cursor_custom(handle): the cursor of CUR_CUSTOM hit boxes

Source

pub fn cursor_current(&self) -> u32

ui_cursor_current -> handle

Source

pub fn cursor_render(&mut self, h: u32, dpi: i32) -> Option<Surface>

ui_cursor_render(handle, dpi) -> the cursor drawn at dpi into a new surface

Source§

impl Ui

Source

pub fn grid_begin( &mut self, id: u32, st: &mut GridState, cols: &[GridCol<'_>], keys: &[u64], ) -> (i32, i32)

ui_grid_begin(id, &mut st, cols, keys) -> (first, end): the rows to emit

Source

pub fn grid_row(&mut self, st: &mut GridState, i: i32) -> u32

ui_grid_row(&mut st, i) -> EV_* of row i (EV_ACT clicked)

Source

pub fn grid_cell(&mut self, st: &GridState, c: usize)

ui_grid_cell(&st, c): the next widget is placed into column c of the current row (inset by the cell padding, full row height)

Source

pub fn grid_text(&mut self, st: &GridState, c: usize, s: &str)

ui_grid_text(&st, c, s): body text in column c (cut with “…”, the column’s alignment)

Source

pub fn grid_text_ts(&mut self, st: &GridState, c: usize, ts: u32, s: &str)

ui_grid_text_ts(&st, c, ts, s): text in column c with a text style (TS_* | TX_*)

Source

pub fn grid_end(&mut self, st: &mut GridState) -> GridEv

ui_grid_end(&mut st) -> GridEv

Source

pub fn tree( &mut self, id: u32, st: &mut TreeState, rows: &[TreeRow<'_>], row_h: i32, ) -> TreeEv

ui_tree(id, &mut st, rows, row_h) -> TreeEv: the visible rows of a tree (row_h DIP, 0 = the grid row height)

Source

pub fn badge(&mut self, kind: u32, label: &str)

ui_badge(kind, label): a status pill (BADGE_*; next_icon puts an icon before the text); placed narrower than the pill (a grid cell), the label is cut with “…”

Source

pub fn status_dot(&mut self, kind: u32)

ui_status_dot(kind): a 10 DIP status dot (BADGE_*)

Source

pub fn meter(&mut self, id: u32, v: i64, max: i64, kind: u32)

ui_meter(id, v, max, kind): a capacity bar (natural 120 x 8 DIP; next_size)

Source§

impl Ui

Source

pub fn time_box(&mut self, id: u32, hour: &mut i32, minute: &mut i32) -> u32

ui_time_box(id, &mut hour, &mut minute) -> EV_* (EV_ACT changed)

Source

pub fn weekday_toggles(&mut self, id: u32, mask: &mut u32) -> u32

ui_weekday_toggles(id, &mut mask) -> EV_* (EV_ACT changed); bit 0 = Monday. The buttons wrap where the row has less room than the seven of them (a narrow card)

Source

pub fn date_picker( &mut self, id: u32, y: &mut i32, m: &mut u32, d: &mut u32, ) -> u32

ui_date_picker(id, &mut y, &mut m, &mut d) -> EV_* (EV_ACT when a day was picked)

Source§

impl Ui

Source

pub fn diagram( &mut self, id: u32, st: &mut DiagramState, m: &DModel<'_>, tool: u32, paint: Option<Rc<dyn DgPaint>>, ver: u32, ) -> Vec<DEv>

ui_diagram(id, st, m, tool, paint, ver) -> what the user did: the node / edge canvas in the next layout slot (see the file header)

Source

pub fn diagram_minimap( &mut self, id: u32, st: &mut DiagramState, m: &DModel<'_>, ) -> bool

ui_diagram_minimap(id, st, m) -> the view moved: an overview of the nodes and the shown part in the bottom right corner of the last diagram (nothing when the canvas is small); pressing or dragging there centres the view on that point

Source

pub fn diagram_sems( &mut self, id: u32, st: &mut DiagramState, m: &DModel<'_>, label: &dyn Fn(u64) -> String, )

ui_diagram_sems(id, st, m, label): one K_LISTITEM record per node the last diagram call showed (label(key), value = the node’s index, selected / focused / hover states), cut to the canvas; a screen reader’s click on one selects it

Source

pub fn diagram_edge_sems( &mut self, id: u32, st: &mut DiagramState, m: &DModel<'_>, label: &dyn Fn(u64) -> String, )

ui_diagram_edge_sems(id, st, m, label): one K_LISTITEM record per edge the last diagram call showed (label(key); value = the edge’s index; selected / focused / hover states), a small box around the middle of its route cut to the canvas, after the nodes’ records; a screen reader’s click on one selects the edge (and focuses it with tab_edges)

Source§

impl Ui

Source

pub fn dirty_force_full(&mut self)

dirty_force_full: the next frame redraws and presents everything

Source

pub fn canvas_damage(&mut self, id: u32, x: i32, y: i32, w: i32, h: i32)

ui_canvas_damage(id, x, y, w, h): redraw part of a canvas with the next render (px relative to the canvas, cut to it)

Source§

impl Ui

Source

pub fn drag_source(&mut self, id: u32, ev: u32) -> u32

drag_source(id, ev) -> DS_START / DS_ACTIVE / DS_END / 0 for the widget id whose behave returned ev: DS_START when a drag of it begins (call drag_set in this pass), DS_ACTIVE while its content is dragged, DS_END once afterwards (drag_effect())

Source

pub fn drag_set(&mut self, data: DragData)

drag_set(data): the content of the drag that starts (after DS_START, same pass)

Source

pub fn drag_out(&mut self, data: DragData) -> bool

drag_out(data) -> started: (the left button held) the platform drags data out of the app right away (DoDragDrop, Xdnd, wl_data_device.start_drag); UIC_DRAG_END at the end

Source

pub fn drag_effect(&self) -> u32

the effect of the app’s last drag: DE_COPY / DE_MOVE / DE_LINK, 0 = cancelled / refused

Source

pub fn dragging(&self) -> bool

one of the app’s drags runs (inside the app or carried by the platform)

Source

pub fn drop_target(&mut self, id: u32, types: u32) -> u32

drop_target(id, types) -> DS_HOVER / DS_DROP / 0: the widget at last_rect takes drags of these DT_* kinds (DT_USER0 << k: the app’s own). DS_HOVER while such a drag is over it (the style draws the highlight), DS_DROP in the pass of the drop (drop_data())

Source

pub fn drop_accept(&mut self, types: u32)

drop_accept(types): the DT_* kinds a window takes outside every drop target (default DT_FILES); those drops arrive as UIC_DROP

Source

pub fn drag_over(&self) -> (u32, i32, i32)

drag_over() -> (DT_* kinds, x, y DIP): the drag over the live window, (0, 0, 0) = none

Source

pub fn drop_effect(&self) -> u32

the effect of the last drop (DE_*)

Source§

impl Ui

Source

pub fn richtext(&mut self, id: u32, doc: &mut RichDoc, flags: u32) -> u32

ui_richtext(id, doc, RT_) -> EV_ (see the module header)

a link the user activated in richtext id (Ctrl+click, a click when read-only, Ctrl+Enter), taken once

open the link flyout of richtext id (as Ctrl+K does): the url of the link at the caret or “https://”; OK sets it on the selection (without one: inserts it as linked text), “Entfernen” removes the link

Source

pub fn richtext_toolbar( &mut self, id: u32, editor: u32, doc: &mut RichDoc, groups: u32, ) -> u32

ui_richtext_toolbar(id, editor, doc, RTB_*) -> EV_ACT when it changed doc (see the module header)

Source§

impl Ui

Source

pub fn markdown_view( &mut self, id: u32, st: &mut MdViewState, text: &str, flags: u32, ) -> MdEv

ui_markdown_view(id, &mut st, text, MV_*) -> MdEv (see the module header of md_view.rs)

Source

pub fn markdown_fit( &mut self, st: &mut MdViewState, text: &str, w_px: i32, flags: u32, ) -> i32

ui_markdown_fit(&mut st, text, w_px, MV_*) -> the height in DIP a view w_px wide needs for the whole text (see the module header)

Source

pub fn html_view( &mut self, id: u32, st: &mut MdViewState, html: &str, flags: u32, ) -> MdEv

ui_html_view(id, &mut st, html, MV_*) -> MdEv: the HTML counterpart of markdown_view

Source

pub fn doc_view(&mut self, id: u32, st: &mut MdViewState, flags: u32) -> MdEv

ui_doc_view(id, &mut st, MV_*) -> MdEv: the document set in st (see the module header)

Source§

impl Ui

Source

pub fn vlist_begin( &mut self, id: u32, st: &mut VListState, count: usize, ) -> (usize, usize)

ui_vlist_begin(id, &mut st, count) -> (first, end): the rows to emit (see the module header)

Source

pub fn vlist_item_begin(&mut self, i: usize) -> u32

ui_vlist_item_begin(i) -> EV_*: row i (see the module header)

Source

pub fn vlist_item_end(&mut self)

ui_vlist_item_end: the row’s height is measured

Source

pub fn vlist_sel(&self) -> i32

the selection of the innermost vlist while its rows are emitted (-1 outside one)

Source

pub fn vlist_end(&mut self, st: &mut VListState) -> u32

ui_vlist_end(&mut st) -> EV_* (see the module header)

Source§

impl Ui

Source

pub fn code_theme(&self) -> CodeTheme

the code editors’ colours for the UI’s theme: dark / light syntax colours on the UI’s text box colours (accent selection, diagnostics in its critical / warning / info colours), or the high-contrast scheme’s colours

Source§

impl Ui

Source

pub fn code_theme_set(&mut self, theme: Option<CodeTheme>)

the colours of every code editor (None: code_theme(), following the UI’s theme)

Source

pub fn code_font_size(&mut self, pt: f32)

the size of the code editors’ font in points (0: 10 pt)

Source

pub fn code_find(&mut self, id: u32, query: &str, replace: bool)

open the find bar of code editor id with a query (replace: with the replace row); the editor selects the first match from its caret on

Source

pub fn code_status(&self, id: u32) -> CodeStatus

the caret, the find matches, the lines tokenized and the diagnostics in code editor id’s last frame

Source

pub fn code_diag(&self, id: u32) -> Option<Diag>

the most severe diagnostic at the caret of code editor id in its last frame (its message for a status bar)

Source

pub fn code_events(&self, id: u32) -> Vec<CodeEv>

what the user asked of code editor id in its last pass (go to definition, rename, format, a breakpoint’s click)

Source

pub fn code_popup_item(&self, id: u32) -> Option<CompItem>

the item the completion list of code editor id has chosen (None: closed)

Source

pub fn code_editor( &mut self, id: u32, doc: &mut CodeDoc, h: &Highlighter, flags: u32, ) -> u32

ui_code_editor(id, doc, hl, CE_) -> EV_ (see the module header)

Source

pub fn code_editor_with( &mut self, id: u32, doc: &mut CodeDoc, h: &Highlighter, assist: Option<&mut dyn CodeAssist>, flags: u32, ) -> u32

code_editor with a language’s services (completion, hover, signature help; see the module header and code_assist.rs)

Source§

impl Ui

Source

pub fn dock_begin( &mut self, id: u32, st: &mut DockState, panels: &[DockPanel<'_>], )

dock_begin(id, &mut st, panels): open the dock area (always pair with dock_end; fill it with dock_next). It takes the next place of the box (the whole rest when no size was set); panels: every panel the app has, each frame (titles and icons may change).

Source

pub fn dock_next(&mut self, st: &mut DockState) -> Option<u32>

dock_next(&mut st) -> the next place to fill (None: done): DOCK_CENTER, then the id of a shown panel; its content goes into a vertical box (it clips) until the next call

Source

pub fn dock_end(&mut self, st: &mut DockState) -> bool

dock_end(&mut st) -> the user changed the layout in this pass (store st.save() then)

Source§

impl Ui

Source

pub fn drop_count(&self) -> u32

ui_drop_count: files of the last drop

Source

pub fn drop_path(&self, i: u32) -> Option<&str>

ui_drop_path(i): path i of the last drop (None when out of range)

Source

pub fn open_take(&mut self) -> Vec<Request>

AF_SINGLE_INSTANCE: the command lines of later starts that arrived (UIC_OPEN), oldest first; each call takes them

Source

pub fn drop_list(&self) -> &[String]

ui_drop_list: every path of the last drop

Source

pub fn drop_pos(&self) -> (i32, i32)

ui_drop_pos: drop position in DIP of the window it happened in

Source

pub fn drop_window(&self) -> u32

ui_drop_window: the app id of the window of the last drop (0 = main window)

Source

pub fn drop_data(&self) -> &DragData

everything the last drop carried (paths, text, URLs, HTML, image, the app’s own kind and bytes; effects = the effect it was dropped with)

Source

pub fn drop_types(&self) -> u32

the DT_* kinds of the last drop

Source

pub fn drop_text(&self) -> Option<&str>

the text of the last drop (None: it had none)

Source

pub fn clip_has(&self, fmt: u32) -> bool

ui_clip_has(fmt): the clipboard offers fmt (cheap: no data is transferred)

Source§

impl Ui

Source

pub fn textbox_surface( &mut self, id: u32, text: &mut String, cap_flags: u32, lines: &[TextSurfaceLine], ) -> u32

Edit one UTF-8 buffer over caller-rendered rich text, without repainting its content. Layout may span differently sized/aligned lines and pages; each UTF-8 scalar boundary needs a caret stop. Text changes report EV_ACT and request a fresh layout on the next pass. Invalid ranges reject the call without consuming input. The caller owns scroll positioning and document history. Ordinary textboxes are unaffected.

Source

pub fn textbox_surface_change(&self) -> Option<(usize, usize, String)>

Replacement in the original buffer from the most recent surface call. The range respects the actual insertion location even when surrounding characters repeat.

Source§

impl Ui

Source

pub fn spell_enable(&mut self, on: bool)

the spell checking switch for every TB_SPELL box (default on)

Source

pub fn spell_language(&mut self, tag: &str)

the language of the checker: a BCP 47 tag (“de-DE”), “” = the user’s languages

Source

pub fn spell_sources(&mut self, sources: u32)

where checkers come from (spell::SRC_*; 0 = the default, see the module header)

Source

pub fn spell_set(&mut self, sp: Speller)

use the app’s own checker

Source

pub fn spell_suggest_async(&mut self, on: bool)

suggestions on a worker: on / off (default: on in window mode, off in headless runs)

Source

pub fn spell_state(&self) -> u32

SPELL_OFF / SPELL_LOADING / SPELL_READY / SPELL_NONE

Source

pub fn speller(&mut self) -> Option<&mut Speller>

the checker in use (None while it loads or when there is none)

Source

pub fn spell_errors(&self, id: u32) -> Vec<(usize, usize)>

the misspelled byte ranges of text box id, as last checked (none while switched off)

Source§

impl Ui

Source

pub fn textbox_selection(&self, id: u32) -> Option<(usize, usize)>

Read the focused textbox’s UTF-8 byte selection (anchor, caret), after drawing it. Opt-in API for document editors; ordinary textbox behavior is unchanged.

Source

pub fn textbox_select( &mut self, id: u32, text: &str, anchor: usize, caret: usize, ) -> bool

Select valid UTF-8 byte boundaries in an already focused/drawn textbox. Pass the same current text used by textbox(); returns false without changes for invalid ranges.

Source

pub fn textbox( &mut self, id: u32, placeholder: Option<&str>, buf: &mut String, cap_flags: u32, ) -> u32

ui_textbox(id, placeholder, buf, cap_flags) -> EV_* (see the module header)

Source

pub fn textbox_icon( &mut self, id: u32, icon: u32, placeholder: Option<&str>, buf: &mut String, cap_flags: u32, ) -> u32

Single-line text input with a leading semantic icon. The icon reserves its own inset, so pointer selection, caret scrolling and IME share the visible text origin. Multiline inputs ignore the icon and retain their ordinary presentation.

Source

pub fn textbox_presented( &mut self, id: u32, placeholder: Option<&str>, buf: &mut String, cap_flags: u32, presentation: TextboxPresentation, ) -> u32

Edit multiline text on a caller-provided surface without the style’s textbox frame. Uses zero text insets and the supplied font, line metrics and colors. The supplied presentation applies only to this call; ordinary textboxes keep their default style. TB_MULTI is implicit; other capacity and textbox flags retain their usual meaning.

Source

pub fn ime_pos(&mut self, x: i32, y: i32, h: i32)

Source

pub fn clip_set_many(&mut self, entries: &[(u32, &[u8])]) -> i32

Publish distinct TEXT/HTML/RTF/DOCX representations of one selection (64 MiB total). Validation precedes replacement; 0 means every representation was published.

Source

pub fn clip_set(&mut self, fmt: u32, data: &[u8]) -> i32

Replace the clipboard with one text, image or rich representation.

Source

pub fn clip_get(&mut self, fmt: u32) -> Option<Vec<u8>>

ui_clip_get(fmt) -> the clipboard data (text: UTF-8) or None

Source

pub fn open_folder(&mut self, path: &str) -> i32

ui_open_folder(path) -> 0 / -1: (U2) show a folder (or a file selected in its folder) in the system file manager; headless runs start nothing: they print “ui_open_folder: PATH” and return 0

Source

pub fn open_url(&mut self, url: &str) -> i32

ui_open_url(url) -> 0 / -1: a web page / mailto link in the default application; headless runs print “ui_open_url: URL” and return 0

Source

pub fn number_box(&mut self, id: u32, v: &mut i32, rg: &Range) -> u32

ui_number_box(id, &mut v, &range) -> EV_* (see the module header)

Source

pub fn number_box_f(&mut self, id: u32, v: &mut f64, rf: &RangeF) -> u32

ui_number_box_f(id, &mut v, &range_f) -> EV_* (U1; see the module header)

Source

pub fn nb_live(&mut self, id: u32, v: &mut i32) -> bool

nb_live(id, &mut v) -> true when number box id is being edited and the text typed so far is a number different from v: the value (clamped to the range) is stored without reformatting the text – property rows preview while the user types

Source

pub fn nb_live_f(&mut self, id: u32, v: &mut f64) -> bool

nb_live_f(id, &mut v) -> nb_live of an f64 number box (fixed to its RangeF)

Source§

impl Ui

Source

pub fn filedlg( &mut self, id: u32, flags: u32, open: &Shared<i32>, path: &mut String, cap: u32, exts: &[&str], ) -> u32

ui_filedlg(id, flags, open, path, cap, exts) -> EV_ACT when confirmed

Source§

impl Ui

Source

pub fn fonts(&mut self) -> &FontDb

the installed fonts (scanned on first use)

Source

pub fn font_conf(&mut self) -> &FontConf

the rules for generic families, substitutes and languages

Source

pub fn font_load(&mut self, sel: &FontSel) -> Option<u32>

the font of a choice loaded into ui.text -> its id (None: no installed font fits)

Source

pub fn font_resolved(&mut self, sel: &FontSel) -> String

the installed family font_load takes for a choice (“” none)

Source

pub fn font_register( &mut self, family: &str, weight: u32, italic: bool, font: u32, )

a font of the app’s own (an id of ui.text.load_mem) under a family name: font_load takes it for that family, weight and slant without asking the installed fonts; the rich-text toolbar lists the registered families (rich_edit.rs)

Source

pub fn font_registered(&self) -> Vec<String>

the families of font_register, in the order of their first registration

Source

pub fn text_in_font(&mut self, font: u32, size_pt: f64, s: &str)

one line of text in font id font at size_pt points (the body text colour)

Source

pub fn font_picker(&mut self, id: u32, sel: &mut FontSel) -> u32

the font picker (see the module header) -> EV_ACT when sel changed

Source

pub fn font_dialog( &mut self, id: u32, open: &Shared<i32>, sel: &mut FontSel, ) -> u32

the font dialog (see the module header) -> EV_ACT when OK took the choice

Source§

impl Ui

Source

pub fn gridbox_begin(&mut self, id: u32, cols: &[i32], flags: u32, gap: i32)

gridbox_begin(id, cols, flags, gap): open a grid (see the module comment)

Source

pub fn gridbox_rows(&mut self, rows: &[i32])

gridbox_rows(rows): row sizes of the open grid (DIP; > 0 fixed, 0 natural, < 0 fill)

Source

pub fn next_span(&mut self, cols: u32, rows: u32)

next_span(cols, rows): the next grid child covers that many cells

Source

pub fn next_cell(&mut self, col: u32, row: u32)

next_cell(col, row): the next grid child starts in that cell

Source

pub fn next_align(&mut self, h: u32, v: u32)

next_align(h, v): the next grid child’s alignment (AL_*; AL_DEFAULT: the grid’s)

Source

pub fn gridbox_end(&mut self)

gridbox_end: store the measured sizes (another pass when they changed), close the box

Source§

impl Ui

Source

pub fn hex_view( &mut self, id: u32, st: &mut HexState, data: &[u8], marks: &[HexMark], ) -> HexEv

ui_hex_view(id, &mut st, data, marks) -> HexEv: bytes as hex and ASCII rows with marked ranges, a selection and a caret (see the module header of hexview.rs)

Source§

impl Ui

Source

pub fn svg_fonts(&mut self) -> Rc<SvgFonts>

the faces for SVG text (registered families, the monospace font); shared until the registered fonts change

Source

pub fn svg(&mut self, id: u32, doc: &Rc<Svg>, w: i32, h: i32) -> u32

ui_svg(id, doc, w, h) -> EV: an SVG at w x h DIP (see the module header of imgview.rs)

Source§

impl Ui

Source

pub fn image_view( &mut self, id: u32, st: &mut ImageViewState, img: ViewImage<'_>, flags: u32, ) -> u32

ui_image_view(id, st, img, flags) -> EV: the image viewer (see the module header of imgview.rs)

Source§

impl Ui

Source

pub fn undo_keys(&mut self) -> Option<bool>

undo_keys() -> Some(true) for Ctrl+Z, Some(false) for Ctrl+Y / Ctrl+Shift+Z, when no text field has the keyboard (they keep their own undo); the key is consumed

Source§

impl Ui

Source

pub fn hyph_language(&mut self, tag: &str)

the hyphenation language: a BCP 47 tag (“de-DE”); “” = the UI language’s

Source

pub fn next_hyph_language(&mut self, tag: &str)

the language of the next wrapped text or multi-line box only (it counts when that one hyphenates: TX_HYPHENATE, TB_HYPHENATE)

Source

pub fn hyph_sources(&mut self, sources: u32)

where hyphenation dictionaries come from (spell::SRC_*; 0 = the default)

Source

pub fn hyph_set(&mut self, tag: &str, h: Hyphenator)

the app’s own hyphenation patterns for a language tag (“de”, “en-US”)

Source

pub fn hyphenator(&mut self, tag: &str) -> Option<Arc<Hyphenator>>

the hyphenation patterns for a tag (“”: the current language), None when there are none

Source§

impl Ui

Source

pub fn id(&self, name: &str) -> u32

the id of a name in the current scope

Source

pub fn id_n(&self, n: u32) -> u32

the id of a number in the current scope (the rows of a loop)

Source

pub fn id_push(&mut self, n: u32)

open a scope named by a number (an index, a document’s id); always pair with id_pop

Source

pub fn id_push_str(&mut self, name: &str)

open a scope named by a name; always pair with id_pop

Source

pub fn id_pop(&mut self)

close the scope of the last id_push / id_push_str

Source

pub fn id_scope<R>(&mut self, n: u32, f: impl FnOnce(&mut Ui) -> R) -> R

id_push(n), f(ui), id_pop()

Source§

impl Ui

Source

pub fn gpu_output(&self, win: u32) -> GpuOutput

what window win (a UI window index, 0 = main) shows through

Source

pub fn gpu_test_lose(&mut self)

(test aid) the device behaves as lost from now on: the next frame goes back to the CPU path, a new device follows

Source

pub fn gpu_test_image_budget(&mut self, bytes: u64)

(test aid) the bytes image textures may take

Source

pub fn gpu_test_canvas_budget(&mut self, bytes: u64)

(test aid) the bytes canvas tiles may take

Source

pub fn gpu_test_canvas_unused(&mut self, ms: u64)

(test aid) the tiles go this long (ms) after the last move

Source

pub fn gpu_canvas_settle(&mut self)

every canvas whose view comes from tiles goes back to the CPU’s picture with the next frame

Source

pub fn gpu_settle(&mut self)

the pixels of the images the GPU draws into the framebuffers (Ui::fb reads them then)

Source§

impl Ui

Source

pub fn canvas_gpu_wanted(&self) -> bool

is the GPU output there to use a CanvasDesc? A widget without one saves building it

Source

pub fn canvas_gpu(&mut self, d: CanvasDesc)

the custom command recorded last shows this content through this view (module header)

Source

pub fn canvas_gpu_damage(&mut self, id: u32, r: [f64; 4])

the content rectangle x0, y0, x1, y1 (content units) of canvas id changed: its tiles go

Source§

impl Ui

Source

pub fn inspect_enable(&mut self, on: bool)

arm the inspector (--inspect, jfgui_INSPECT=1): its hot keys (Ctrl+Shift+I and F12, inspect_keys) open and close it; false closes it, the keys reach the app again

Source

pub fn inspect_show(&mut self, on: bool)

open / close the inspector: its overlay in the app’s windows and its tool window “Inspektor” (opening arms it); closed it costs nothing

Source

pub fn inspect_open(&self) -> bool

the inspector is open

Source

pub fn inspect_keys(&mut self, keys: &[u32])

the inspector’s hot keys: VK | MOD_* << 16 each (MOD_SHIFT / MOD_CTRL / MOD_ALT); default Ctrl+Shift+I and F12, none: only the API and --inspect open it

Source§

impl Ui

Source

pub fn focus_group_begin(&mut self, id: u32)

focus_group_begin(id): the focusable widgets up to focus_group_end are one Tab stop, the arrows move inside (id 0: the current box’s id)

Source

pub fn focus_group_end(&mut self)

focus_group_end

Source

pub fn focus_pane_begin(&mut self, id: u32)

focus_pane_begin(id): the widgets up to focus_pane_end are a pane (F6 / Shift+F6)

Source

pub fn focus_pane_end(&mut self)

focus_pane_end

Source

pub fn group_arrived(&mut self, id: u32) -> bool

group_arrived(id): the arrow keys of its focus group just moved the focus to widget id (true once; a widget whose selection follows the focus – tabs, radios – selects itself then)

Source

pub fn splitter_keys(&mut self, ev: u32, along_x: bool) -> i32

splitter_keys(ev, along_x) -> how far (DIP, + right / down) the keys of this pass move a focused splitter of the app (a box with HB_SPLITTER, its events ev; along_x: it moves left / right); Home / End: i32::MIN / 2, i32::MAX / 2 (clamp it); Enter / Esc give the focus back to the widget focused before F8

Source§

impl Ui

Source

pub fn next_size(&mut self, w: i32, h: i32)

ui_next_size(w, h): DIP; > 0 fixed, 0 natural, < 0 fill weight

Source

pub fn next_rect(&mut self, x: i32, y: i32, w: i32, h: i32)

ui_next_rect(x, y, w, h): DIP relative to the current box’s content origin

Source

pub fn next_rect_px(&mut self, x: i32, y: i32, w: i32, h: i32)

ui_next_rect_px(x, y, w, h): absolute placement of the next widget / box in window px (w or h 0 = natural size); nothing is accounted in the parent box

Source

pub fn box_offset(&mut self, dx: i32, dy: i32)

ui_box_offset(dx, dy): shift the content of the current box by (-dx, -dy) px

Source

pub fn next_flags(&mut self, f: u32)

ui_next_flags(ST_*): style flags for the next widget (OR-ed)

Source

pub fn take_flags(&mut self) -> u32

ui_take_flags: the pending next_flags value (cleared; for widgets)

Source

pub fn next_icon(&mut self, cp: u32)

ui_next_icon(cp): icon code point (IC_*) for the next widget

Source

pub fn take_icon(&mut self) -> u32

ui_take_icon: the pending icon (cleared; for widgets)

Source

pub fn last_rect(&self) -> [i32; 4]

ui_last_rect: [x, y, w, h] of the last placed widget (px)

Source

pub fn box_id(&self) -> u32

ui_box_id: id of the current box (the root box’s id at the top level; 0 outside a pass)

Source

pub fn box_rect(&self) -> [i32; 4]

ui_box_rect: [x, y, w, h] content rectangle of the current box (px)

Source

pub fn box_flags(&self) -> u32

flags of the current box (ui_box_rect - 8 + 4 in the asm)

Source

pub fn place(&mut self, iw: i32, ih: i32) -> [i32; 4]

ui_place(iw, ih) -> last_rect: place the next widget (natural size in px)

Source

pub fn avail_width(&self, iw: i32) -> (i32, i32)

ui_avail_width(iw) -> (width px a wrapping widget of natural (unwrapped) width iw gets from the next place, 1 when that width does not depend on iw) – no side effects. 0 = unknown (no wrapping).

Source

pub fn box_begin(&mut self, id: u32, flags: u32, gap: i32)

ui_box_begin(id, flags, gap): open a container (id 0 = automatic)

Source

pub fn box_end(&mut self)

ui_box_end: store the measured natural size, correct the parent’s totals

Source

pub fn spacer(&mut self, dip: i32)

ui_spacer(dip): empty space along the main axis (< 0 = fill weight)

Source

pub fn dp(&self, dip: i32) -> i32

ui_dp(dip): DIP -> physical pixels, round(dip * dpi / 96) (signed)

Source

pub fn px2dip(&self, px: i32) -> i32

ui_px2dip(px): physical pixels -> DIP, (px * 96 + dpi / 2) / dpi

Source

pub fn dpi(&self) -> i32

ui_dpi: current dpi of the live window (96 = 100 %)

Source

pub fn set_dpi(&mut self, dpi: i32)

ui_set_dpi(dpi): override the dpi (tests)

Source

pub fn dp_fx(&self, dip_fx: i32) -> i32

dp_fx(dip_fx) -> px in 24.8 (dip_fx * dpi / 96, truncated)

Source§

impl Ui

Source

pub fn scroll_begin(&mut self, id: u32, flags: u32)

ui_scroll_begin(id, flags)

Source

pub fn scroll_end(&mut self)

ui_scroll_end

Source

pub fn scroll_to(&mut self, id: u32, x: i32, y: i32)

ui_scroll_to(id, x, y): DIP, -1 keeps that axis; jumps without animation

Source

pub fn scroll_pos(&mut self, id: u32) -> (i32, i32)

ui_scroll_pos(id) -> (x, y) DIP

Source

pub fn scroll_extent(&mut self, id: u32) -> (i32, i32)

ui_scroll_extent(id) -> (w, h): measured content size of scroll view id (DIP; 0 before its first pass). With the view size (last_rect after scroll_end) the app can tell whether the content overflows. (U3)

Source

pub fn scrollbar( &mut self, id: u32, pos: &mut i32, content: i32, view: i32, vertical: bool, ) -> u32

ui_scrollbar(id, &mut pos, content, view, vertical) -> EV_*

Source

pub fn list_begin( &mut self, id: u32, sel: &mut i32, count: i32, item_h: u32, ) -> (i32, i32)

ui_list_begin(id, &mut sel, count, item_h | LF_*) -> (first, end): the rows to emit

Source

pub fn list_item(&mut self, i: i32, label: &str) -> u32

ui_list_item(i, label) -> EV_*

Source

pub fn list_item_begin(&mut self, i: i32) -> u32

ui_list_item_begin(i) -> EV_*: row i with a BOX_H (gap 8 DIP) for custom content

Source

pub fn list_sel(&self) -> i32

the innermost list’s selection while its rows are emitted (the asm’s rows see the app’s variable change at once; here the list holds it until list_end), -1 outside a list

Source

pub fn list_item_end(&mut self)

ui_list_item_end

Source

pub fn list_end(&mut self, sel: &mut i32) -> (u32, i32)

ui_list_end(&mut sel) -> (EV_* (EV_ACT if sel changed, EV_DOUBLE), sel); EV_DRAG: a row was dropped, the second value is from | to << 16

Source

pub fn tabs_scrolling(&mut self, id: u32, sel: &mut i32, names: &[&str]) -> u32

Tab strip with horizontal overflow arrows. Mouse scrolling and Left/Right, Home/End on the strip retain ordinary tab semantics; changed selections and resized viewports reveal the selected tab. Internal IDs follow the usual (id * 8 + part) | 0x80000000 convention (parts 1, 2, 3 and 7).

Source

pub fn tabs(&mut self, id: u32, sel: &mut i32, names: &[&str]) -> u32

ui_tabs(id, &mut sel, names) -> EV_* (EV_ACT when sel changed)

Source

pub fn expander_begin(&mut self, id: u32, header: &str, open: &mut i32) -> i32

ui_expander_begin(id, header, &mut open) -> open: a card-like header (48 DIP) with a chevron; when open the content follows in a padded card below it (BOX_V, PAD_16, gap 8 DIP). Always call expander_end.

Source

pub fn expander_end(&mut self)

ui_expander_end

Source§

impl Ui

Source

pub fn toast(&mut self, kind: u32, title: &str, msg: &str, ms: u32) -> u32

ui_toast(kind, title, msg, ms) -> toast id

Source

pub fn toast_dismiss(&mut self, id: u32)

ui_toast_dismiss(id)

Source

pub fn toast_clear(&mut self)

ui_toast_clear

Source

pub fn toasts(&self) -> Vec<(u32, u32, String, String)>

the queued toasts: (id, kind, title, message)

Source

pub fn toast_host(&mut self)

ui_toast_host: draw the toasts (once per frame, after the content)

Source

pub fn spinner(&mut self, id: u32, size: i32)

ui_spinner(id, size_dip): a turning ring

Source

pub fn progress_indeterminate(&mut self, id: u32)

ui_progress_indeterminate(id): a bar with a running segment

Source§

impl Ui

Source

pub fn preview_card( &mut self, id: u32, label: &str, draw: Option<DrawRef>, user: usize, version: u32, ) -> u32

Focusable document/template preview card, naturally 150×194 DIP. The supplied drawing is inset into a white page; its document colors never follow the UI theme. Hover and selection use the style accent. The full label is exposed to agents.

Source

pub fn ribbon_theme_tile( &mut self, id: u32, label: &str, theme_color: u32, variant: u32, ) -> u32

A 56×66-DIP theme chooser containing a 52×50-DIP miniature page. theme_color is a document color, independent of the interface theme. variant selects one of seven sample arrangements (0..=6); larger values wrap. next_flags(ST_DISABLED | ST_CHECKED) controls behavior and selection, while the document sample remains fully readable. The caller applies its own theme on EV_ACT.

Source§

impl Ui

Source

pub fn permissions_page(&mut self, id: u32) -> bool

the permissions section of a settings page: the answers to the app’s permission questions, each with a reset (module header) -> an answer was revoked

Source§

impl Ui

Source

pub fn popup_is_open(&self, id: u32) -> bool

ui_popup_is_open(id): popup id is open

Source

pub fn popup_count(&self) -> u32

ui_popup_count -> open popups of the live window (U3)

Source

pub fn popup_open(&mut self, id: u32)

ui_popup_open(id): open popup id (inside a flyout: as a child of that flyout, otherwise it replaces every open popup); an open popup only loses its children

Source

pub fn popup_close(&mut self)

ui_popup_close: close every popup (the focus returns to where it was)

Source

pub fn flyout_begin(&mut self, id: u32, flags: u32) -> bool

ui_flyout_begin(id, FL_*) -> popup id is open: then its content follows (a vertical box with 4 DIP padding) until flyout_end, which is called in any case. The flyout is anchored to the last placed widget (FL_POINT: to the pointer position where it opened) and kept inside the window.

Source

pub fn popup_ext(&self, i: u32) -> Option<[i32; 4]>

ui_popup_ext(i) -> rect x, y, w, h (px, window coordinates) of item i of the live window when it was drawn in the last pass partly outside its framebuffer. Items 0 .. 5 are the open popups, 6 the tooltip. (U3, OS popup windows)

Source

pub fn popup_rect(&self, i: u32) -> Option<[i32; 4]>

ui_popup_rect(i) -> rect (px) of item i of the live window when it was drawn in the last pass (anywhere). The main window gives its popups own OS windows with it while tool windows are shown, so menus stay above them.

Source

pub fn flyout_end(&mut self)

ui_flyout_end: close the content of flyout_begin (also when it returned false)

Source

pub fn cmd_find(&self, id: u32) -> Option<&'static Command>

ui_cmd_find(id) -> the command record of the app’s command table

Source

pub fn cmd_state(&mut self, id: u32, flags: u32)

ui_cmd_state(id, flags): set the CF_* state of a command; it stays until changed (calling it every frame with the same flags is fine) and overrides the table flags. Up to 1536 commands have a state; more print one UIWARN and are ignored.

Source

pub fn cmd_flags(&self, id: u32) -> u32

ui_cmd_flags(id) -> CF_* state (cmd_state, else the table flags)

Source

pub fn cmd_label(&self, id: u32) -> String

ui_cmd_label(id) -> label of a command without ‘&’ (“” if unknown)

Source

pub fn accel_text(&self, id: u32) -> String

ui_accel_text(id) -> accelerator of a command as text, e.g. “Strg+Umschalt+S”

Source

pub fn accel_order_set(&mut self, order: u32)

ui_accel_order: 0 = “Strg+Umschalt+Alt+X” (default), 1 = “Strg+Alt+Umschalt+X” (U1)

Source

pub fn cmd_button(&mut self, id: u32, flags: u32) -> u32

ui_cmd_button(id, ST_) -> EV_: button for a command: icon and label from the table (ST_ICON_ONLY: icon only), tooltip “Label (Strg+S)”, ST_DISABLED / ST_CHECKED from the command state; a click queues the command. Hidden commands draw nothing.

Source

pub fn menu_item(&mut self, id: u32, label: &str) -> u32

ui_menu_item(id, label) -> EV_*: menu row inside a flyout (next_icon; next_flags ST_DISABLED / ST_CHECKED); activation closes every popup

Source

pub fn menu_item_keys(&mut self, id: u32, label: &str, keys: &str) -> u32

menu_item with keys (key_text) at the end of the row: a row whose keys the app handles itself (no command of the table)

Source

pub fn key_text(&self, vk: u32, mods: u32) -> String

a key with modifiers (MOD_*) as the accelerator texts write it: “Strg+Umschalt+S”, “F5” (the UI language’s names; accel_order_set holds)

Source

pub fn menu_cmd(&mut self, cmd: u32) -> u32

ui_menu_cmd(cmd) -> EV_*: menu row for a command (widget id = command id)

Source

pub fn menu_sep(&mut self) -> u32

ui_menu_sep -> 0: separator line across the flyout

Source

pub fn menu_list_empty(&mut self, base: u32, text: &str)

the disabled row an empty Mi::List with this base id shows instead of its placeholder (“”: the placeholder again), for a list that can be empty for different reasons

Source

pub fn menu_list<T: AsRef<str>>(&mut self, base: u32, rows: &[T])

the rows of the Mi::List menus with this base id (row k: id base + k; the asm app’s STRLIST buffer); the list ends at the first empty string

Source

pub fn menubar(&mut self, menubar: Option<&'static [Mi]>) -> u32

ui_menubar(menubar) -> EV_OPEN while one of its menus is open (None = the one of AppDesc::menubar). WinUI MenuBar: subtle 32 DIP items, a flyout per menu. Keyboard: Alt (tap) or F10 enter / leave menu bar mode, Alt+mnemonic opens a menu, Left / Right move between the menus, Down / Enter open one, Esc steps back.

Source

pub fn menu_popup(&mut self, menu: &'static [Mi])

ui_menu_popup(menu): open a menu at the pointer (the runtime draws it); for the menu key / Shift+F10 (an EV_RCLICK kbnav.rs gave the focused widget in this pass) at the widget’s lower left corner with its first row focused

Source

pub fn context_menu(&mut self, menu: &'static [Mi]) -> u32

ui_context_menu(menu) -> EV_OPEN while menu is open for the last widget. Opens on a right click (released over the widget), or with the menu key / Shift+F10 while the widget has the focus – a list row: while the list has it and the row is selected – (then at its lower left corner, first row focused).

Source

pub fn context_target(&self) -> u32

ui_context_target -> id of the widget whose context menu is (or was last) open

Source

pub fn dropdown_button(&mut self, id: u32, label: &str) -> u32

ui_dropdown_button(id, label) -> EV_* | EV_OPEN while popup id is open (a click, Enter / Space, Alt+Down or F4 opens it; the app draws the flyout with flyout_begin(id, ..) right after). next_flags ST_SUBTLE: flat tool bar look, ST_ICON_ONLY: icon + chevron, the label as tooltip (U1)

Source

pub fn split_button(&mut self, id: u32, label: &str) -> u32

ui_split_button(id, label) -> EV_* of the main part | EV_OPEN while popup id is open. The chevron part (widget id | 0x80000000; Alt+Down / F4 on the main part) opens it.

Source

pub fn combobox(&mut self, id: u32, sel: &mut i32, list: &[&str]) -> u32

ui_combobox(id, &mut sel, list) -> EV_*: EV_ACT when sel changed, EV_OPEN while the list is open. WinUI ComboBox: 32 DIP, control fill, chevron; the list opens over the box with the selected row (accent pill) on it. Keyboard: Up / Down change the selection, Enter / Space / Alt+Down / F4 open the list. list is a STRLIST (it ends at the first empty string).

Source

pub fn tooltip(&mut self, s: &str)

ui_tooltip(s): post-modifier: show s as the tooltip of the last widget after 500 ms of hover (at once when another tooltip hid less than 300 ms ago); hidden on press, key or leave. Icon-only buttons call it with their label.

Source

pub fn tooltip_part(&mut self, s: &str, part: u64)

ui_tooltip_part(s, part): post-modifier like tooltip(s) for one part of the last widget (an item on a canvas: a cable, a port). The delay starts again when part changes (at once when a tooltip hid less than 300 ms ago, as between toolbar buttons); a press hides it until the pointer is over another part; part 0 shows nothing.

Source§

impl Ui

Source

pub fn recent_add(&mut self, path: &str)

a file the user opened or saved: first in the app’s recent files and in the system’s

Source

pub fn recent_open(&mut self, path: &str) -> RecentOpen

a file of the recent list about to be opened (from the user’s click or key): Ready, Asking (the browser asks for the permission; UIC_RECENT follows) or Missing

Source

pub fn recent_reopened(&mut self) -> Option<String>

the file UIC_RECENT answered for, once

Source

pub fn recent_files(&self) -> Vec<String>

the app’s recent files, newest first

Source

pub fn recent_remove(&mut self, path: &str)

a file out of the app’s and the system’s recent files

Source

pub fn recent_clear(&mut self)

the app’s recent files and its entries in the system’s list forgotten

Source§

impl Ui

Source

pub fn ribbon_begin( &mut self, id: u32, groups: &[RibbonGroup<'_>], ) -> RibbonLayout

Start a style-sized ribbon (110 DIP by default). Pair with ribbon_end. All groups remain keyboard reachable; a scroll strip is the final fallback.

Source

pub fn ribbon_group_begin( &mut self, layout: &RibbonLayout, index: usize, group: &RibbonGroup<'_>, ) -> Option<RibbonGroupMode>

Begin a group’s controls when visible, or render its overflow button. Only call ribbon_group_end when this returns Some.

Source

pub fn ribbon_group_end(&mut self, mode: RibbonGroupMode, label: &str)

Finish controls and draw the inline group caption; closes overflow when appropriate. Flyouts already have their named opener, so no trailing caption is painted over a nested action menu emitted while building their controls.

Source

pub fn ribbon_group_end_launcher( &mut self, mode: RibbonGroupMode, label: &str, id: u32, action_label: &str, flags: u32, ) -> u32

Finish a group with a separately focusable dialog-launch button in its caption. id is an additional unique widget ID; action_label is its full semantic name. Activation is returned to the app, which opens its existing dialog. Disabled launchers retain their label and cannot be invoked through keyboard or agents.

Source

pub fn ribbon_end(&mut self)

Finish the ribbon begun with ribbon_begin.

Source

pub fn ribbon_button_width(&mut self, label: &str, icon: u32, flags: u32) -> i32

Natural action width in DIP, including the style’s icon, label and menu spacing. Measuring neither consumes next_* hints nor creates a widget. Use it when composing translated ribbon columns before ribbon_begin.

Source

pub fn ribbon_button( &mut self, id: u32, label: &str, icon: u32, flags: u32, ) -> u32

Compact ribbon action with clipped drawing, native focus and a full tooltip. ST_ICON_ONLY, ST_LARGE, ST_CHECKED and ST_DISABLED are supported.

Source

pub fn ribbon_large_button( &mut self, id: u32, label: &str, icon: u32, flags: u32, ) -> u32

Large ribbon action: the style draws its icon above a visible caption. It is one normal focusable, inspectable button. Use next_size to override its natural style size; checked/disabled flags keep their ordinary meaning.

Source

pub fn ribbon_menu_button( &mut self, id: u32, label: &str, icon: u32, flags: u32, ) -> u32

Ribbon-styled menu opener. id is also the popup identifier. Its natural dimensions, icon, menu indicator and enabled state come from the style.

Source

pub fn ribbon_stacked_split_button( &mut self, id: u32, menu_id: u32, label: &str, menu_label: &str, icon: u32, flags: u32, ) -> u32

Large split action with an icon hit area above its menu caption. Both parts remain independently focusable and discoverable through semantics. Pair the menu_id with a normal flyout. Alt+Down/F4 opens the caption menu.

Source

pub fn ribbon_split_button( &mut self, id: u32, menu_id: u32, label: &str, menu_label: &str, icon: u32, flags: u32, ) -> u32

A large primary action beside an independently focusable dropdown. id identifies the primary action; menu_id identifies both the dropdown button and its popup. Both IDs must be unique. menu_label is a full semantic name, not an unlabeled chevron. Pair with flyout_begin(menu_id, ..) and flyout_end immediately afterwards to provide actual secondary actions. Returns primary EV_* flags plus EV_OPEN while the dropdown popup is open. Tab reaches both parts; Enter/Space activate the focused part. Alt+Down or unbound F4 on the main part forwards to the existing dropdown keyboard path.

Begin an inset horizontal gallery on an input-colored surface. The caller supplies its size and tiles; finish with box_end. The whole frame is painted before applying the three-DIP tile inset, including in dark themes.

Source

pub fn ribbon_tile( &mut self, id: u32, label: &str, preview: &str, typography: u32, selected: bool, ) -> u32

Typography preview tile for a style gallery; selection is exposed semantically. typography is a TS_* style; use next_size to set a compact gallery width.

Source

pub fn ribbon_font_tile( &mut self, id: u32, label: &str, preview: &str, typography: u32, selected: bool, face: Option<(u32, i32, u32)>, ) -> u32

A gallery tile with an optional document font, 24.8-DIP size and ARGB ink. The surrounding control follows the application theme; the sample stays document-colored.

Source

pub fn ribbon_sample_tile( &mut self, id: u32, label: &str, preview: &str, typography: u32, selected: bool, sample: Option<RibbonSample>, ) -> u32

Style-gallery tile with explicit highlight, baseline and text decorations.

Source§

impl Ui

Source

pub fn settings_page(&mut self, id: u32, s: &mut Settings) -> bool

the settings page of the schema of s (see the module header) -> a value changed

Source§

impl Ui

Source

pub fn nav_begin(&mut self, id: u32, nav: &mut NavState)

ui_nav_begin(id, &mut nav): open the pane (always call nav_end)

Source

pub fn nav_toggle(&mut self, id: u32, label: &str, nav: &mut NavState) -> u32

ui_nav_toggle(id, label): the menu button of the pane (toggles compact)

Source

pub fn nav_section(&mut self, label: &str)

ui_nav_section(label): a group caption (a divider when the pane is compact)

Source

pub fn nav_item( &mut self, id: u32, icon: u32, label: &str, selected: bool, badge: Option<&str>, ) -> u32

ui_nav_item(id, icon, label, selected, badge) -> EV_* (EV_ACT clicked)

ui_nav_footer: end the scrolling item list; the items after it stay at the bottom

Source

pub fn nav_end(&mut self)

ui_nav_end

Source

pub fn command_bar(&mut self, id: u32, items: &[CmdItem<'_>]) -> Option<u32>

ui_command_bar(id, items) -> the id of the item clicked in this pass

Source

pub fn split_begin(&mut self, id: u32, pos: i32, vertical: bool)

ui_split_begin(id, pos, vertical): two panes, the first pos DIP wide (vertical: high); emit the first pane, split_next, the second pane, split_end

Source

pub fn split_next(&mut self)

ui_split_next: the grip, then the second pane

Source

pub fn split_end(&mut self, pos: &mut i32) -> bool

ui_split_end(&mut pos) -> the grip moved (pos updated, DIP; the mouse or the keyboard: F8 focuses the grip, arrows move it)

Source

pub fn breadcrumb(&mut self, id: u32, parts: &[&str]) -> Option<usize>

ui_breadcrumb(id, parts) -> the index of a clicked part (the last one is the current page and not a link)

Source

pub fn segmented(&mut self, id: u32, sel: &mut i32, items: &[&str]) -> u32

ui_segmented(id, &mut sel, items) -> EV_* (EV_ACT when sel changed)

Source

pub fn wizard_steps( &mut self, id: u32, steps: &[&str], current: usize, states: &[i32], ) -> Option<usize>

ui_wizard_steps(id, steps, current, states) -> a step to go back to (clicked); states: WS_* per step (missing: done before the current, todo after it)

Source

pub fn page_header(&mut self, title: &str, subtitle: &str)

ui_page_header(title, subtitle): a page title (TS_TITLE) with an optional secondary line under it

Source

pub fn key_value(&mut self, key: &str, value: &str, key_width: i32)

ui_key_value(key, value, key_width): a “label: value” row (TS_BODY, the key in the secondary colour, key_width DIP)

Source

pub fn empty_state(&mut self, icon: u32, title: &str, text: &str)

ui_empty_state(icon, title, text): a centred hint for an empty view (icon 0 = none); the text wraps at 360 DIP, or at the enclosing box’s width when that is narrower

Source§

impl Ui

Source

pub fn beep(&mut self, kind: u32) -> bool

the system’s sound for kind (plat::audio::SOUND_*) -> false: off, unknown, not permitted (audio.output) or not played

Source

pub fn dialog_sound(&mut self, kind: u32) -> bool

inside an open content dialog: its sound, once when it has just opened, where message dialogs play one on this platform and the app may play sound -> whether a sound was asked for

Source

pub fn set_sounds(&mut self, on: bool)

the app’s switch for its sounds (beep, dialog_sound); on by default

Source

pub fn sounds(&self) -> bool

sounds are on: the app’s switch and jfgui_SOUNDS (0: off)

Source§

impl Ui

Source

pub fn rtl(&self) -> bool

the windows are mirrored now (right-to-left layout)

Source

pub fn set_rtl(&mut self, on: Option<bool>)

mirror the windows (Some(true)), never (Some(false)) or as the UI language reads (None)

Source

pub fn ltr_begin(&mut self, x: i32, w: i32)

ltr_begin(x, w): the following commands of this layer keep their LTR order inside the columns x .. x + w (px); pairs with ltr_end

Source

pub fn ltr_end(&mut self)

close the region of ltr_begin

Source

pub fn ltr_x(&self, x: i32) -> i32

a logical x (the pointer) as the open ltr_begin region sees it: its content is not mirrored, so the pointer is mirrored back across the region

Source

pub fn rtl_map(&self, x: i32, ix: i32, iw: i32) -> i32

rtl_map(x, ix, iw): a logical x as a region ix .. ix + iw that keeps its LTR content sees it (the same before its ltr_begin)

Source§

impl Ui

Source

pub fn fb(&self) -> &Surface

ui_fb: the live window’s framebuffer. While its frames go through the GPU a big image may be drawn only there, the view of a canvas while it moves (canvas.rs) too: Ui::gpu_settle() first when the pixels matter

Source

pub fn client_size(&self) -> (i32, i32)

ui_client_size: client area in DIP

Source

pub fn anim_off(&self) -> bool

g_anim_off: animations off (–anim off, the settings) // pn-core

Source

pub fn set_anim_off(&mut self, off: bool)

Source

pub fn headless(&self) -> bool

ui_headless: running without a window (–shot / –script)

Source

pub fn invalidate(&mut self)

ui_invalidate: request a new frame (state changed outside the callbacks)

Source

pub fn quit(&mut self)

ui_quit: leave the main loop after this frame

Source

pub fn set_title(&mut self, s: &str)

ui_set_title(s): change the window title (kept for title() / title bars; 255 bytes)

Source

pub fn title(&self) -> &str

ui_title: the window title (the AppDesc title until set_title)

Source§

impl Ui

Source

pub fn monitors(&mut self) -> Vec<Monitor>

every monitor, the primary one first

Source

pub fn hotkeys_available(&mut self) -> bool

whether global shortcuts work here

Source

pub fn hotkey_register( &mut self, id: u32, chord: &str, description: &str, ) -> Result<(), HotkeyError>

register chord (“Ctrl+Alt+K”) as the global shortcut id; description tells the user what it does (the desktop’s dialog shows it)

Source

pub fn hotkey_unregister(&mut self, id: u32) -> bool

remove the global shortcut id -> false when it was not registered

Source

pub fn hotkey_error(&self, id: u32) -> Option<HotkeyError>

why the desktop dropped the shortcut id (after UIC_HOTKEY_LOST)

Source

pub fn pick_available(&self) -> bool

whether the user can pick a colour anywhere on the screen here (headless: yes, the script answers)

Source

pub fn pick_color(&mut self) -> bool

the user picks a pixel anywhere on the screen; UIC_PICK reports the end -> false when that is not possible here (or a pick runs)

Source

pub fn picked_color(&mut self) -> Option<u32>

the colour of the last pick (0xRRGGBB), once

Source

pub fn screenshot(&mut self, rect: Option<[i32; 4]>) -> bool

a picture of the whole desktop (None) or of a rectangle (desktop units); UIC_SCREENSHOT reports it -> false when that is not possible here

Source

pub fn screenshot_take(&mut self) -> Option<Surface>

the picture of the last screenshot, once

Source

pub fn screen_error(&self) -> Option<ScreenError>

why the last pick or picture failed (None: it worked or was not asked for)

Source§

impl Ui

Source

pub fn scroll_copy_begin(&mut self, id: u32, ox: i64, oy: i64)

ui_scroll_copy_begin(id, ox, oy): the commands recorded until scroll_copy_end are the content of scroll view id; (ox, oy) = the window px of the content’s origin (its position minus the scroll offset). Call right after the view’s clip. When only the origin moved between two frames, pixels still shown may be moved in the framebuffer instead of drawn again (content that does not move with the origin is simply drawn).

Source

pub fn scroll_copy_end(&mut self)

ui_scroll_copy_end: the end of the content of scroll_copy_begin

Source§

impl Ui

Source

pub fn taskbar_progress(&mut self, p: TaskbarProgress) -> bool

show progress on the app’s taskbar button -> false: not shown here

Source

pub fn taskbar_badge(&mut self, n: u32) -> bool

a badge with n on the app’s taskbar button (0: none) -> false: not shown here

Source

pub fn taskbar_tasks(&mut self, tasks: &[JumpTask]) -> bool

the tasks of the button’s jump list (empty: none) -> false: no jump list here

Source§

impl Ui

Source

pub fn spawn<F: Future + 'static>(&self, fut: F) -> Task<F::Output> ⓘ

run fut on the UI thread between passes; App::frame polls the handle (dropping it cancels the task, Task::detach lets it run on)

Source

pub fn spawner(&self) -> Spawner

a handle that spawns UI tasks from inside tasks

Source

pub fn tasks_live(&self) -> usize

tasks spawned and not finished

Source§

impl Ui

Source

pub fn mono_font_set(&mut self, font: u32)

the monospace font of every console (a font id, e.g. from ui.text.load_mem)

Source

pub fn mono_font(&mut self, size_pt: f32) -> (u32, i32)

the consoles’ monospace font at size_pt points -> (font id, cell width px): the font of mono_font_set, else the system’s “monospace”, else FONT_REG (drawn cell by cell)

Source

pub fn terminal( &mut self, id: u32, st: &mut TermState, flags: u32, ) -> Vec<TermEv>

ui_terminal(id, st, flags) -> events: the console (see the module header)

Source§

impl Ui

Source

pub fn touch_mode(&self) -> bool

ui_touch_mode: the pointer is a finger (the last pointer event came from one; on Android and in a phone’s browser from the start): the library shows no scroll bars. A mouse ends it

Source

pub fn touch_drag(&mut self)

ui_touch_drag: a finger that starts on the last widget’s rectangle drags in every direction instead of rolling what is around it: for a part of a widget that has no hit box of its own (the handle of a list’s row). Sliders, colour wheels, splitters and the like take the finger by themselves. Call it after the widget, every frame

Source

pub fn touch_take(&mut self, flags: u32)

ui_touch_take(flags): what the last widget (all hit boxes in its rectangle) wants of a finger, TF_*, instead of what its hit boxes say by themselves. Call it after the widget, every frame

Source

pub fn touch_fingers(&self) -> Vec<Finger>

ui_touch_fingers: the fingers down on the live window, the first one first (a widget with TF_TWO gets a pass whenever one moves)

Source

pub fn touch_two(&mut self) -> Option<TwoFingers>

ui_touch_two: two fingers on the last widget (it said TF_TWO; call it after the widget, every frame): where they are and how far apart. None while the first finger drags the widget: a stroke older than 200 ms goes on, the second finger waits

Source

pub fn touch_hold_part(&self, id: u32) -> Option<u32>

ui_touch_hold_part(id) -> how far a finger’s press and hold on widget id of this window is, in 1/1000 (TF_HOLD_LONG): None without one, 1000 once the drag runs. Show it: it is long without a sign

Source§

impl Ui

Source

pub fn theme_set(&mut self, mode: u32)

ui_theme_set(mode): 0 light, 1 dark, 2 the system setting (unknown: dark)

Source

pub fn theme_dark(&self) -> bool

ui_theme_dark: the dark theme is active

Source

pub fn accent_set(&mut self, rgb: u32)

ui_accent_set(0xRRGGBB), 0 = the style’s default; the system’s accent no longer applies

Source

pub fn high_contrast(&self) -> bool

the high-contrast theme is active

Source

pub fn set_contrast(&mut self, on: Option<bool>)

high contrast on (Some(true)), off (Some(false)) or as the system says (None)

Source

pub fn set_reduced_motion(&mut self, on: Option<bool>)

reduced motion on (Some(true): no tweens, no fades), off (Some(false)) or as the system says (None); like –anim, a forced value outlasts the system’s changes

Source

pub fn text_scale(&self) -> u32

the text scale in percent (100 = the style’s sizes)

Source

pub fn font_prefs(&self) -> (Option<bool>, Option<u8>, Option<u8>)

the system’s font rendering: (smoothing, plat::FONT_HINT_, plat::FONT_RGBA_), None where the system says nothing; smoothing off (ui.text.antialias()) and the subpixel order (ui.text.subpixel(): subpixel smoothing on the window’s framebuffer) are applied, hinting is not

Source

pub fn set_text_scale(&mut self, percent: u32)

scale text sizes and line heights (50..300 %); the system’s scale no longer applies

Source

pub fn color(&self, tok: u32) -> u32

ui_color(tok): 0xAARRGGBB of a token (byte offset; any value reads inside the table)

Source

pub fn ts_font(&mut self, ts: u32)

ui_ts_font(ts): select the font and pixel size (size * dpi / 96, 24.8) of a style

Source

pub fn ts_line(&self, ts: u32) -> i32

ui_ts_line(ts): line height of a text style in px

Source

pub fn set_theme(&mut self, th: &Theme) -> Result<(), ThemeError>

the app’s theme over the style (theme_app.rs) from the next frame on: colours of light, dark and high contrast, the accent, corners, spacing, control heights, text styles and a font family. A font that cannot be loaded is an error; the previous theme stays.

Source

pub fn clear_theme(&mut self)

no app theme: the style’s own look again

Source

pub fn app_theme(&self) -> Option<&Theme>

the active app theme (None: the style’s look)

Source

pub fn load_theme(&mut self, path: &str) -> Result<(), ThemeError>

read a theme file (app://, config://, a path) and make it the app’s theme; on an error the previous theme stays

Source

pub fn styles_add(&mut self, styles: &[&'static dyn Style])

the styles set_style can switch to: the app names the style crates it links besides its own (build_rs.py links every style_NAME its sources name): ui.styles_add(&[&style_classic::STYLE, &style_kde::STYLE])

Source

pub fn style_names(&self) -> Vec<&'static str>

the names of the styles set_style knows (the app’s own first, then as added)

Source

pub fn style_name(&self) -> &'static str

the name of the style in use (Style::name)

Source

pub fn set_style(&mut self, name: &str) -> bool

switch to another linked style (styles_add) from the next frame on: its tokens, fonts, metrics and painters; the app theme stays on top -> false: no such style

Source

pub fn dp_text(&self, dip: i32) -> i32

dp_text(dip): DIP -> px, grown with a text scale above 100 % (the height of parts around one line of text, such as badge pills)

Source

pub fn ts_base(&mut self, ts: u32) -> i32

ui_ts_base(ts): baseline offset from the top of the line box (px; selects the font)

Source§

impl Ui

Source

pub fn timeline( &mut self, id: u32, st: &mut TimelineState, span: (f64, f64), tracks: &[TlTrack<'_>], ) -> u32

ui_timeline(id, &mut st, span, tracks) -> EV_*: a time axis, a lane of event ticks per track and a playhead (st.t) to seek with (see the module header of timeline.rs)

Source§

impl Ui

Source

pub fn tray_set( &mut self, icon: Option<&Surface>, tooltip: &str, menu: &[Mi], ) -> bool

show or update the symbol in the notification area -> false: there is none here

Source

pub fn tray_remove(&mut self)

take the symbol away

Source

pub fn notify(&mut self, title: &str, body: &str, icon: Option<&Surface>) -> u32

a system notification -> its id (0: not shown); UIC_NOTE / UIC_NOTE_GONE report it

Source

pub fn notify_close(&mut self, id: u32)

take a notification away

Source

pub fn tray_supported(&self) -> bool

whether this system shows the symbol (a notification area; GNOME: only with the AppIndicator extension); notifications work without one

Source

pub fn bring_to_front(&mut self)

restore the main window when it is minimised and activate it

Source§

impl Ui

Source

pub fn cmd_track(&mut self, x: i32, y: i32, w: i32, h: i32, tk: &Track)

cmd_custom of a value slider’s gradient track over (x, y, w, h): the track’s own drawing (TK_CUSTOM) or the gradient (track_cb, version = track_hash) [styles’ value.s]

Source

pub fn decimal_sep(&self) -> u32

ui_decimal_sep: the separator fmt_f64 shows (and parse_f64 accepts besides ‘,’ / ‘.’)

Source

pub fn set_decimal_sep(&mut self, c: u32)

set ui_decimal_sep (a code point)

Source

pub fn fmt_f64(&self, v: f64, decimals: u32) -> String

ui_fmt_f64(&v, decimals) -> fixed decimals with the decimal separator; -0 is shown as 0

Source

pub fn parse_f64(&self, s: &str) -> Option<f64>

ui_parse_f64(s) -> the value, or None when s has no digits. Blanks, a sign, digits, one ‘,’ or ‘.’ (or the decimal separator when ASCII), digits.

Source

pub fn slider_f(&mut self, id: u32, v: &mut f64, rf: &RangeF) -> u32

ui_slider_f(id, &mut v, &rf) -> EV_*

Source

pub fn track_slider( &mut self, id: u32, v: &mut i32, rg: &Range, track: Option<&Track>, ) -> u32

ui_track_slider(id, &mut v, &rg, track) -> EV_*: i32 slider with a gradient track (None = the standard look)

Source

pub fn prop_slider( &mut self, id: u32, label: &str, v: &mut i32, rg: &Range, default: i32, ) -> u32

ui_prop_slider(id, label, &mut v, &rg, default) -> EV_* (default NO_DEFAULT: no reset button)

Source

pub fn prop_slider_f( &mut self, id: u32, label: &str, v: &mut f64, rf: &RangeF, default: Option<f64>, ) -> u32

ui_prop_slider_f(id, label, &mut v, &rf, default) -> EV_* (default None: no reset button)

Source

pub fn angle(&mut self, id: u32, deg: &mut f64, flags: u32) -> u32

ui_angle(id, &mut deg, flags) -> EV_*

Source

pub fn pan( &mut self, id: u32, x: &mut f64, y: &mut f64, thumb: Option<&Rc<Surface>>, ver: u32, flags: u32, ) -> u32

ui_pan(id, &mut x, &mut y, thumb, ver, flags) -> EV_* (thumb: a surface or None; ver stands for its version, as in draw_image)

Source§

impl Ui

Source

pub fn window_title_height(&self, flags: u32) -> i32

uiw_drawable(i): the window exists and is shown (the main window: always) the title bar of a window with these WF_* flags that draws its own (DIP): the style’s, higher with a finger, and the window grows with it (lay out what lies below it with this height)

Source

pub fn window_begin( &mut self, id: u32, title: &str, open: Option<&Shared<i32>>, flags: u32, rect: Option<&Shared<WinRect>>, ) -> bool

ui_window_begin(id, title, open, flags, rect) -> true: the window is shown, emit its content now (window_end always follows). open None = always open; rect None: the library keeps the placement. The owner is the window being built.

Source

pub fn window_end(&mut self)

ui_window_end: close window_begin (also when it returned false)

Source

pub fn sync_hook_set(&mut self, f: Option<fn() -> bool>)

ui_sync_hook_set(f): f() -> true while background jobs are pending (the script command sync waits for false)

Source

pub fn window_place(&mut self, id: u32, rect: &WinRect)

ui_window_place(id, &rect): set the window’s placement (copied into its WINRECT; applied when it is built next). id 0: the main window (headless: its size)

Source

pub fn window_snap(&mut self, id: u32, area: [i32; 4], dist: i32)

ui_window_snap(id, area, dist): while the user moves window id, its outer edges snap to the edges of area (x, y, w, h in DIP of the owner’s client area, like its WINRECT) once they are at most dist DIP away – both axes at a corner; dist 0 turns it off. Live where the platform lets the UI see the move (Windows: WM_MOVING) and for scripts (movewin); a window manager that moves the windows itself (X11, Wayland) and the browser do not snap. Call it in every frame the area may change (after the window’s first window_begin).

Source

pub fn window_rect(&self, id: u32) -> Option<WinRect>

ui_window_rect(id) -> the window’s placement (None = unknown window)

Source

pub fn window_state(&mut self, id: u32) -> u32

ui_window_state(id) -> UWS_OPEN | UWS_VISIBLE | UWS_ACTIVE | UWS_MINIMIZED | UWS_FULLSCREEN (0 unknown)

Source

pub fn window_fullscreen(&mut self, id: u32, on: bool)

(L7) window_fullscreen(id, on): show the window (0 = the main window, else the app’s window id) over its whole monitor without a frame, or back to its place and frame as before. window_state reports UWS_FULLSCREEN at once; the platform follows after the frame: Windows a borderless window over the window’s monitor (the old placement and style come back), X11 _NET_WM_STATE_FULLSCREEN, Wayland xdg_toplevel set_fullscreen / unset_fullscreen, the browser its Fullscreen API (only from the user’s gesture: a key or a click that just happened). A tool window drops its library title bar and border meanwhile. When the platform or the user leaves (or enters) full screen by itself (Esc in the browser, the window manager), the state follows and UIC_FULLSCREEN arrives (arg = the window’s id). Headless runs only record it (scripts: expect window ID fullscreen, system fullscreen off). Nothing happens on Android and for Wayland tool windows drawn inside their owner (WST_CHILD). F11 is the app’s key for it (GUIDE).

Source

pub fn window_activate(&mut self, id: u32)

ui_window_activate(id): give the window the keyboard and put it on top

Source

pub fn window_destroy(&mut self, id: u32)

ui_window_destroy(id): hide the window and free its state and buffers (not while it is being built)

Source

pub fn window_current(&self) -> u32

ui_window_current -> id of the window being built (0 = main window)

Source

pub fn window_modal(&self) -> u32

ui_window_modal -> id of the topmost modal window, 0 = none

Source

pub fn window_pw(&self, id: u32) -> (i32, i32)

uiw_index + uiw_pw: (UI index of app window id (-1 none, 0 the main window), its platform window (-1 none)) // pn-core

Source§

impl Ui

Source

pub fn state_save(&mut self, ini: &mut Ini)

write the placement of the main window and of the tool windows into ini (see the module header)

Source

pub fn state_load(&mut self, ini: &Ini)

read the placements of state_save back (the main window now, the tool windows when window_begin meets them)

Source§

impl Ui

Source

pub fn desk_begin(&mut self, id: u32, st: &mut DeskState, wins: &[DeskWin<'_>])

desk_begin(id, &mut st, wins): open the window area (always pair with desk_end; fill it with desk_next). It takes the next place of the box (the whole rest when no size was set); wins: every open window, each frame (titles and icons may change), in the order the taskbar shows them.

Source

pub fn desk_next(&mut self, st: &mut DeskState) -> Option<u32>

desk_next(&mut st) -> the next window to fill (None: done), from the back to the front; its content goes into a vertical box (it clips) until the next call

Source

pub fn desk_end(&mut self, st: &mut DeskState) -> Vec<DeskEv>

desk_end(&mut st) -> what the user did in this pass (and the taskbar since the last desk_end): close requests, activation, moves, resizes, state changes

Source

pub fn desk_taskbar_begin(&mut self, id: u32)

desk_taskbar_begin(id): open a taskbar for desk id (always pair with desk_taskbar_end): a row with the style’s taskbar surface; the app’s items and desk_taskbar go inside. Inside desk_begin .. desk_end without next_size / next_rect it takes the area’s reserved strip (DeskState::set_reserve: the bottom one, else the top one), else the next place, TASK_H DIP high unless next_size says otherwise.

Source

pub fn desk_taskbar_end(&mut self)

desk_taskbar_end

Source

pub fn desk_taskbar(&mut self, id: u32, st: &mut DeskState, flags: u32)

desk_taskbar(id, &mut st, flags): the buttons of desk id’s windows (DTB_*), in the order of desk_begin’s list; without a size they take the room the row leaves. Their changes apply at once; desk_end reports them.

Source§

impl Ui

Source

pub fn action_card(&mut self, id: u32, name: &str, d: &CardDesc<'_>) -> u32

action_card(id, name, &desc) -> EV_*: a card or list row that does one thing (the top of action_card.rs); next_size sets its width, next_flags ST_SUBTLE, ST_CHECKED, ST_DISABLED

Auto Trait Implementations§

§

impl !Freeze for Ui

§

impl !RefUnwindSafe for Ui

§

impl !Send for Ui

§

impl !Sync for Ui

§

impl !UnwindSafe for Ui

§

impl Forget for Ui

§

impl Unpin for Ui

§

impl UnsafeUnpin for Ui

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.