Struct Ui

Source
pub struct Ui { /* private fields */ }
Expand description

Main UI builder - provides immediate mode UI building

Implementations§

Source§

impl Ui

Source

pub fn new(plugin_id: String) -> Arc<Mutex<Self>>

Source

pub fn plugin_id(&self) -> &str

Get plugin Id

Source

pub fn label(&mut self, text: &str)

Add a text label

Source

pub fn button(&mut self, text: &str) -> Response

Add a clickable button

Source

pub fn text_edit_singleline(&mut self, value: &mut String) -> Response

Add a single-line text editor

Source

pub fn combo_box<T>( &mut self, options: Vec<T>, selected: &mut Option<T>, placeholder: &str, ) -> Response
where T: Clone + PartialEq + ToString,

Add a combo box (dropdown) widget

Source

pub fn toggle(&mut self, value: &mut bool) -> Response

Add a toggle switch

Source

pub fn horizontal<R>(&mut self, add_contents: impl FnOnce(&mut Self) -> R) -> R

Create a horizontal layout

Source

pub fn vertical<R>(&mut self, add_contents: impl FnOnce(&mut Self) -> R) -> R

Create a vertical layout

Source

pub fn get_components(&self) -> &[UiComponent]

Get all components for serialization

Source

pub fn clear(&mut self)

Clear all components (called at start of each frame)

Source

pub fn clear_components_only(&mut self)

Clear only components, keep event tracking for current frame

Source

pub fn clear_events(&mut self)

Clear event tracking after update_ui is complete

Source

pub fn handle_ui_event(&mut self, component_id: &str, value: &str) -> bool

Handle UI events (called when frontend sends UI events)

Auto Trait Implementations§

§

impl Freeze for Ui

§

impl RefUnwindSafe for Ui

§

impl Send for Ui

§

impl Sync for Ui

§

impl Unpin for Ui

§

impl UnwindSafe for Ui

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> 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.