UserInterface

Struct UserInterface 

Source
pub struct UserInterface { /* private fields */ }

Implementations§

Source§

impl UserInterface

Source

pub fn new(screen_size: Vector2<f32>) -> UserInterface

Source

pub fn keyboard_modifiers(&self) -> KeyboardModifiers

Source

pub fn build_ctx(&mut self) -> BuildContext<'_>

Source

pub fn capture_mouse(&mut self, node: Handle<UiNode>) -> bool

Source

pub fn release_mouse_capture(&mut self)

Source

pub fn get_drawing_context(&self) -> &DrawingContext

Source

pub fn get_drawing_context_mut(&mut self) -> &mut DrawingContext

Source

pub fn is_node_enabled(&self, handle: Handle<UiNode>) -> bool

Source

pub fn screen_size(&self) -> Vector2<f32>

Source

pub fn update(&mut self, screen_size: Vector2<f32>, dt: f32)

Source

pub fn cursor(&self) -> CursorIcon

Source

pub fn draw(&mut self) -> &DrawingContext

Source

pub fn clipboard(&self) -> Option<&ClipboardContext>

Source

pub fn clipboard_mut(&mut self) -> Option<&mut ClipboardContext>

Source

pub fn arrange_node( &self, handle: Handle<UiNode>, final_rect: &Rect<f32>, ) -> bool

Source

pub fn measure_node( &self, handle: Handle<UiNode>, available_size: Vector2<f32>, ) -> bool

Source

pub fn cursor_position(&self) -> Vector2<f32>

Source

pub fn hit_test(&self, pt: Vector2<f32>) -> Handle<UiNode>

Source

pub fn find_by_criteria_down<Func>( &self, node_handle: Handle<UiNode>, func: &Func, ) -> Handle<UiNode>
where Func: Fn(&UiNode) -> bool,

Searches a node down on tree starting from give root that matches a criteria defined by a given func.

Source

pub fn find_by_criteria_up<Func>( &self, node_handle: Handle<UiNode>, func: Func, ) -> Handle<UiNode>
where Func: Fn(&UiNode) -> bool,

Searches a node up on tree starting from given root that matches a criteria defined by a given func.

Source

pub fn is_node_child_of( &self, node_handle: Handle<UiNode>, root_handle: Handle<UiNode>, ) -> bool

Checks if specified node is a child of some other node on root_handle. This method is useful to understand if some event came from some node down by tree.

Source

pub fn is_node_direct_child_of( &self, node_handle: Handle<UiNode>, root_handle: Handle<UiNode>, ) -> bool

Checks if specified node is a direct child of some other node on root_handle.

Source

pub fn find_by_name_up( &self, node_handle: Handle<UiNode>, name: &str, ) -> Handle<UiNode>

Searches a node by name up on tree starting from given root node.

Source

pub fn find_by_name_down( &self, node_handle: Handle<UiNode>, name: &str, ) -> Handle<UiNode>

Searches a node by name down on tree starting from given root node.

Source

pub fn borrow_by_name_up( &self, start_node_handle: Handle<UiNode>, name: &str, ) -> &UiNode

Searches a node by name up on tree starting from given root node and tries to borrow it if exists.

Source

pub fn borrow_by_name_down( &self, start_node_handle: Handle<UiNode>, name: &str, ) -> &UiNode

Searches a node by name down on tree starting from given root node and tries to borrow it if exists.

Source

pub fn borrow_by_criteria_up<Func>( &self, start_node_handle: Handle<UiNode>, func: Func, ) -> &UiNode
where Func: Fn(&UiNode) -> bool,

Searches for a node up on tree that satisfies some criteria and then borrows shared reference.

§Panics

It will panic if there no node that satisfies given criteria.

Source

pub fn try_borrow_by_criteria_up<Func>( &self, start_node_handle: Handle<UiNode>, func: Func, ) -> Option<&UiNode>
where Func: Fn(&UiNode) -> bool,

Source

pub fn try_borrow_by_type_up<T>( &self, node_handle: Handle<UiNode>, ) -> Option<(Handle<UiNode>, &T)>
where T: Control,

Source

pub fn sender(&self) -> Sender<UiMessage>

Returns instance of message sender which can be used to push messages into queue from other threads.

Source

pub fn send_message(&self, message: UiMessage)

Source

pub fn poll_message(&mut self) -> Option<UiMessage>

Extracts UI event one-by-one from common queue. Each extracted event will go to all available nodes first and only then will be moved outside of this method. This is one of most important methods which must be called each frame of your game loop, otherwise UI will not respond to any kind of events and simply speaking will just not work.

Source

pub fn captured_node(&self) -> Handle<UiNode>

Source

pub fn process_os_event(&mut self, event: &OsEvent) -> bool

Translates raw window event into some specific UI message. This is one of the most important methods of UI. You must call it each time you received a message from a window.

Source

pub fn nodes(&self) -> &Pool<UiNode>

Source

pub fn root(&self) -> Handle<UiNode>

Source

pub fn add_node(&mut self, node: UiNode) -> Handle<UiNode>

Source

pub fn push_picking_restriction(&mut self, restriction: RestrictionEntry)

Source

pub fn remove_picking_restriction(&mut self, node: Handle<UiNode>)

Source

pub fn picking_restriction_stack(&self) -> &[RestrictionEntry]

Source

pub fn drop_picking_restrictions(&mut self)

Removes all picking restrictions.

Source

pub fn top_picking_restriction(&self) -> Option<RestrictionEntry>

Source

pub fn node(&self, node_handle: Handle<UiNode>) -> &UiNode

Source

pub fn try_get_node(&self, node_handle: Handle<UiNode>) -> Option<&UiNode>

Source

pub fn copy_node(&mut self, node: Handle<UiNode>) -> Handle<UiNode>

Source

pub fn copy_node_with_limit( &mut self, node: Handle<UiNode>, limit: Option<usize>, ) -> Handle<UiNode>

Auto Trait Implementations§

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V