oa::ui::Ui

GPU-retained UI compositor. Borrows one Engine for its lifetime; must be closed explicitly before the engine or any resource it references is released.

StRust public API

Declaration

pub struct Ui<'engine> { /* private fields */ }
Public Rust declaration.

Public Methods

pub fn resize(&mut self, width: u32, height: u32) -> Result<()>
pub fn begin_frame(&mut self, _delta_ms: f32)
pub fn route_event(&mut self, event: &UiEvent) -> bool
pub fn end_frame(&mut self)
pub fn input(&self) -> &UiInputState
pub fn push_style(&mut self, style: UiStyle)
pub fn pop_style(&mut self)
pub fn begin_panel(&mut self, _id: &str, rect: PixelRect)
pub fn begin_panel_with_layout( &mut self, _id: &str, rect: PixelRect, layout: UiLayout, )
pub fn end_panel(&mut self)
pub fn spacing(&mut self, pixels: f32)
pub fn separator(&mut self)
pub fn begin_row(&mut self)
pub fn end_row(&mut self)
pub fn button(&mut self, label: &str) -> bool
pub fn checkbox(&mut self, label: &str, value: &mut bool) -> bool
pub fn slider_f32( &mut self, label: &str, value: &mut f32, min: f32, max: f32, ) -> bool
pub fn progress_bar(&mut self, fraction: f32)
pub fn progress_bar_with_overlay(&mut self, fraction: f32, overlay: &str)
pub fn label(&mut self, text: &str)
pub fn slider_i32( &mut self, label: &str, value: &mut i32, min: i32, max: i32, ) -> bool
pub fn input_text(&mut self, label: &str, value: &mut String) -> bool
pub fn color_swatch(&mut self, color: Color, size: [f32; 2])
pub fn tab_bar( &mut self, _id: &str, rect: PixelRect, items: &[UiTabItem], state_out: &mut UiTabBarState, ) -> UiTabBarResult
pub fn tree_row( &mut self, id: &str, rect: PixelRect, label: &str, config: UiTreeRowConfig, ) -> UiTreeRowResult
pub fn node_canvas_grid(&mut self, canvas: &NodeCanvas, rect: PixelRect)
pub fn plot_line_bindless( &mut self, values_idx: u32, count: u32, y_min: f32, y_max: f32, color: Color, )
pub fn plot_line_at( &mut self, values: &[f32], rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
pub fn line_at( &mut self, from: [f32; 2], to: [f32; 2], color: Color, thickness: f32, bounds: PixelRect, ) -> Result<()>
pub fn image_at(&mut self, texture: &Texture, rect: PixelRect) -> Result<()>
pub fn text_at( &mut self, text: &str, origin: [f32; 2], config: TextLayoutConfig, color: Color, clip: PixelRect, ) -> Result<()>
pub fn rect_raw( &mut self, rect: PixelRect, color: Color, clip: PixelRect, corner_radius: f32, )
pub fn rect_outline_raw( &mut self, rect: PixelRect, color: Color, thickness: u32, clip: PixelRect, )
pub fn timeline( &mut self, id: &str, rect: PixelRect, fraction: &mut f32, out_active: Option<&mut bool>, ) -> bool
pub fn waveform_timeline( &mut self, id: &str, rect: PixelRect, envelope: &[f32], fraction: &mut f32, ) -> bool
pub fn begin_scroll_panel( &mut self, id: &str, rect: PixelRect, content_height: i32, config: UiScrollConfig, ) -> UiScrollRegion
pub fn end_scroll_panel(&mut self)
pub fn virtual_rows( &mut self, item_count: i32, row_height: i32, row_gap: i32, overscan_rows: i32, ) -> UiVirtualRange
pub fn split_pane( &mut self, id: &str, rect: PixelRect, ratio: &mut f32, config: UiSplitConfig, ) -> UiSplitRegion
pub fn property_row( &mut self, _id: &str, rect: PixelRect, label: &str, value: &str, config: UiPropertyRowConfig, ) -> UiPropertyRegion
pub fn open_popup(&mut self, id: &str)
pub fn open_popup_at(&mut self, id: &str, anchor: PixelRect)
pub fn close_popup(&mut self)
pub fn is_popup_open(&mut self, id: &str) -> bool
pub fn begin_popup(&mut self, id: &str, config: UiPopupConfig) -> bool
pub fn end_popup(&mut self)
pub fn menu_item(&mut self, label: &str, selected: bool, enabled: bool) -> bool
pub fn dropdown( &mut self, label: &str, items: &[&str], selected: &mut i32, _config: UiDropdownConfig, ) -> bool
pub fn tooltip(&mut self, text: &str, _config: UiTooltipConfig)
pub fn heatmap_inline( &mut self, _label: &str, data: &[f32], config: UiHeatmapConfig, ) -> Result<()>
pub fn text(&mut self, content: &str)
pub fn label_fmt(&mut self, text: &str)
pub fn icon_button( &mut self, id: &str, rect: PixelRect, icon: UiIcon, enabled: bool, style_kind: UiIconButtonStyle, ) -> bool
pub fn chevron_button( &mut self, id: &str, rect: PixelRect, direction: UiChevronDirection, enabled: bool, ) -> bool
pub fn text_button( &mut self, id: &str, rect: PixelRect, text: &str, text_color: Color, enabled: bool, ) -> bool
pub fn grid(&mut self, rect: PixelRect, config: UiGridConfig)
pub fn image_plane( &mut self, texture: &Texture, channel: u32, dst_x: i32, dst_y: i32, ) -> Result<()>
pub fn image_planar( &mut self, texture: &Texture, dst_x: i32, dst_y: i32, ) -> Result<()>
pub fn plot_line_xy_at( &mut self, x: &[f32], y: &[f32], rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
pub fn plot_line_ring_at( &mut self, data: &[f32], offset: usize, rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
pub fn accessibility_snapshot(&self) -> UiAccessibilitySnapshot
pub fn wants_text_input(&self) -> bool
pub fn text_input_rect(&self) -> Option<PixelRect>
pub fn rect_outlines( &mut self, rects: &[PixelRect], clip: PixelRect, color: Color, thickness: u32, )
pub fn glyphs_at( &mut self, text: &str, origin: [f32; 2], config: TextLayoutConfig, color: Color, clip: PixelRect, ) -> Result<()>
pub fn render_rgba8(&mut self) -> Result<Vec<u8>>
pub fn compose_extent(&self) -> Option<[u32; 2]>
pub fn present_to(&mut self, presenter: &mut Presenter<'_>) -> Result<bool>
pub fn close(&mut self) -> Result<()>
fn drop(&mut self)

Associated Functions

pub fn init(engine: &'engine Engine, width: u32, height: u32) -> Result<Self>
pub fn init_with_style( engine: &'engine Engine, width: u32, height: u32, style: UiStyle, ) -> Result<Self>

Public Method Documentation

pub fn resize(&mut self, width: u32, height: u32) -> Result<()>
No public source comment is attached to this declaration.
pub fn begin_frame( &mut self, _delta_ms: f32 )
No public source comment is attached to this declaration.
pub fn route_event( &mut self, event: &UiEvent ) -> bool
No public source comment is attached to this declaration.
pub fn end_frame( &mut self )
No public source comment is attached to this declaration.
pub fn input( &self ) -> &UiInputState
No public source comment is attached to this declaration.
pub fn push_style( &mut self, style: UiStyle )
Initialise the UI layer. Creates pipelines and the compose image. width and height should match the presentation surface extent.
pub fn pop_style( &mut self )
Initialise the UI layer. Creates pipelines and the compose image. width and height should match the presentation surface extent.
pub fn begin_panel( &mut self, _id: &str, rect: PixelRect )
No public source comment is attached to this declaration.
pub fn begin_panel_with_layout( &mut self, _id: &str, rect: PixelRect, layout: UiLayout )
No public source comment is attached to this declaration.
pub fn end_panel( &mut self )
No public source comment is attached to this declaration.
pub fn spacing( &mut self, pixels: f32 )
No public source comment is attached to this declaration.
pub fn separator( &mut self )
No public source comment is attached to this declaration.
pub fn begin_row( &mut self )
No public source comment is attached to this declaration.
pub fn end_row( &mut self )
No public source comment is attached to this declaration.
pub fn button( &mut self, label: &str ) -> bool
No public source comment is attached to this declaration.
pub fn checkbox( &mut self, label: &str, value: &mut bool ) -> bool
No public source comment is attached to this declaration.
pub fn slider_f32( &mut self, label: &str, value: &mut f32, min: f32, max: f32 ) -> bool
No public source comment is attached to this declaration.
pub fn progress_bar( &mut self, fraction: f32 )
No public source comment is attached to this declaration.
pub fn progress_bar_with_overlay( &mut self, fraction: f32, overlay: &str )
No public source comment is attached to this declaration.
pub fn label( &mut self, text: &str )
No public source comment is attached to this declaration.
pub fn slider_i32( &mut self, label: &str, value: &mut i32, min: i32, max: i32 ) -> bool
No public source comment is attached to this declaration.
pub fn input_text( &mut self, label: &str, value: &mut String ) -> bool
No public source comment is attached to this declaration.
pub fn color_swatch( &mut self, color: Color, size: [f32; 2] )
No public source comment is attached to this declaration.
pub fn tab_bar( &mut self, _id: &str, rect: PixelRect, items: &[UiTabItem], state_out: &mut UiTabBarState ) -> UiTabBarResult
No public source comment is attached to this declaration.
pub fn tree_row( &mut self, id: &str, rect: PixelRect, label: &str, config: UiTreeRowConfig ) -> UiTreeRowResult
No public source comment is attached to this declaration.
pub fn node_canvas_grid( &mut self, canvas: &NodeCanvas, rect: PixelRect )
No public source comment is attached to this declaration.
pub fn plot_line_bindless( &mut self, values_idx: u32, count: u32, y_min: f32, y_max: f32, color: Color )
No public source comment is attached to this declaration.
pub fn plot_line_at( &mut self, values: &[f32], rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn line_at( &mut self, from: [f32; 2], to: [f32; 2], color: Color, thickness: f32, bounds: PixelRect, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn image_at(&mut self, texture: &Texture, rect: PixelRect) -> Result<()>
No public source comment is attached to this declaration.
pub fn text_at( &mut self, text: &str, origin: [f32; 2], config: TextLayoutConfig, color: Color, clip: PixelRect, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn rect_raw( &mut self, rect: PixelRect, color: Color, clip: PixelRect, corner_radius: f32 )
No public source comment is attached to this declaration.
pub fn rect_outline_raw( &mut self, rect: PixelRect, color: Color, thickness: u32, clip: PixelRect )
No public source comment is attached to this declaration.
pub fn timeline( &mut self, id: &str, rect: PixelRect, fraction: &mut f32, out_active: Option<&mut bool> ) -> bool
No public source comment is attached to this declaration.
pub fn waveform_timeline( &mut self, id: &str, rect: PixelRect, envelope: &[f32], fraction: &mut f32 ) -> bool
No public source comment is attached to this declaration.
pub fn begin_scroll_panel( &mut self, id: &str, rect: PixelRect, content_height: i32, config: UiScrollConfig ) -> UiScrollRegion
No public source comment is attached to this declaration.
pub fn end_scroll_panel( &mut self )
No public source comment is attached to this declaration.
pub fn virtual_rows( &mut self, item_count: i32, row_height: i32, row_gap: i32, overscan_rows: i32 ) -> UiVirtualRange
No public source comment is attached to this declaration.
pub fn split_pane( &mut self, id: &str, rect: PixelRect, ratio: &mut f32, config: UiSplitConfig ) -> UiSplitRegion
No public source comment is attached to this declaration.
pub fn property_row( &mut self, _id: &str, rect: PixelRect, label: &str, value: &str, config: UiPropertyRowConfig ) -> UiPropertyRegion
No public source comment is attached to this declaration.
pub fn open_popup( &mut self, id: &str )
No public source comment is attached to this declaration.
pub fn open_popup_at( &mut self, id: &str, anchor: PixelRect )
No public source comment is attached to this declaration.
pub fn close_popup( &mut self )
No public source comment is attached to this declaration.
pub fn is_popup_open( &mut self, id: &str ) -> bool
No public source comment is attached to this declaration.
pub fn begin_popup( &mut self, id: &str, config: UiPopupConfig ) -> bool
No public source comment is attached to this declaration.
pub fn end_popup( &mut self )
No public source comment is attached to this declaration.
pub fn menu_item( &mut self, label: &str, selected: bool, enabled: bool ) -> bool
No public source comment is attached to this declaration.
pub fn dropdown( &mut self, label: &str, items: &[&str], selected: &mut i32, _config: UiDropdownConfig ) -> bool
No public source comment is attached to this declaration.
pub fn tooltip( &mut self, text: &str, _config: UiTooltipConfig )
No public source comment is attached to this declaration.
pub fn heatmap_inline( &mut self, _label: &str, data: &[f32], config: UiHeatmapConfig, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn text( &mut self, content: &str )
No public source comment is attached to this declaration.
pub fn label_fmt( &mut self, text: &str )
No public source comment is attached to this declaration.
pub fn icon_button( &mut self, id: &str, rect: PixelRect, icon: UiIcon, enabled: bool, style_kind: UiIconButtonStyle ) -> bool
No public source comment is attached to this declaration.
pub fn chevron_button( &mut self, id: &str, rect: PixelRect, direction: UiChevronDirection, enabled: bool ) -> bool
No public source comment is attached to this declaration.
pub fn text_button( &mut self, id: &str, rect: PixelRect, text: &str, text_color: Color, enabled: bool ) -> bool
No public source comment is attached to this declaration.
pub fn grid( &mut self, rect: PixelRect, config: UiGridConfig )
No public source comment is attached to this declaration.
pub fn image_plane( &mut self, texture: &Texture, channel: u32, dst_x: i32, dst_y: i32, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn image_planar( &mut self, texture: &Texture, dst_x: i32, dst_y: i32, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn plot_line_xy_at( &mut self, x: &[f32], y: &[f32], rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn plot_line_ring_at( &mut self, data: &[f32], offset: usize, rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn accessibility_snapshot( &self ) -> UiAccessibilitySnapshot
No public source comment is attached to this declaration.
pub fn wants_text_input( &self ) -> bool
No public source comment is attached to this declaration.
pub fn text_input_rect( &self ) -> Option<PixelRect>
No public source comment is attached to this declaration.
pub fn rect_outlines( &mut self, rects: &[PixelRect], clip: PixelRect, color: Color, thickness: u32 )
No public source comment is attached to this declaration.
pub fn glyphs_at( &mut self, text: &str, origin: [f32; 2], config: TextLayoutConfig, color: Color, clip: PixelRect, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn render_rgba8( &mut self ) -> Result<Vec<u8>>
No public source comment is attached to this declaration.
pub fn compose_extent( &self ) -> Option<[u32; 2]>
No public source comment is attached to this declaration.
pub fn present_to( &mut self, presenter: &mut Presenter<'_> ) -> Result<bool>
No public source comment is attached to this declaration.
pub fn close(&mut self) -> Result<()>
No public source comment is attached to this declaration.
fn drop( &mut self )
No public source comment is attached to this declaration.
pub fn init( engine: &'engine Engine, width: u32, height: u32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn init_with_style( engine: &'engine Engine, width: u32, height: u32, style: UiStyle ) -> Result<Self>
No public source comment is attached to this declaration.