pub enum UiEvent {
Show 46 variants
Click,
Changed(EventValue),
Submit,
Search(String),
SuggestionChosen(usize),
FocusIn,
FocusOut,
WindowResized(Size),
WindowCloseRequested,
WindowActiveChanged(bool),
FullScreenChanged(bool),
MaximizedChanged(bool),
FrameChanged(WindowFrame),
SidebarShownChanged(bool),
PopoverShownChanged(bool),
SidebarItemActivated(usize),
TabCloseRequested(usize),
TabMoved {
from: usize,
to: usize,
},
NewTabRequested,
MetricsChanged,
Scrolled(Point),
RowShown(RowKey),
RowHidden(RowKey),
RowActivated(RowKey),
RowWidth(f32),
ViewportInsets(Insets),
ColumnWidths(Vec<f32>),
RowHeight(RowKey, f32),
RowExpanded(RowKey, bool),
TreeIndent(TreeIndent),
Pointer(PointerEvent),
Remeasure,
Custom(AnyValue),
ContextMenuItem(u32),
Hover(bool),
DoubleClick,
MenuItem(u32),
Key(Shortcut),
DropHover(bool),
FilesDropped(Vec<PathBuf>),
RowsMoved {
rows: Vec<RowKey>,
to: RowDrop<RowKey>,
},
SurfaceReady(SurfaceHandle),
SurfaceResized(SurfaceSize),
SurfaceInput(SurfaceInput),
PointerLockEnded,
KeyboardGrabEnded,
}Expand description
Something that happened in the native UI.
Variants§
Click
Changed(EventValue)
The user changed a control’s value. The native widget already shows it.
Submit
Search(String)
A SearchInput asks for a search for its text, when the platform
does: as the user types (after a pause, where the platform waits for
one), on Return, and when the field is cleared. Not for text the
core set.
SuggestionChosen(usize)
The user picked a SearchInput’s suggestion (a click, or Return on
the one the arrows reached): its index in Suggestions. The field’s
text is the app’s to set.
FocusIn
FocusOut
WindowResized(Size)
WindowCloseRequested
WindowActiveChanged(bool)
A window became the active one, the one taking keys, or stopped being it. It keeps its
focused control through this, so no FocusOut comes. The core passes it on to the
GpuSurfaces in the window, which paint their own carets.
FullScreenChanged(bool)
The user put a window in full screen, or took it out (the title
bar’s button, the window manager’s key), or the platform did. Not
reported for the app’s own FullScreen. The core absorbs it as
FullScreen.
MaximizedChanged(bool)
The user maximized a window or restored it (the title bar’s button,
a double-click on it, the window manager’s key), or the platform
did. Not reported for the app’s own Maximized. The core absorbs
it as Maximized.
FrameChanged(WindowFrame)
A window’s restored frame (Prop::Frame): once as it shows, then as
the user moves or resizes it while it’s neither maximized nor in full
screen. Not reported for the app’s own Frame. The core absorbs it
as Frame.
SidebarShownChanged(bool)
The user showed or hid a Sidebar (the platform’s own toggle, its
divider dragged away), or the platform did. Not reported for the
app’s own SidebarShown. The core absorbs it as SidebarShown.
PopoverShownChanged(bool)
The user dismissed a Popover (a click outside, Escape), or the
platform did. Not reported for the app’s own PopoverShown. The
core absorbs it as PopoverShown.
SidebarItemActivated(usize)
A Sidebar’s item was activated, as a list’s row is (double-clicked,
or Enter pressed on it), where the platform’s sidebar has that: its
index across the sections.
TabCloseRequested(usize)
The user asked to close one of DocumentTabs’ tabs (its close
button, a middle click, the platform’s own close): its index. The
tab stays until the app takes it away.
TabMoved
The user moved one of DocumentTabs’ tabs from from to to
(dragged it, or moved it from the keyboard). The platform already
shows it there; the core absorbs it into TabTitles and
SelectedIndex.
NewTabRequested
The user asked DocumentTabs for a new tab (the platform’s new-tab
button).
MetricsChanged
Platform metrics changed (text size, color scheme, …).
Scrolled(Point)
A ScrollView’s or List’s scroll offset changed (by the user or
by ScrollTo).
RowShown(RowKey)
A List or Table realised a row: it’s in view, or about to be.
The core mounts the row and sends its host (a table’s: its cells’).
RowHidden(RowKey)
A List or Table let go of a row it had shown. The core disposes it.
RowActivated(RowKey)
A List’s or Table’s row was activated: double-clicked, or Enter
pressed on it.
RowWidth(f32)
The width a List gives its rows, when it isn’t the list’s own
width (scroll bars that take room from the rows, list insets). Rows
are laid out at that width.
ViewportInsets(Insets)
Where a ScrollView’s viewport is in its frame, when its scroll
bars or frame take room from its content (classic scroll bars, not
overlay ones). Its content is laid out in what’s left.
ColumnWidths(Vec<f32>)
The widths a Table’s columns give their cells, in column order:
once they’re known, and whenever they change (the user resized a
column, the table was resized). Cells are laid out at them.
RowHeight(RowKey, f32)
How high a Table’s row is without its cells that fill their row
(ColumnData::fills_row): as its other cells make it, and at least
the platform’s row height. Sent for tables with such a column, once
known and whenever it changes; those cells are laid out at least
this high, so they fill the row the platform makes.
RowExpanded(RowKey, bool)
The user opened (true) or closed a Tree’s row: its disclosure,
the platform’s keys, assistive technology. The core takes it into
the open set and sends the rows again. A platform that opens
several rows at once reports each.
TreeIndent(TreeIndent)
How far a Tree indents its rows’ content: once known, and
whenever it changes. Rows are laid out at the rows’ width less it.
Pointer(PointerEvent)
A pointer event on a drawn custom widget, in its coordinates.
Remeasure
A widget’s natural size changed on its own (an image finished loading); the core measures it again.
Custom(AnyValue)
An event of a custom widget or native view, of its own type.
ContextMenuItem(u32)
The item of the node’s context menu with this id was chosen.
Hover(bool)
The pointer came over a node that reports it (Prop::Hover), or
over anything inside it (true), or left it (false).
DoubleClick
A node that reports it (Prop::DoubleClick) was double-clicked.
MenuItem(u32)
The item of a MenuButton’s or SplitButton’s menu with this id
was chosen.
Key(Shortcut)
A key the node takes (Prop::Keys) was pressed while it, or a
control inside it that doesn’t use the key, had keyboard focus.
DropHover(bool)
Files a node takes (Prop::FileDrop) are being dragged over it
(true), or no longer are: they left, or were dropped.
FilesDropped(Vec<PathBuf>)
Files and folders were dropped on a node: the ones it takes, in the order the platform gave them.
RowsMoved
Rows dragged within a list were dropped (Prop::RowMoves): the
rows, in the list’s order, and where, as RowMoves::target put it.
The list shows nothing moved: the app moves its data.
SurfaceReady(SurfaceHandle)
A GpuSurface’s native surface exists: the app can make its GPU
surface on it. Reported once, before any SurfaceResized; its size
may still be empty.
SurfaceResized(SurfaceSize)
A GpuSurface’s size in pixels, or its scale, changed.
SurfaceInput(SurfaceInput)
Keys or the pointer on a GpuSurface that takes input.
PointerLockEnded
The platform ended a GpuSurface’s pointer lock, or couldn’t make
it: its window stopped being the active one. The core absorbs it
as PointerLock(false).
KeyboardGrabEnded
The platform ended a GpuSurface’s keyboard grab, or couldn’t make
it: the surface lost focus, or its window stopped being the active
one. The core absorbs it as KeyboardGrab(false).