Skip to main content

Crate microui_redux

Crate microui_redux 

Source
Expand description

microui-redux provides an immediate-mode GUI toolkit inspired by rxi/microui. The crate exposes the core context, container, layout, and renderer hooks necessary to embed a UI inside custom render backends while remaining allocator- and platform-agnostic. Built-in widget placement is driven by each widget’s preferred_size, so auto-sized rows can use per-widget intrinsic text/icon metrics instead of a single shared control size. Layout internals are flow-based: row tracks and vertical stack flows both run through the same engine so scope/scroll/content bookkeeping stays consistent.

Modules§

basis
Coordinate basis and reference frame utilities.
builder
Helpers for constructing atlas textures at build time.
matrix
Matrix mathematics module providing 2x2, 3x3, and 4x4 matrices.
primitives
Geometric primitives for 3D graphics and collision detection.
quaternion
Quaternion operations and conversions. Quaternion math for rotations and orientation.
queries
Intersection and distance query traits and helpers. Intersection and distance query traits and implementations.
scalar
Scalar trait definitions for generic numeric operations.
transforms
3D transformation functions for computer graphics.
vector
Vector mathematics module providing 2D, 3D, and 4D vector operations.

Structs§

AtlasHandle
Shared handle exposing read/write access to the atlas.
AtlasSource
Serializable representation of an atlas that can be shipped with the binary.
Basis
A 3D coordinate basis (reference frame).
Box3
A 3D axis-aligned bounding box (AABB).
Button
Persistent state for button widgets.
Canvas
High-level drawing helper that batches draw commands for a renderer.
CharEntry
Metrics and atlas coordinates for a glyph.
Checkbox
Persistent state for checkbox widgets.
Color
Simple RGBA color stored with 8-bit components.
Combo
Persistent state used by combo_box to track popup and selection.
Config
Describes size and padding requirements of rectangle packing.
Container
Core UI building block that records commands and hosts layouts.
ContainerHandle
Shared handle to a container that can be embedded inside windows or panels.
ContainerOption
Options that control how a container behaves.
ContainerView
Read-only view into a container borrowed from a handle.
ContainerViewMut
Mutable view into a container borrowed from a handle.
Context
Primary entry point used to drive the UI over a renderer implementation.
ControlState
Captures the interaction state for a widget during the current frame. Produced by Container::update_control and passed into Widget::handle.
Custom
Persistent state for custom render widgets.
CustomRenderArgs
Arguments forwarded to custom rendering callbacks.
DensePacker
Similar to Packer but does not add any padding between rectangles.
Dimension
A 2D dimension with width and height.
FileDialogState
Simple modal dialog that lets the user browse and pick files.
FontEntry
Describes a font baked into an AtlasSource.
FontId
Handle referencing a font stored in the atlas.
IconId
Handle referencing a bitmap icon stored in the atlas.
Id
Numeric identifier value.
Input
Aggregates raw input collected during the current frame.
InputSnapshot
Snapshot of the per-frame input state for widgets that need it.
Internal
Persistent state for internal window/container controls.
KeyCode
Logical navigation keys handled by the UI.
KeyMode
Modifier key state tracked by the input system.
Line
An infinite line in 2D or 3D space.
ListBox
Persistent state for list boxes.
ListItem
Persistent state for list items.
Matrix2
A 2x2 matrix stored in column-major order.
Matrix3
A 3x3 matrix stored in column-major order.
Matrix4
A 4x4 matrix stored in column-major order.
MouseButton
Mouse button state as reported by the input system.
Node
Persistent state for headers and tree nodes.
Number
Persistent state for number input widgets.
NumberEditState
Editing buffer for number-style widgets.
Packer
Packer is the main structure in this crate. It holds packing context.
ParametricPlane
A parametric plane defined by center and axis vectors.
Plane
A plane defined by ax + by + cz + d = 0.
Quat
A quaternion representing rotation or orientation.
Ray
A ray with an origin and direction.
Rect
A 2D axis-aligned rectangle.
RendererHandle
Thread-safe handle that shares ownership of a Renderer.
ResourceState
State bits returned by widgets to describe their interaction outcome.
Segment
A line segment with defined start and end points.
Slider
Persistent state for slider widgets.
SlotId
Handle referencing an arbitrary image slot stored in the atlas.
Sphere3
A sphere defined by center and radius.
Style
Collection of visual constants that drive widget appearance.
TextArea
Persistent state for multi-line text area widgets.
Textbox
Persistent state for textbox widgets.
TextureId
Handle referencing a renderer-owned texture.
Tri3
A triangle defined by three vertices.
Vector2
A 2D vector with x and y components.
Vector3
A 3D vector with x, y, and z components.
Vector4
A 4D vector with x, y, z, and w components.
Vertex
Vertex submitted by the UI.
WidgetCtx
Shared context passed to widget handlers.
WidgetFillOption
Controls which widget states should draw a filled background.
WidgetOption
Widget specific options that influence layout and interactivity.
WindowHandle
Reference-counted handle to the internal window object.

Enums§

BasisPlane
Represents one of the three coordinate planes.
ButtonContent
Describes the content rendered inside a button widget.
Clip
Describes whether a rectangle is clipped by the current scissor.
ControlColor
Identifiers for each of the built-in style colors.
Image
Either a slot stored inside the atlas or a standalone texture.
ImageSource
Describes image bytes that can be uploaded to a texture.
InputButtonState
Tracks input button transitions seen since the previous frame.
MouseEvent
Records the latest pointer interaction that occurred over a widget.
NodeStateValue
Expansion state used by tree nodes, headers, and similar widgets.
SizePolicy
Describes how a layout dimension should be resolved. Size policy used by rows and columns when resolving cells.
SourceFormat
Encodes how atlas pixel data is stored.
StackDirection
Direction used by stack flows when emitting vertical cells.
TextWrap
Controls how text should wrap when rendered inside a container.
WidgetBehaviourOption
Behaviour options that control how widgets and containers handle input side effects.
WindowState
Indicates whether a window should be rendered this frame.

Constants§

CHECK_ICON
Identifier of the checkbox icon baked into the default atlas.
CLOSED_FOLDER_16_ICON
Identifier of the closed-folder icon baked into the default atlas.
CLOSE_ICON
Identifier of the close icon baked into the default atlas.
COLLAPSE_ICON
Identifier of the collapse icon baked into the default atlas.
EPS_F32
Default epsilon for f32 comparisons.
EPS_F64
Default epsilon for f64 comparisons.
EXPAND_DOWN_ICON
Identifier of the combo-box expand icon baked into the default atlas.
EXPAND_ICON
Identifier of the expand icon baked into the default atlas.
FILE_16_ICON
Identifier of the file icon baked into the default atlas.
OPEN_FOLDER_16_ICON
Identifier of the open-folder icon baked into the default atlas.
WHITE_ICON
Identifier of the solid white icon baked into the default atlas.

Traits§

CrossProduct
Trait for computing the cross product of 3D vectors.
Distance
Query Traits
FloatScalar
Trait for floating-point scalars with transcendental functions.
FloatVector
Trait for vectors with floating-point components.
Font
Describes the interface the atlas uses to query font metadata.
Intersect
Trait for boolean intersection tests.
Intersection
Trait for producing intersection results.
RectTrait
Simplified rectangle interface required by the packer implementations.
Renderer
Trait implemented by render backends used by the UI context.
Scalar
Core scalar trait for numeric types used in the library.
Swizzle2
Trait for 2D swizzle operations on vectors.
Swizzle3
Trait for 3D swizzle operations on vectors.
Vector
Generic vector trait defining common vector operations.
Widget
Trait implemented by persistent widget state structures. handle is invoked with a WidgetCtx and precomputed ControlState.

Functions§

basis_from_unit
Building an Orthonormal Basis from a Unit Vector John. F. Hughes & Thomas Moller Journal of Graphics Tools, 4:4, 33-35 (DOI: 10.1080/10867651.1999.10487513)
color
Convenience constructor for Color.
color4b
Creates an RGBA color from byte components.
decompose
Decomposes a transformation matrix into scale, rotation, and translation.
expand_rect
Expands (or shrinks) a rectangle uniformly on all sides.
frustum
Creates a perspective projection matrix from frustum bounds.
load_image_bytes
Decodes image data into 32-bit pixels according to source. Grayscale and RGB PNG inputs are expanded to opaque RGBA (alpha = 255).
lookat
Creates a view matrix looking from eye position to target.
ortho4
Creates an orthographic projection matrix.
perspective
Creates a perspective projection matrix.
project3
Projects a 3D point to screen coordinates.
quad_normal
Computes the normal vector of a quadrilateral.
rect
Convenience constructor for Recti.
rotation_from_axis_angle
Creates a 4x4 rotation matrix from an axis and angle.
rotation_from_quat
Creates a 4x4 rotation matrix from a quaternion.
scale
Creates a 4x4 scaling matrix.
shortest_segment3d_between_lines3d
Finds the shortest segment connecting two 3D lines.
transform_vec3
Transforms a 3D vector by a 4x4 matrix with perspective division.
translate
Creates a 4x4 translation matrix.
tri_normal
Computes the normal vector of a triangle.
unproject3
Unprojects screen coordinates back to 3D world space.
vec2
Convenience constructor for Vec2i.
widget_id_of
Returns the pointer identity for a widget state object. Use this when calling APIs such as Container::set_focus.

Type Aliases§

Basisd
Double-precision basis.
Basisf
Single-precision basis.
Box3d
3D double-precision axis-aligned bounding box.
Box3f
3D single-precision axis-aligned bounding box.
Color4b
4-component byte color (RGBA).
Dimensionf
Single-precision dimensions.
Dimensioni
Integer dimensions.
Line2d
2D double-precision line.
Line2f
2D single-precision line.
Line3d
3D double-precision line.
Line3f
3D single-precision line.
Mat2d
2x2 double-precision matrix.
Mat2f
2x2 single-precision matrix.
Mat3d
3x3 double-precision matrix.
Mat3f
3x3 single-precision matrix.
Mat4d
4x4 double-precision matrix.
Mat4f
4x4 single-precision matrix.
ParametricPlaned
Double-precision parametric plane.
ParametricPlanef
Single-precision parametric plane.
Planed
Double-precision plane.
Planef
Single-precision plane.
Quatd
Double-precision quaternion.
Quatf
Single-precision quaternion.
Ray3d
3D double-precision ray.
Ray3f
3D single-precision ray.
Real
Floating-point type used by widgets and layout calculations.
Rectd
Double-precision rectangle.
Rectf
Single-precision rectangle.
Recti
Integer rectangle.
Segment2d
2D double-precision line segment.
Segment2f
2D single-precision line segment.
Segment3d
3D double-precision line segment.
Segment3f
3D single-precision line segment.
Vec2d
2D double-precision float vector.
Vec2f
2D single-precision float vector.
Vec2i
2D integer vector.
Vec3d
3D double-precision float vector.
Vec3f
3D single-precision float vector.
Vec3i
3D integer vector.
Vec4d
4D double-precision float vector.
Vec4f
4D single-precision float vector.
Vec4i
4D integer vector.
WidgetId
Raw trait-object pointer identity used for widget hover/focus tracking.