JFLib

Constants#

Source: lib/ui/consts.rs

consts -- public constants of the immediate-mode UI                (ASMLIB/inc/ui.inc)

Widget calls return event flags.  Bit 0 (EV_ACT) always means "the primary action
happened" (clicked, changed, selected, closed).  Sizes and positions given to the UI are
DIP (device independent pixels, 96 dpi = 100 %); drawing calls and last_rect use
physical pixels.

widget events

EV_ACT: u32 = 1  // primary action (click / change / select / close)
EV_COMMIT: u32 = 2  // value committed (drag released, Enter, focus lost)
EV_HOVER: u32 = 4  // pointer is over the widget
EV_HELD: u32 = 8  // pressed and still held
EV_FOCUS: u32 = 16  // widget has keyboard focus
EV_DOUBLE: u32 = 32  // double click
EV_RCLICK: u32 = 64  // right click (released over the widget)
EV_OPEN: u32 = 128  // a popup / dropdown opened
EV_DRAG: u32 = 256  // being dragged (moved while held)

hit box flags (behave)

HB_FOCUS: u32 = 1  // reachable with Tab, takes focus on click
HB_BLOCK: u32 = 2  // swallows the pointer (panels, popups)
HB_DRAG: u32 = 4  // window drag region (title bar)
HB_TEXT: u32 = 8  // text input (gets all keys while focused)
HB_MOVES: u32 = 16  // wants a frame on every pointer move while hovered
HB_DISABLED: u32 = 32  // disabled: visible to the dump, no input
HB_MIN: u32 = 64  // caption buttons (for the OS: snap layouts, etc.)
HB_MAX: u32 = 128
HB_CLOSE: u32 = 256
// keyboard (kbnav.rs): a focusable box that is not a Tab stop (focus(id), arrows of its group
// reach it); the current member of a focus group (Tab enters the group there: the checked
// radio / tool button, the selected swatch); a splitter grip (F8 reaches it, arrows move it)
HB_NOTAB: u32 = 512
HB_CURRENT: u32 = 1024
HB_SPLITTER: u32 = 2048
HB_CURSOR_SHIFT: u32 = 12  // cursor shape: flags | CUR_* << HB_CURSOR_SHIFT
// behave only (not kept in the hit list): Space acts, Enter does not (check boxes, radios,
// switches: Enter belongs to the dialog's default button); Space and Enter are the widget's
// own (lists, grids, trees: behave gives no EV_ACT for them)
HB_SPACE: u32 = 0x10000
HB_OWNKEYS: u32 = 0x20000
// behave only: a finger moving along this axis belongs to the widget, not to the scroll view
// around it (touch.rs; the cursors of splitters, text and crosshairs say so by themselves)
HB_GRAB_H: u32 = 0x40000
HB_GRAB_V: u32 = 0x80000
// every key is the widget's while it has the focus and no popup of the window is open (a menu
// keeps its keys), Ctrl + letter, Tab and the arrows too: no accelerator, no keyboard
// navigation, no Enter / Space action and no ui.undo_keys takes one (a canvas that shows a web
// page takes them with ui.key_take; ui.accel_run hands one back to the command table).  Unlike
// HB_TEXT no text box rules: no reserved keys, no input method, no on-screen keyboard.  A
// canvas takes it from next_flags.
HB_KEYS: u32 = 0x10_0000
// canvas only (next_flags): its cursor bits as given, CUR_ARROW (0) included; without it 0 is the
// crosshair
HB_CURSOR_SET: u32 = 0x20_0000

the finger (touch.rs)

// ui.touch_take(flags) after a widget, instead of what its hit box says by itself: TF_V / TF_H a
// finger moving along this axis is the widget's (not the scroll view's around it); with both the
// press comes with the touch, unless TF_SLOP (only once the finger moved) or TF_HOLD (only after
// resting for the long-press time: a panel that starts to move then, until then the finger goes
// to what is around it); TF_HOLD_LONG the same after 600 ms (a panel's title bar; ui.touch_hold_part
// shows it); TF_REST a finger that rests presses like one that moved, no context menu (a canvas); TF_TWO
// a second finger is the widget's: no press, no click, it reads ui.touch_two or ui.touch_fingers (pan and
// zoom); TF_DECLINE no drag at all, a tap still clicks.  0: nothing special (the finger rolls what is
// around it, with nothing to roll it drags the widget).
TF_V: u32 = 1
TF_H: u32 = 2
TF_BOTH: u32 = 3
TF_HOLD: u32 = 4
TF_TWO: u32 = 8
TF_SLOP: u32 = 16
TF_DECLINE: u32 = 32
TF_REST: u32 = 64
TF_HOLD_LONG: u32 = 128

the device (form.rs)

// ui.form_factor(): what the app runs on -- a desktop (however small its window), a tablet, a phone
FF_DESKTOP: u32 = 0
FF_TABLET: u32 = 1
FF_PHONE: u32 = 2

semantic kinds and states

K_BOX: u16 = 0
K_TEXT: u16 = 1
K_BUTTON: u16 = 2
K_CHECKBOX: u16 = 3
K_RADIO: u16 = 4
K_SWITCH: u16 = 5
K_SLIDER: u16 = 6
K_PROGRESS: u16 = 7
K_TEXTBOX: u16 = 8
K_MENU: u16 = 9
K_MENUITEM: u16 = 10
K_LIST: u16 = 11
K_LISTITEM: u16 = 12
K_TAB: u16 = 13
K_CANVAS: u16 = 14
K_ICON: u16 = 15
K_IMAGE: u16 = 16
K_COMBO: u16 = 17
K_DIALOG: u16 = 18
K_TITLEBAR: u16 = 19
K_SWATCH: u16 = 20
K_LINK: u16 = 21
/// a heading of a document or section (value: its level, 1 the top; md_view.rs, Ui::heading)
K_HEADING: u16 = 22
/// the number of KIND_NAMES (the kinds K_BOX ..= K_HEADING); the kinds of web content K_TABLE ..=
/// K_FIGURE follow it (KIND_NAMES_MORE, kind_name names them all)
K_KIND_COUNT: u16 = 23
// (section 19 of the guide) the kinds of a web page's accessibility tree; a screen reader gets
// each with a role of its own where the platform has one (UI Automation, AT-SPI2, the browser)
/// a table or grid (Sem::grid: its rows and columns) and a row of it
K_TABLE: u16 = 23
K_ROW: u16 = 24
/// a cell (label: what it says; Sem::cell: its row and column), a column header, a row header
K_CELL: u16 = 25
K_COLHEADER: u16 = 26
K_ROWHEADER: u16 = 27
/// a landmark of a page (value: LM_*; label: its name)
K_LANDMARK: u16 = 28
/// a tree and one of its items (Sem::level: its depth; AS_COLLAPSED / SS_OPEN: closed / open)
K_TREE: u16 = 29
K_TREEITEM: u16 = 30
/// a group of radio buttons, a tool bar, a tooltip (label: its text), a separator
K_RADIOGROUP: u16 = 31
K_TOOLBAR: u16 = 32
K_TOOLTIP: u16 = 33
K_SEPARATOR: u16 = 34
/// live regions: an alert (said at once), a status line and a log (said when the person is
/// idle); label: their text (Sem::live changes how they speak)
K_ALERT: u16 = 35
K_STATUS: u16 = 36
K_LOG: u16 = 37
/// a meter (value of min ..= max, as a progress bar), a spin button and a scroll bar (value, min,
/// max as a slider; Sem::range for fractions)
K_METER: u16 = 38
K_SPIN: u16 = 39
K_SCROLLBAR: u16 = 40
/// an article, a figure (label: their names)
K_ARTICLE: u16 = 41
K_FIGURE: u16 = 42
/// the end of the K_* kinds (one past K_FIGURE)
K_KIND_END: u16 = 43
SS_HOVER: u16 = 1
SS_PRESSED: u16 = 2
SS_FOCUSED: u16 = 4
SS_CHECKED: u16 = 8
SS_DISABLED: u16 = 16
SS_SELECTED: u16 = 32
SS_OPEN: u16 = 64
/// names of the K_* kinds (dump, selectors kind:"Label")
KIND_NAMES: [&str; 23] = [ "box", "text", "button", "checkbox", "radio", "switch", ...
/// names of the kinds K_TABLE ..= K_FIGURE (dump, selectors kind:"Label")
KIND_NAMES_MORE: [&str; 20] = [ "table", "row", "cell", "colheader", "rowheader", "land ...
  • fn kind_name(kind: u16) -> &'static str the name of a K_* kind (dump, selectors kind:"Label"); "box" for an unknown one
/// names of the SS_* state bits (dump)
STATE_NAMES: [&str; 7] = ["hover", "pressed", "focused", "checked", "disabled", "s ...
// K_LANDMARK's value: the kind of landmark (0: a named region)
LM_REGION: i32 = 0
LM_BANNER: i32 = 1
LM_MAIN: i32 = 2
LM_NAVIGATION: i32 = 3
LM_COMPLEMENTARY: i32 = 4
/// the content information (a page's footer)
LM_CONTENTINFO: i32 = 5
LM_SEARCH: i32 = 6
LM_FORM: i32 = 7
// Sem::states: what a record is beyond its kind and SS_* state (section 19 of the guide)
/// a field that must be filled in
AS_REQUIRED: u32 = 1
/// a field whose content is not valid
AS_INVALID: u32 = 2
/// its content is being changed (a live region says nothing meanwhile)
AS_BUSY: u32 = 4
/// it opens a popup (a menu, a list, a dialog)
AS_HASPOPUP: u32 = 8
/// a link to an address that was visited
AS_VISITED: u32 = 16
/// a modal dialog
AS_MODAL: u32 = 32
/// a list, tree or table that allows several selected items
AS_MULTISELECT: u32 = 64
/// it can be expanded and is closed now (SS_OPEN: it is open)
AS_COLLAPSED: u32 = 128
/// outside the visible area (scrolled away, clipped by its scroll box): a screen reader's
/// browse mode reaches it, the pointer does not
AS_OFFSCREEN: u32 = 256
/// it takes the keyboard focus (a kind that does not anyway: a cell of a grid, an element with a
/// tabindex)
AS_FOCUSABLE: u32 = 512
/// a click does something (a kind that does not say so: a cell, a row, an element with a click
/// handler)
AS_CLICKABLE: u32 = 1024
/// it can be selected (rows and cells of a grid; list rows, tree items and tabs are anyway)
AS_SELECTABLE: u32 = 2048
/// a text box: read-only / with several lines / a password (as TB_* of a built-in box)
AS_READONLY: u32 = 4096
AS_MULTILINE: u32 = 8192
AS_PASSWORD: u32 = 16384
// Sem::live and ui.announce: how a live region / an announcement is said (0 for Sem::live: as
// its kind says -- K_ALERT assertive, K_STATUS and K_LOG polite, the others not at all)
LIVE_POLITE: u32 = 1
LIVE_ASSERTIVE: u32 = 2
/// (Sem::live) not a live region (an app that announces its changes itself, ui.announce)
LIVE_OFF: u32 = 3

layers

L_BASE: u32 = 0
L_DIALOG: u32 = 1
L_POPUP: u32 = 2
L_TIP: u32 = 3
L_COUNT: usize = 4

box flags (box_begin)

BOX_H: u32 = 0  // children left to right
BOX_V: u32 = 1  // children top to bottom
BOX_CENTER: u32 = 2  // centre children along the main axis
BOX_END: u32 = 4  // align children to the end of the main axis
BOX_XCENTER: u32 = 8  // cross axis: centre children (default: stretch)
BOX_XSTART: u32 = 16  // cross axis: natural size at the start
BOX_XEND: u32 = 32  // cross axis: natural size at the end
BOX_CARD: u32 = 64  // draw a card (fill + stroke, 8 DIP corners)
BOX_BG: u32 = 128  // fill with the window background colour
BOX_CLIP: u32 = 256  // clip children to the box
BOX_BLOCK: u32 = 512  // swallow pointer input over the box
BOX_DISABLED: u32 = 1024  // disable every widget inside
BOX_LAYER: u32 = 2048  // fill with the layer colour (command bars)
BOX_WRAP: u32 = 4096  // (horizontal) start a new row when full
BOX_FIXED: u32 = 8192  // the box's size never depends on its content
// grid flags (gridbox_begin, with the box decorations and padding): the children's alignment
GRID_H_START: u32 = 2  // horizontal (default: stretched across the cell)
GRID_H_CENTER: u32 = 4
GRID_H_END: u32 = 6
GRID_V_START: u32 = 8  // vertical (default: centred)
GRID_V_END: u32 = 16
GRID_V_STRETCH: u32 = 24
// next_align(h, v): one grid child's alignment
AL_DEFAULT: u32 = 0  // the grid's
AL_START: u32 = 1
AL_CENTER: u32 = 2
AL_END: u32 = 3
AL_STRETCH: u32 = 4
PAD_SHIFT: u32 = 16  // padding in DIP: flags | N << PAD_SHIFT
PAD_2: u32 = 2 << 16
PAD_4: u32 = 4 << 16
PAD_8: u32 = 8 << 16
PAD_12: u32 = 12 << 16
PAD_16: u32 = 16 << 16
PAD_20: u32 = 20 << 16
PAD_24: u32 = 24 << 16
PAD_32: u32 = 32 << 16
  • const fn pad(dip: u32) -> u32 padding in DIP for box_begin flags: BOX_V | pad(24)
// easing curves (ease, anim_ex, anim_color)
EASE_OUT: u32 = 0  // fast start, soft stop (quadratic; anim's)
EASE_LINEAR: u32 = 1
EASE_IN: u32 = 2  // soft start (quadratic)
EASE_IN_OUT: u32 = 3  // soft start and stop (cubic)
EASE_OUT_CUBIC: u32 = 4  // a softer stop than EASE_OUT
EASE_OUT_BACK: u32 = 5  // overshoots a little, then settles
// next_size values: > 0 fixed DIP, 0 = natural size, < 0 = fill weight
SIZE_AUTO: i32 = 0
SIZE_FILL: i32 = -1

text styles (text)

TS_CAPTION: u32 = 0  // 12 / 16
TS_BODY: u32 = 1  // 14 / 20
TS_BODY_STRONG: u32 = 2  // 14 / 20 semibold
TS_SUBTITLE: u32 = 3  // 20 / 28 semibold
TS_TITLE: u32 = 4  // 28 / 36 semibold
TS_TITLE_LARGE: u32 = 5  // 40 / 52 semibold
TS_DISPLAY: u32 = 6  // 68 / 92 semibold
TS_COUNT: u32 = 7
TX_SECONDARY: u32 = 0x100  // secondary text colour
TX_TERTIARY: u32 = 0x200
TX_ACCENT: u32 = 0x400  // accent text colour
TX_WRAP: u32 = 0x800  // wrap at the box width
TX_ELLIPSIS: u32 = 0x1000  // cut with "…" when too long
TX_CENTER: u32 = 0x2000  // horizontal alignment
TX_RIGHT: u32 = 0x4000
TX_DISABLED: u32 = 0x8000
TX_ON_ACCENT: u32 = 0x10000  // text on an accent fill (T_ON_ACCENT)
TX_HYPHENATE: u32 = 0x20000  // with TX_WRAP: hyphenate words that do not fit (hyph.rs)

widget style flags (next_flags)

ST_DISABLED: u32 = 1
ST_LARGE: u32 = 2  // icon button: big icon above the label
ST_SUBTLE: u32 = 4  // transparent button (toolbar style)
ST_ACCENT: u32 = 8  // accent button
ST_CHECKED: u32 = 16  // toggle / tool buttons: checked look
ST_COMPACT: u32 = 32  // smaller height
ST_NOFOCUS: u32 = 64  // not reachable with Tab
ST_ICON_ONLY: u32 = 128  // hide the label (tooltip only)
ST_ALIGN_START: u32 = 256  // start-aligned button content; styles may ellipsize long labels
/// Button displayed on an accent-colored surface, using its on-accent foreground.
ST_ON_ACCENT: u32 = 512
/// Button with a menu indicator beside its label; use the normal popup API for behavior.
ST_MENU: u32 = 1024
/// Rounded identity/action button; supporting styles use a circular or pill surface.
ST_ROUND: u32 = 2048

built-in commands (App::command ids)

UIC_CLOSE: u32 = 0x7FFF_0001  // window close requested: return true to keep the window
UIC_THEME: u32 = 0x7FFF_0002  // theme changed
UIC_DPI: u32 = 0x7FFF_0003  // dpi changed
UIC_ESCAPE: u32 = 0x7FFF_0004  // Esc not consumed by any widget
UIC_TIMER: u32 = 0x7FFF_0005  // arg = timer id
UIC_WINCLOSE: u32 = 0x7FFF_0006  // arg = window id: close requested; true keeps it
UIC_DROP: u32 = 0x7FFF_0007  // arg = window id: files dropped (drop_*)
UIC_JOB: u32 = 0x7FFF_0008  // arg = job id finished
UIC_WAKE: u32 = 0x7FFF_0009  // plat::wake() from another thread
UIC_EXIT: u32 = 0x7FFF_000A  // the window loop ends (only after a real window ran)
UIC_OPEN: u32 = 0x7FFF_000B  // arg = requests: later starts of the app (AF_SINGLE_INSTANCE, open_take)
UIC_TRAY: u32 = 0x7FFF_000C  // the notification-area symbol: arg = TRAY_ACTIVATE / TRAY_SECONDARY (tray_set)
UIC_NOTE: u32 = 0x7FFF_000D  // arg = id: a system notification was clicked (notify)
UIC_NOTE_GONE: u32 = 0x7FFF_000E  // arg = id: a notification went away unclicked
// lifecycle (runtime.rs)
UIC_ACTIVE: u32 = 0x7FFF_000F  // arg 1: one of the app's windows got the keyboard, 0: none has it
UIC_SUSPEND: u32 = 0x7FFF_0010  // arg 1: the system goes to sleep, 2: the app went to the background (browser, Android), 0: it woke up / is back
UIC_SESSION_END: u32 = 0x7FFF_0011  // logout / shutdown / SIGTERM: save now; UIC_EXIT and the end follow
UIC_SETTINGS: u32 = 0x7FFF_0012  // arg = plat::SET_* bits: system settings changed (theme and format already applied)
// drag and drop (dnd.rs)
UIC_DRAG_END: u32 = 0x7FFF_0013  // arg = DE_* effect (0 = cancelled / refused): a drag of the app ended
// permissions (perm.rs)
UIC_PERMISSION: u32 = 0x7FFF_0014  // arg 1 allowed, 0 refused: the user answered a permission question (try the access again)
// the screen and global shortcuts (screen.rs)
UIC_HOTKEY: u32 = 0x7FFF_0015  // arg = id: a global shortcut was pressed (hotkey_register)
UIC_HOTKEY_LOST: u32 = 0x7FFF_0016  // arg = id: the desktop dropped the shortcut (hotkey_error tells why)
UIC_PICK: u32 = 0x7FFF_0017  // arg 1: a colour was picked (picked_color), 0: cancelled / failed (pick_color)
UIC_SCREENSHOT: u32 = 0x7FFF_0018  // arg 1: the picture is there (screenshot_take), 0: failed (screen_error)
UIC_RECENT: u32 = 0x7FFF_0019  // arg 1: the file of recent_open is readable now (recent_reopened), 0: refused or gone
UIC_SENSOR: u32 = 0x7FFF_001B  // arg = plat::sensors::SENSOR_* bits: new readings or another state (plat::sensors::read, state)
UIC_LOCATION: u32 = 0x7FFF_001C  // arg = plat::sensors::LocationState: a new fix or another state (location_fix)
UIC_GAMEPAD: u32 = 0x7FFF_001E  // arg = index | plat::PADEV_CONNECT / PADEV_DISCONNECT << 8: a game pad came or went (ui.gamepads)
UIC_A11Y: u32 = 0x7FFF_001D  // arg 1: a screen reader (an accessibility client) came, 0: it left (ui.a11y_active), also while the app is idle
TRAY_ACTIVATE: u32 = 1  // UIC_TRAY: the symbol was clicked
TRAY_SECONDARY: u32 = 2  // UIC_TRAY: double click (Windows) / middle click (Linux)

drag and drop (dnd.rs)

// drag_source / drop_target states; the kinds DT_* and effects DE_* come from plat (dnd.rs)
DS_START: u32 = 1  // drag_source: the widget starts being dragged (call drag_set now)
DS_ACTIVE: u32 = 2  // drag_source: the widget's content is being dragged
DS_END: u32 = 4  // drag_source: the drag ended (once; drag_effect() tells how)
DS_HOVER: u32 = 8  // drop_target: a matching drag is over the widget (highlighted)
DS_DROP: u32 = 16  // drop_target: dropped onto the widget (drop_data(), drop_effect())
/// drop_defer: how long a drop's answer to its source may wait for drop_finish (ms); then it goes
/// as the drop was delivered
DROP_DEFER_MS: u32 = 3000

app flags (AppDesc)

AF_CUSTOM_TITLEBAR: u32 = 1
AF_RESIZABLE: u32 = 2
AF_DARK: u32 = 4  // force dark theme
AF_LIGHT: u32 = 8  // force light theme
AF_SINGLE_INSTANCE: u32 = 16  // one window per user: later starts hand their command line over (UIC_OPEN)
AF_LOG_FILE: u32 = 32  // window mode: the log also goes to logs://APP.log (1 MiB, 3 older files)
AF_SAVE_STATE: u32 = 64  // window mode: the main and tool windows' placement kept in config://windows.ini
AF_GPU_3D: u32 = 128  // the app shows 3D views (ui.gpu_view): the UI's GPU device at level Voll on the fastest adapter

theme tokens (color)

// byte offsets as in ASMLIB; index = token / 4
T_BG: u32 = 0  // window background (Mica fallback)
T_BG_ALT: u32 = 4
T_LAYER: u32 = 8  // layer fill (command bars, panels)
T_LAYER_STROKE: u32 = 12
T_CARD: u32 = 16
T_CARD_STROKE: u32 = 20
T_CTRL: u32 = 24  // control fill: rest, hover, pressed, disabled (24..36)
T_CTRL_HOVER: u32 = 28
T_CTRL_PRESSED: u32 = 32
T_CTRL_DISABLED: u32 = 36
T_CTRL_STROKE: u32 = 40  // control border
T_CTRL_STROKE2: u32 = 44  // control border, bottom edge
T_STRONG_STROKE: u32 = 48  // checkbox / radio border
T_SUBTLE: u32 = 52  // transparent button: rest, hover, pressed, disabled (52..64)
T_SUBTLE_HOVER: u32 = 56
T_SUBTLE_PRESSED: u32 = 60
T_SUBTLE_DISABLED: u32 = 64
T_TEXT: u32 = 68  // text: primary, secondary, tertiary, disabled (68..80)
T_TEXT2: u32 = 72
T_TEXT3: u32 = 76
T_TEXT_DISABLED: u32 = 80
T_ACCENT: u32 = 84  // accent fill: rest, hover, pressed, disabled (84..96)
T_ACCENT_HOVER: u32 = 88
T_ACCENT_PRESSED: u32 = 92
T_ACCENT_DISABLED: u32 = 96
T_ON_ACCENT: u32 = 100  // text on accent
T_ON_ACCENT_DIS: u32 = 104
T_ACCENT_TEXT: u32 = 108  // accent-coloured text / links
T_FOCUS_OUT: u32 = 112
T_FOCUS_IN: u32 = 116
T_FLYOUT: u32 = 120  // menus, popups
T_FLYOUT_STROKE: u32 = 124
T_SMOKE: u32 = 128  // dim behind dialogs
T_DIVIDER: u32 = 132
T_INPUT_ACTIVE: u32 = 136  // focused text box fill
T_CRIT: u32 = 140
T_OK: u32 = 144
T_WARN: u32 = 148
T_INFO: u32 = 152
T_CRIT_BG: u32 = 156
T_OK_BG: u32 = 160
T_WARN_BG: u32 = 164
T_INFO_BG: u32 = 168
T_CLOSE_HOVER: u32 = 172
T_SHADOW: u32 = 176
T_SCROLL: u32 = 180  // scroll bar thumb
T_TRACK: u32 = 184  // slider / progress track
T_KNOB: u32 = 188  // solid control fill (slider thumb, toggle knob)
T_ALT_FILL: u32 = 192  // toggle off background
T_STRONG_FILL: u32 = 196  // toggle off knob / strong fill
T_COUNT: usize = 50
  • struct Range RANGE min, max, step, flags -- slider / number box descriptor
    • min: i32
    • max: i32
    • step: i32
    • flags: u32

impl Range

  • const fn new(min: i32, max: i32, step: i32, flags: u32) -> Range
RG_VERT: u32 = 1  // vertical slider
RG_TICKS: u32 = 2
RG_TIP: u32 = 4  // value tooltip while dragging
/// Logarithmic pointer/paint mapping for integer sliders with positive bounds.
/// Keyboard increments, semantic values and range endpoints retain their units.
RG_LOG: u32 = 8
LF_REORDER: u32 = 0x10000  // list_begin: rows can be dragged to a new place
// decimal values, colour tracks, angle, pan, colour wheel (ui_value.s, ui_wheel.s)
TK_CHECKER: u32 = 1  // draw the gradient over a checkerboard (alpha tracks)
TK_CUSTOM: u32 = 2  // the track is drawn by a custom function (no stops)
TK_RECT: u32 = 4  // square ends, the gradient spans the whole rectangle
TK_MAXN: usize = 16
ANG_360: u32 = 1  // angle: 0 .. 360 instead of -180 .. 180
PAN_UNIT: u32 = 1  // pan: coordinates 0 .. 1 instead of -1 .. 1
CW_HSV: u32 = 1  // color_wheel: an HSV record instead of 0xAARRGGBB
CP_ALPHA: u32 = 1  // color_picker_ex: alpha (transparency) track
CP_FIELDS: u32 = 2  // ... number boxes R G B (A) H S V and a hex text box
CP_PIPETTE: u32 = 4  // ... a pipette button: a colour from anywhere on the screen (only where possible)
PART_BASE: u32 = 0x6000_0000  // part_id(id, k): ids of the parts of composite widgets
  • struct UiInput UIINPUT -- pointer state handed to custom widgets (canvas)
    • ev: u32 -- EV_* flags
    • btn: u32 -- buttons held (bit 1 << BTN_*)
    • pressed: u32 -- buttons pressed this frame
    • released: u32 -- buttons released this frame
    • x: i32 -- pointer x relative to the widget (px)
    • y: i32
    • press_x: i32 -- position of the last press (px, relative)
    • press_y: i32
    • wheel_x: i32 -- wheel delta (120 per notch)
    • wheel_y: i32
    • wheel_precise: bool -- the turn came from a device that scrolls by pixels or in fine steps (a touchpad, a trackpad, a high-resolution wheel: plat::WHEEL_PIXELS / WHEEL_FINE): scroll by wheel_px_x / wheel_px_y, at once (no smooth scrolling); wheel_x / wheel_y say the same turn in notches (120 = what a notch scrolls: Ui::wheel_notch_px)
    • wheel_px_x: i32 -- a precise turn in physical pixels (up / right positive, as wheel_x / wheel_y): the platform's pixels (macOS, Wayland) or, from Windows' fine steps, 120 = wheel_lines() lines (wheel_chars() for wheel_px_x) of WHEEL_LINE_DIP; 0 for a notched wheel
    • wheel_px_y: i32
    • mods: u32
    • pts: alloc::vec::Vec<[i32; 2]> -- move points since the last frame (relative px)
    • rect: [i32; 4] -- widget rectangle (absolute px)
    • dpi: i32
    • key: u32 -- first unconsumed key this frame (VK | mods << 16) or 0
    • pressure: u32 -- pen pressure now: 0 = none (mouse), 1..UI_PRESSURE_ONE
    • ptype: u32 -- PTR_MOUSE / PTR_PEN / PTR_ERASER / PTR_TOUCH
    • ppress: alloc::vec::Vec<u32> -- pressure per move point
    • tilt_x: i32 -- pen tilt in degrees (-63..63), 0 without tilt
    • tilt_y: i32
UI_PRESSURE_ONE: u32 = 65535
/// a line of the wheel in the library's views (DIP): a notch scrolls Ui::wheel_lines of them
/// (48 DIP with the usual three); where a device scrolls in fine steps without pixels of its own
/// (Windows), 120 of them are wheel_lines such lines of pixels
WHEEL_LINE_DIP: i32 = 16

containers

SC_V: u32 = 0x0100_0000  // vertical scrolling, children top to bottom (default)
SC_H: u32 = 0x0200_0000  // horizontal scrolling, children left to right
SC_NOBAR: u32 = 0x0400_0000  // no scroll bars
SC_NOWHEEL: u32 = 0x0800_0000  // ignore the mouse wheel
IB_INFO: u32 = 0
IB_SUCCESS: u32 = 1
IB_WARNING: u32 = 2
IB_ERROR: u32 = 3
DLG_NONE: u32 = 0
DLG_PRIMARY: u32 = 1
DLG_SECONDARY: u32 = 2
DLG_CLOSE: u32 = 3

text input

TB_CAP_MASK: u32 = 0x007F_FFFF  // the capacity in bytes (at most 8 MB)
TB_HYPHENATE: u32 = 0x0080_0000  // with TB_MULTI | TB_WRAP: hyphenate words that do not fit (hyph.rs)
TB_PASSWORD: u32 = 0x0100_0000  // a dot per character; no copy / cut; the input method's purpose IP_PASSWORD while it has the keyboard
TB_READONLY: u32 = 0x0200_0000  // selectable and copyable, not editable
TB_DIGITS: u32 = 0x0400_0000  // accept only 0-9
TB_MULTI: u32 = 0x0800_0000  // multi-line
TB_SIGNED: u32 = 0x1000_0000  // with TB_DIGITS: also '-'
TB_DECIMAL: u32 = 0x2000_0000  // with TB_DIGITS: also ',' and '.'
TB_WRAP: u32 = 0x4000_0000  // with TB_MULTI: wrap long lines at the box width
TB_SPELL: u32 = 0x8000_0000  // spell checking: misspelled words underlined, suggestions (edit_spell.rs)
UIT_CARET: u32 = 0x7FFE_0001  // timer id of the caret blink

popups, menus, commands

UIT_TOOLTIP: u32 = 0x7FFE_0010  // timer id of the tooltip delay
FL_BELOW: u32 = 0
FL_ABOVE: u32 = 1
FL_RIGHT: u32 = 2
FL_ALIGN_END: u32 = 4
FL_MINW: u32 = 8
FL_POINT: u32 = 16
FL_OVER: u32 = 32
CF_DISABLED: u32 = 1
CF_CHECKED: u32 = 2
CF_HIDDEN: u32 = 4
FD_OPEN: u32 = 0
FD_SAVE: u32 = 1
FD_FOLDER: u32 = 2
/// (E8) open several files at once (with FD_OPEN): ui.filedlg_paths() has all of them, `path` the first
FD_MULTI: u32 = 4
/// the library's own dialog on every platform, never the system's (as `jfgui_FILEDLG=builtin`
/// does for every dialog of a run): an app whose dialog must look and behave the same everywhere
FD_BUILTIN: u32 = 8
FD_EXT_SHIFT: u32 = 8

windows (win.rs)

// windows including the main window (index 0); fixed: the index is a bit in u32 masks and
// Event::win, plat keeps PW_MAX windows; one more warns (window_begin)
WIN_MAX: usize = 8
WF_TOOL: u32 = 1
WF_DIALOG: u32 = 2
WF_MODAL: u32 = 4
WF_RESIZABLE: u32 = 8
WF_NOCLOSE: u32 = 16
WF_SYSFRAME: u32 = 32
WF_NOACTIVATE: u32 = 64
WF_AUTOHEIGHT: u32 = 128
WF_KEYS: u32 = 256
WF_TOUCH_HOLD: u32 = 512  // a finger moves it by the title bar only after resting there (TF_HOLD)
/// (E7) an independent app window (a browser's second or private window): a top-level window of
/// its own on Windows (its own taskbar button, not minimized or hidden with the main window),
/// without the library's title bar -- the app draws one with titlebar_begin / titlebar_end
/// (its own widgets in it, the caption buttons at its end); X11 and Wayland too (a top-level
/// window without WM_TRANSIENT_FOR / an xdg_toplevel without a parent); macOS gives it an owned
/// window for now
WF_APP: u32 = 1024
UWS_OPEN: u32 = 1
UWS_VISIBLE: u32 = 2
UWS_ACTIVE: u32 = 4
UWS_MINIMIZED: u32 = 8
  • struct WinRect WINRECT -- window placement, owned by the app (DIP; see ui.inc)
    • x: i32
    • y: i32
    • w: i32
    • h: i32
    • flags: u32

impl WinRect

  • const fn new(x: i32, y: i32, w: i32, h: i32, flags: u32) -> WinRect
WRF_POS: u32 = 1
WRF_MAX: u32 = 2
WRF_CHANGED: u32 = 4
WRF_ABS: u32 = 8

input (jfgui.inc)

BTN_LEFT: u32 = 1
BTN_RIGHT: u32 = 2
BTN_MIDDLE: u32 = 3
BTN_X1: u32 = 4
BTN_X2: u32 = 5
MOD_SHIFT: u32 = 1
MOD_CTRL: u32 = 2
MOD_ALT: u32 = 4
MOD_SUPER: u32 = 8
MOD_ALTGR: u32 = 16
MOD_CAPS: u32 = 32
MOD_NUM: u32 = 64
PTR_MOUSE: u32 = 0
PTR_PEN: u32 = 1
PTR_ERASER: u32 = 2
PTR_TOUCH: u32 = 3
// (E2) where a key sits (KeyEvent::location)
KL_STANDARD: u32 = 0
KL_LEFT: u32 = 1
KL_RIGHT: u32 = 2
KL_NUMPAD: u32 = 3
// cursors (CUR_*)
CUR_ARROW: u32 = 0
CUR_IBEAM: u32 = 1
CUR_HAND: u32 = 2
CUR_CROSS: u32 = 3
CUR_MOVE: u32 = 4
CUR_WAIT: u32 = 5
CUR_SIZE_NS: u32 = 6
CUR_SIZE_WE: u32 = 7
CUR_SIZE_NWSE: u32 = 8
CUR_SIZE_NESW: u32 = 9
CUR_NONE: u32 = 10
CUR_COUNT: u32 = 11
CUR_CUSTOM: u32 = 15  // hit boxes only: the cursor of cursor_custom
CUR_USER_MAX: u32 = 32  // fixed handle range; cursor_new answers 0 when it is full
CUR_MAX_PX: i32 = 256

(E3) more system shapes: CSS's cursor names, past the custom cursors (CUR_X0 ..

// CUR_X_END); a platform without one shows cursor_fallback's
CUR_X0: u32 = 64
CUR_NOT_ALLOWED: u32 = 64  // not-allowed
CUR_NO_DROP: u32 = 65  // no-drop
CUR_GRAB: u32 = 66  // grab: an open hand
CUR_GRABBING: u32 = 67  // grabbing: a closed hand
CUR_HELP: u32 = 68  // help: the arrow with a question mark
CUR_PROGRESS: u32 = 69  // progress: the arrow with a busy sign (work in the background)
CUR_ZOOM_IN: u32 = 70  // zoom-in
CUR_ZOOM_OUT: u32 = 71  // zoom-out
CUR_CELL: u32 = 72  // cell: a thick cross (tables)
CUR_VTEXT: u32 = 73  // vertical-text
CUR_ALIAS: u32 = 74  // alias: a link will be made
CUR_COPY: u32 = 75  // copy: a copy will be made
CUR_CONTEXT_MENU: u32 = 76  // context-menu
CUR_ALL_SCROLL: u32 = 77  // all-scroll
CUR_COL_RESIZE: u32 = 78  // col-resize
CUR_ROW_RESIZE: u32 = 79  // row-resize
CUR_SIZE_N: u32 = 80  // n-resize: one edge or corner
CUR_SIZE_S: u32 = 81
CUR_SIZE_E: u32 = 82
CUR_SIZE_W: u32 = 83
CUR_SIZE_NE: u32 = 84
CUR_SIZE_NW: u32 = 85
CUR_SIZE_SE: u32 = 86
CUR_SIZE_SW: u32 = 87
CUR_X_END: u32 = 88
// fonts
FONT_REG: u32 = 0
FONT_SEMI: u32 = 1
FONT_BOLD: u32 = 2
FONT_ICON: u32 = 3
// clipboard formats
CLIP_TEXT: u32 = 1
CLIP_PNG: u32 = 2
CLIP_IMAGE: u32 = 3
/// UTF-8 HTML fragment; CF_HTML framing is handled by the platform.
CLIP_HTML: u32 = 4
/// Rich Text Format document bytes.
CLIP_RTF: u32 = 5
/// Private document fragment bytes, MIME application/x-jfgui-docx-fragment.
CLIP_DOCX: u32 = 6

style metrics (style.inc)

SM_DLG_MIN: u32 = 0
SM_DLG_MAX: u32 = 1
SM_DLG_MARGIN: u32 = 2
SM_DLG_CONTENT_BOX: u32 = 3
SM_DLG_CONTENT_GAP: u32 = 4
SM_DLG_TITLE_TS: u32 = 5
SM_DLG_FOOTER_BOX: u32 = 6
SM_DLG_FOOTER_GAP: u32 = 7
SM_SB_H: u32 = 8
SM_SB_PAD: u32 = 9
SM_SB_GAP: u32 = 10
SM_TB_H: u32 = 11
SM_TB_H_LARGE: u32 = 12
SM_TB_PAD: u32 = 13
SM_TB_ICON: u32 = 14
SM_TB_TITLE_TS: u32 = 15
SM_CAP_W: u32 = 16
SM_CAP_W_TOOL: u32 = 17
SM_WC_TITLE_PAD: u32 = 18
SM_WC_TITLE_GAP: u32 = 19
SM_GRIP: u32 = 20
SM_GRIP_CORNER: u32 = 21
SM_WIN_TBH_TOOL: u32 = 22
SM_WIN_TBH_DIALOG: u32 = 23
SM_CAP_LEFT: u32 = 24
SM_DLG_BTN_ORDER: u32 = 25
SM_DOCK_HDR: u32 = 26  // tab strip of a dock group (dock.rs; 0 = 32)
SM_DOCK_BTN: u32 = 27  // its buttons (0 = 28)
SM_COUNT: u32 = 28
// menu / list rows of flyouts (menu_item*: Sp::flags)
MIF_DISABLED: u32 = 1
MIF_CHECKED: u32 = 2
MIF_SUB: u32 = 4
MIF_OPEN: u32 = 8
MIF_SELECTED: u32 = 16
MIF_LIST: u32 = 32
MIF_TWOCOL: u32 = 64
// (JD27) the rows of a Mi::List (Ui::menu_list_flags: one byte per row)
ML_CHILD: u8 = 1  // in the submenu of the nearest row before it without ML_CHILD (Visio's FlyoutChild)
ML_SEP: u8 = 2  // a separator line above the row (Visio's BeginGroup)

data views (data.rs, chart.rs)

// badge / status dot / meter kinds (StyleData::badge flags)
BADGE_NEUTRAL: u32 = 0
BADGE_INFO: u32 = 1
BADGE_OK: u32 = 2
BADGE_WARN: u32 = 3
BADGE_CRIT: u32 = 4
BADGE_ACCENT: u32 = 5
// grid column flags (GridCol::flags)
GC_RIGHT: u32 = 1  // cell content right-aligned (numbers)
GC_CENTER: u32 = 2
GC_NOSORT: u32 = 4  // the header does not sort
GC_FILL: u32 = 8  // the column takes the width the others leave (at least its width)
// grid header cell paint flags (StyleData::grid_header Sp::flags)
GH_SORT_ASC: u32 = 1
GH_SORT_DESC: u32 = 2
GH_LAST: u32 = 4  // the last column (no divider)
GH_RIGHT: u32 = 8  // label right-aligned
// grid row paint flags (StyleData::grid_row Sp::flags)
GR_FOCUS: u32 = 1  // the focused row of a focused grid (focus visual)
GR_STRIPE: u32 = 2  // an odd row of a striped grid
GR_CURRENT: u32 = 4  // the current (focused) row, focus not visible

shell (shell.rs, notify.rs)

NAV_COMPACT: u32 = 1  // nav_item / nav_section: the pane shows icons only
SEG_FIRST: u32 = 1  // segment: the first / last item of the control
SEG_LAST: u32 = 2
WS_TODO: i32 = 0  // wizard step states
WS_CURRENT: i32 = 1
WS_DONE: i32 = 2
WS_ERROR: i32 = 3
CBI_SEP: u32 = 0x1_0000  // command bar item: a separator before it
CBI_END: u32 = 0x2_0000  // command bar item: starts the end-aligned group
UIT_TOAST: u32 = 0x7FFE_0020  // timer id of toast expiry
UIT_SPIN: u32 = 0x7FFE_0021  // (reserved) spinner frame timer
UIT_SPELL: u32 = 0x7FFE_0030  // timer id: spell checking continues in the next frame
// spell_state(): the checker of the text boxes (edit_spell.rs)
SPELL_OFF: u32 = 0  // spell_enable(false), or no TB_SPELL box asked yet
SPELL_LOADING: u32 = 1  // its dictionary is being read (window mode)
SPELL_READY: u32 = 2  // checking (the marks are up to date or follow on the timer)
SPELL_NONE: u32 = 3  // no checker for the language
// (L7) full screen (win.rs window_fullscreen): window_state's bit, the event when the platform
// or the user changed it
UWS_FULLSCREEN: u32 = 16
UIC_FULLSCREEN: u32 = 0x7FFF_001A  // arg = window id (0 main): the platform or the user left (or entered) full screen

Source: docs/API.md in the JFLib repository.