Skip to main content

UiEvent

Enum UiEvent 

Source
pub enum UiEvent {
Show 44 variants Click, Changed(EventValue), Submit, Search(String), SuggestionChosen(usize), FocusIn, FocusOut, WindowResized(Size), WindowCloseRequested, FullScreenChanged(bool), MaximizedChanged(bool), 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

§

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.

§

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.

Fields

§from: usize
§

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.

Fields

§rows: Vec<RowKey>
§

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).

Trait Implementations§

Source§

impl Clone for UiEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UiEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for UiEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UiEvent

Auto Trait Implementations§

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> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.