pub struct Ui<'a> {Show 57 fields
pub width: f32,
pub height: f32,
pub scale_factor: f32,
pub mouse_x: f32,
pub mouse_y: f32,
pub mouse_down: bool,
pub cursor_icon: CursorIcon,
pub draws: Vec<DrawCommand>,
pub overlays: Vec<DrawCommand>,
pub cursor_x: f32,
pub cursor_y: f32,
pub base_x: f32,
pub base_y: f32,
pub direction: Direction,
pub line_height: f32,
pub child_sizes: Vec<(f32, f32)>,
pub child_draw_ranges: Vec<(usize, usize)>,
pub child_origins: Vec<(f32, f32)>,
pub id_log: Vec<Id>,
pub id_ranges: Vec<(usize, usize)>,
pub last_w: f32,
pub last_h: f32,
pub max_x: f32,
pub max_y: f32,
pub offset_x: f32,
pub offset_y: f32,
pub font_system: Option<Arc<Mutex<FontSystem>>>,
pub input_events: Vec<PlatformEvent>,
pub focused_id: Option<Id>,
pub id_counter: u64,
pub scroll_state: &'a mut HashMap<Id, (f32, f32)>,
pub cursor_state: &'a mut HashMap<Id, usize>,
pub interaction_state: &'a mut HashMap<Id, f32>,
pub active_drag: Option<ScrollDrag>,
pub clicked: bool,
pub right_clicked: bool,
pub elapsed_time: f32,
pub semantic_nodes: Vec<SemanticNode>,
pub semantic_stack: Vec<Id>,
pub render_mode_stack: Vec<RenderMode>,
pub needs_redraw: bool,
pub layout_cache: &'a HashMap<Id, (Rect, u64)>,
pub next_layout_cache: &'a mut HashMap<Id, (Rect, u64)>,
pub screen_layout_cache: &'a HashMap<Id, Rect>,
pub next_screen_layout_cache: &'a mut HashMap<Id, Rect>,
pub image_sizes: &'a HashMap<ImageSource, (u32, u32)>,
pub available_width: f32,
pub skip_clip_stack: Vec<bool>,
pub current_viewport: Rect,
pub window_overlays: Vec<(Id, Vec<DrawCommand>)>,
pub current_window_id: Option<Id>,
pub widget_window_map: &'a HashMap<Id, Id>,
pub next_widget_window_map: &'a mut HashMap<Id, Id>,
pub requested_redraw_at: Option<Instant>,
pub event_listeners: HashMap<Id, Vec<EventHandler<'a>>>,
pub window_actions: Vec<WindowAction>,
pub active_overlay_stack: Vec<Id>,
}Fields§
§width: f32§height: f32§scale_factor: f32§mouse_x: f32§mouse_y: f32§mouse_down: bool§cursor_icon: CursorIcon§draws: Vec<DrawCommand>§overlays: Vec<DrawCommand>§cursor_x: f32§cursor_y: f32§base_x: f32§base_y: f32§direction: Direction§line_height: f32§child_sizes: Vec<(f32, f32)>§child_draw_ranges: Vec<(usize, usize)>§child_origins: Vec<(f32, f32)>§id_log: Vec<Id>§id_ranges: Vec<(usize, usize)>§last_w: f32§last_h: f32§max_x: f32§max_y: f32§offset_x: f32§offset_y: f32§font_system: Option<Arc<Mutex<FontSystem>>>§input_events: Vec<PlatformEvent>§focused_id: Option<Id>§id_counter: u64§scroll_state: &'a mut HashMap<Id, (f32, f32)>§cursor_state: &'a mut HashMap<Id, usize>§interaction_state: &'a mut HashMap<Id, f32>§active_drag: Option<ScrollDrag>§clicked: bool§right_clicked: bool§elapsed_time: f32§semantic_nodes: Vec<SemanticNode>§semantic_stack: Vec<Id>§render_mode_stack: Vec<RenderMode>§needs_redraw: bool§layout_cache: &'a HashMap<Id, (Rect, u64)>§next_layout_cache: &'a mut HashMap<Id, (Rect, u64)>§screen_layout_cache: &'a HashMap<Id, Rect>§next_screen_layout_cache: &'a mut HashMap<Id, Rect>§image_sizes: &'a HashMap<ImageSource, (u32, u32)>§available_width: f32§skip_clip_stack: Vec<bool>§current_viewport: Rect§window_overlays: Vec<(Id, Vec<DrawCommand>)>§current_window_id: Option<Id>§widget_window_map: &'a HashMap<Id, Id>§next_widget_window_map: &'a mut HashMap<Id, Id>§requested_redraw_at: Option<Instant>§event_listeners: HashMap<Id, Vec<EventHandler<'a>>>§window_actions: Vec<WindowAction>§active_overlay_stack: Vec<Id>Implementations§
Source§impl<'a> Ui<'a>
impl<'a> Ui<'a>
pub fn new( width: u32, height: u32, scale_factor: f64, font_system: Option<Arc<Mutex<FontSystem>>>, events: Vec<PlatformEvent>, initial_focused_id: Option<Id>, mouse_pos: (f32, f32), mouse_down: bool, scroll_state: &'a mut HashMap<Id, (f32, f32)>, cursor_state: &'a mut HashMap<Id, usize>, interaction_state: &'a mut HashMap<Id, f32>, active_drag: Option<ScrollDrag>, clicked: bool, right_clicked: bool, elapsed_time: f32, layout_cache: &'a HashMap<Id, (Rect, u64)>, next_layout_cache: &'a mut HashMap<Id, (Rect, u64)>, screen_layout_cache: &'a HashMap<Id, Rect>, next_screen_layout_cache: &'a mut HashMap<Id, Rect>, widget_window_map: &'a HashMap<Id, Id>, next_widget_window_map: &'a mut HashMap<Id, Id>, image_sizes: &'a HashMap<ImageSource, (u32, u32)>, ) -> Self
pub fn request_redraw_at(&mut self, instant: Instant)
pub fn add_listener<F>(&mut self, id: Id, phase: EventPhase, callback: F)
pub fn dispatch_event(&mut self, target_id: Id, event: WidgetEvent)
pub fn request_redraw_after(&mut self, duration: Duration)
pub fn id(&mut self) -> Id
pub fn record_layout(&mut self, id: Id, rect: Rect)
pub fn is_occluded(&self, id: Id, x: f32, y: f32) -> bool
pub fn is_hovered( &self, id: Id, fallback_x: f32, fallback_y: f32, fallback_w: f32, fallback_h: f32, ) -> bool
pub fn overlay<F>(&mut self, f: F)
pub fn get_recorded_layout(&self, id: Id) -> Option<(Rect, u64)>
pub fn current_render_mode(&self) -> RenderMode
pub fn request_redraw(&mut self)
pub fn get_max_bounds(&self) -> (f32, f32)
pub fn row(&mut self) -> ContainerBuilder<'_, 'a>
pub fn column(&mut self) -> ContainerBuilder<'_, 'a>
pub fn container(&mut self) -> ContainerBuilder<'_, 'a>
pub fn lazy_container(&mut self) -> LazyContainerBuilder<'_, 'a>
pub fn image(&mut self, source: ImageSource) -> ImageBuilder<'_, 'a>
pub fn spacing(&mut self, size: f32)
Sourcepub fn add_space(&mut self, h: f32)
pub fn add_space(&mut self, h: f32)
Moves the cursor down by h pixels WITHOUT registering a layout child.
Use this inside a lazy/virtual list to offset visible items below invisible ones.
Sourcepub fn set_min_size(&mut self, w: f32, h: f32)
pub fn set_min_size(&mut self, w: f32, h: f32)
Registers an invisible zero-draw child with the given size. This forces the parent container’s layout engine to account for this size when calculating total content height for scroll area sizing.
pub fn input<'b>( &mut self, buffer: &'b mut String, id: impl Hash, ) -> InputBuilder<'_, 'a, 'b>
pub fn slider<'b>( &mut self, value: &'b mut f32, id: impl Hash, ) -> SliderBuilder<'_, 'a, 'b>
pub fn progress_bar(&mut self, value: f32) -> ProgressBarBuilder<'_, 'a>
pub fn checkbox<'b>( &mut self, value: &'b mut bool, label: &str, ) -> CheckboxBuilder<'_, 'a, 'b>
pub fn toggle<'b>( &mut self, value: &'b mut bool, label: impl Into<Option<&'b str>>, ) -> ToggleBuilder<'_, 'a, 'b>
pub fn radio<'b, T: PartialEq + Clone>( &mut self, state: &'b mut T, value: T, label: &str, ) -> RadioBuilder<'_, 'a, 'b, T>
pub fn dropdown<'b, T: PartialEq + Clone + ToString>( &mut self, selected: &'b mut T, options: Vec<T>, ) -> DropdownBuilder<'_, 'a, 'b, T>
pub fn text_area<'b>( &mut self, buffer: &'b mut String, id: impl Hash, ) -> TextAreaBuilder<'_, 'a, 'b>
pub fn window<'b>( &mut self, title: &str, is_open: &'b mut bool, pos: &'b mut [f32; 2], ) -> FloatingWindowBuilder<'_, 'a, 'b>
Sourcepub fn register_semantic(&mut self, node: SemanticNode)
pub fn register_semantic(&mut self, node: SemanticNode)
Registers a widget in the semantic tree.
pub fn set_mouse(&mut self, x: f32, y: f32, down: bool)
pub fn mouse_in_rect(&self, x: f32, y: f32, w: f32, h: f32) -> bool
pub fn is_rect_visible(&self, rect: Rect) -> bool
Sourcepub fn physical_clip(&self, x: f32, y: f32, w: f32, h: f32) -> [f32; 4]
pub fn physical_clip(&self, x: f32, y: f32, w: f32, h: f32) -> [f32; 4]
Converts a logical [x, y, w, h] rect to physical pixels for GPU clipping.
Sourcepub fn advance(&mut self, w: f32, h: f32, draw_start: usize)
pub fn advance(&mut self, w: f32, h: f32, draw_start: usize)
Called by widgets after pushing their draws. Records draw range and advances cursor.
pub fn text(&mut self, content: &str) -> TextBuilder<'_, 'a>
pub fn h1(&mut self, content: &str) -> TextBuilder<'_, 'a>
pub fn h2(&mut self, content: &str) -> TextBuilder<'_, 'a>
pub fn h3(&mut self, content: &str) -> TextBuilder<'_, 'a>
pub fn h4(&mut self, content: &str) -> TextBuilder<'_, 'a>
pub fn card(&mut self) -> CardBuilder<'_, 'a>
pub fn panel<'b>(&mut self) -> PanelBuilder<'_, 'a, 'b>
pub fn card_header<F>(&mut self, title: &str, subtitle: &str, actions: F)
pub fn card_divider(&mut self)
pub fn stack(&mut self) -> StackBuilder<'_, 'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Ui<'a>
impl<'a> !Send for Ui<'a>
impl<'a> !Sync for Ui<'a>
impl<'a> !UnwindSafe for Ui<'a>
impl<'a> Freeze for Ui<'a>
impl<'a> Unpin for Ui<'a>
impl<'a> UnsafeUnpin for Ui<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more