Crate ambient_ui_native

Source

Re-exports§

pub use ambient_cb as cb;
pub use ambient_element as element;
pub use ambient_ui as ui;
pub use ambient_layout as layout;
pub use ambient_rect as rect;

Modules§

button
Implements a button UI element, as well as variants thereof.
clickarea
Defines the ClickArea element.
default_theme
Defines the default theme for the UI.
dropdown
Implements a dropdown element.
editor
Provides an Editor trait for values that can be edited in the UI, and implementations for common types.
graph
guest_api
This file only exists because Enums aren’t available in the wasm layer yet; once that exists this can be removed
prelude
A prelude for users of the crate. Imports all the most commonly used types and functions.
prompt
Defines several UI prompts, such as Alert, Prompt, and EditorPrompt.
screens
Defines several kinds of window-sized screens.
scroll_area
Defines a scroll area.
select
Defines elements that can be used to select an item from a list.
style_constants
Defines the default theme for the UI.
tabs
Implements basic tabs.
throbber
Defines a throbber.

Structs§

Alert
A full-screen alert dialog that the user must acknowledge.
ArrayEditor
An editor for a fixed-size array.
BookFile
An entry in a Bookcase.
Bookcase
A bookcase layout is a min-max layout; it should be a list of BookFiles, where each BookFile has a container and a book. The book’s determine the size of the entire Bookcase, but their sizes are not manipulated. The containers are resized to fit the bookcase though, to align them.
Borders
Button
A button UI element.
Centered
A Centered is a Flow that is oriented vertically and is centered.
Checkbox
A checkbox.
ClickArea
An area that tracks mouse events.
ComponentEntryEditor
Created through the Editable attribute
Corners
CustomParseInput
An editor for a value that can be parsed from a string, but with custom parsing and stringification.
DialogScreen
Contains a single element with a background color and click area.
Dock
A docking layout, where each child specifies which side of the parent it should be docked to. It is top-down: it starts with a given area (say the screen) and then divides it into smaller pieces with each new element added to it.
Dropdown
A dropdown element: shows the dropdown when show is specified.
DropdownSelect
A dropdown select element. Presents a button next to content that, when clicked, shows a dropdown with the items in items.
DurationEditor
An editor for EditableDuration.
Editable
EditableDuration
A duration that can be edited.
EditorColumn
Legacy newtype for FlowColumn.
EditorOpts
Options for the Editor type.
EditorPrompt
A full-screen prompt dialog to edit a value.
EditorRow
A row with a title and an element, used as part of larger editors.
EntityId
FixedGrid
A FixedGrid is a grid of elements with a fixed stride.
Flow
A flow layout. It is bottom-up: it auto-resizes itself to fit its constituent components.
FlowColumn
A FlowColumn is a Flow that is oriented vertically.
FlowRow
See https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/layout?view=netdesktop-6.0#container-flow-layout
Focus
Keeps track of which element has focus.
FocusRoot
Provides a context for focusable UI elements.
FontAwesomeIcon
A FontAwesome icon.
FontFromUrl
GlyphVertex
HighjackMouse
Hotkey
An element that will invoke a callback when a hotkey is pressed.
Image
ImageFromBytes
ImageFromUrl
IndexMapEditor
An editor for a IndexMap. The key and value types must implement Editor.
IntegerSlider
A slider for an integer value.
KeyValueEditor
An editor for a HashMap. The key and value types must implement Editor.
Line
A simple UI line. Use components like line_from, line_to, line_width, background_color, border_color, border_radius and border_thickness to control its appearance.
ListEditor
An editor for a list of items that implement Editor; each item can be edited, moved up or down, or deleted.
ListSelect
A DropdownSelect that shows the current item for you automatically.
MeasureSize
Measures the size of its inner element and calls the callback when it changes.
MinimalListEditor
A MinimalListEditorWithItemEditor that uses the default editor for the items.
MinimalListEditorItem
A single item in a list editor
MinimalListEditorWithItemEditor
A configurable list editor that allows you to specify the editor for the items, and to provide other preset options.
OffscreenEditor
Delegates a type editor to edit in a new screen.
PageScreen
Contains several elements with a background color and click area.
ParseableInput
An editor for a value that can be parsed from a string.
Prompt
A full-screen prompt dialog that the user must acknowledge.
Rectangle
A simple UI rect. Use components like width, height, background_color, border_color, border_radius and border_thickness to control its appearance.
ScreenContainer
Contains an element with a background color and click area.
ScrollArea
A scroll area that can be used to scroll its child.
Separator
A simple separator, similar to <hr> in HTML.
Slider
A slider for a floating-point value.
SystemGroup
SystemTimeEditor
An editor for SystemTime.
TabBar
A header bar of tabs. Does not contain the tab content.
Tabs
A set of tabs. Contains a TabBar and the content of the selected tab.
Text
A text element. Use the text, font_size, font_family and color components to set its state.
TextEditor
A text editor.
Throbber
Shows an animated progress bar to indicate that progress is being made and has not frozen.
Tooltip
A tooltip element: shows the tooltip when the inner is hovered.
UIBase
A base element for all UI elements. It contains all the components needed for a UI element to work.
UIElement
This only exists so that we can implement From<String> for Text, and then use it in for instance Button.
WindowSized
A Dock that is always the size of the window.
WithChange
Helper for mutating UI state in multiple places.
WithChangePart
Helper that takes an existing WithChange<T> and applies a projection from T to U.
World

Enums§

Align
ButtonCb
The callback invoked when a button is clicked.
ButtonStyle
The style of a button.
Docking
Fit
FontFamily
FontStyle
Layout
MouseInput
The state of a mouse button.
Orientation
ScrollAreaSizing
Sizing config of a scroll area
TextCase

Constants§

CHEVRON_DOWN
Character code for the “down chevron” icon.
CHEVRON_LEFT
Character code for the “left chevron” icon.
CHEVRON_RIGHT
Character code for the “right chevron” icon.
CHEVRON_UP
Character code for the “up chevron” icon.
COLLECTION_ADD_ICON
Character code for the “add” icon.
COLLECTION_DELETE_ICON
Character code for the “delete” icon.
MOVE_DOWN_ICON
Character code for the “move down” icon.
MOVE_UP_ICON
Character code for the “move up” icon.
SMALL_ROUNDING
Default rounding of corners.
STREET
Default margin/padding.

Traits§

Editor
A trait for types that can be edited in the UI.
StylesExt
A trait that adds some default styles to elements.
UIExt
A trait that provides helper methods for UI elements.

Functions§

align_horizontal
align_vertical
app_background_color
The color used for the background of the app.
background_color
Background color: Background color of an entity with a rect component.
border_color
Border color: Border color of an entity with a rect component.
border_radius
Border radius: Radius for each corner of an entity with a rect component.
border_thickness
Border thickness: Border thickness of an entity with a rect component.
cb
Helper for constructing a Cb.
command_modifier
Ctrl on windows, Command on osx
cutout_color
A color slightly darker than app_background_color.
docking
error_color
The error color.
fit_horizontal
fit_horizontal_parent
Fit horizontal parent: Layout fit: horizontal parent.
fit_vertical
font_arc
font_family
Font family: Font family to be used. Can either be ‘Default’, ‘FontAwesome’, ‘FontAwesomeSolid’, ‘Code’ or a url to a font.
font_size
Font size: Size of the font.
font_style
Font style: One of Bold, BoldItalic, Medium, MediumItalic, Regular, Italic, Light or LightItalic.
glyph_brush
gpu_ui_size
GPU UI size: Upload the width and height of this UI element to the GPU.
gpu_world_systems
height
Height: The height of a UI element.
hydrate_editable
Adds the Editable attribute to multiple components where depending on ambient_ui_native is not possible.
init_all_components
is_book_file
Is book file: This is a file in a layout_bookcase.
layout
layout_systems
margin
Margin: Layout margin: [top, right, bottom, left].
max_height
Maximum height: The maximum height of a UI element.
max_width
Maximum width: The maximum width of a UI element.
mesh_to_local_from_size
Mesh to local from size: Update the mesh_to_local based on the width and height of this entity.
min_height
Minimum height: The minimum height of a UI element.
min_width
Minimum width: The minimum width of a UI element.
orientation
padding
Padding: Layout padding: [top, right, bottom, left].
primary_color
The primary color.
screen
Screen: This entity will be treated as a screen. Used by the Screen ui component.
secondary_color
The secondary color.
space_between_items
Space between items: Space between items in a layout.
systems
text
Text: Create a text mesh on this entity.
text_case
text_texture
tooltip_background_color
The color used for tooltip backgrounds.
use_focus
A hook that returns the current focus state for this element and a callback to set the focus state.
use_focus_for_instance_id
A hook that returns the current focus state for this element, given a specific instance_id, and a callback to set the focus state.
use_window_logical_resolution
A hook that returns the current window logical resolution (i.e. taking DPI scaling into account)
use_window_physical_resolution
A hook that returns the current window physical resolution (i.e. not taking DPI scaling into account)
width
Width: The width of a UI element.
with_rect
Converts the given element into a rect.

Type Aliases§

ButtonCallback
The type of function invoked by a button.
Cb
A helper type for callbacks that wraps around a function type with an Arc that implements Debug.
ChangeCb
Callback for when an editor changes its value.
F32Input
A ParseableInput for f32.
I32Input
A ParseableInput for i32.
U32Input
A ParseableInput for u32.
U64Input
A ParseableInput for u64.
UsizeInput
A ParseableInput for usize.

Derive Macros§

ElementEditor