Struct fyrox_ui::UserInterface

source ·
pub struct UserInterface {
    pub default_font: SharedFont,
    pub double_click_time_slice: f32,
    /* private fields */
}

Fields§

§default_font: SharedFont§double_click_time_slice: f32

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 set_screen_size(&mut self, screen_size: 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<Ref<'_, ClipboardContext>>

source

pub fn clipboard_mut(&self) -> Option<RefMut<'_, 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_unrestricted(&self, pt: Vector2<f32>) -> Handle<UiNode>

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 ) -> &UiNodewhere 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 screen_to_root_canvas_space( &self, position: Vector2<f32> ) -> Vector2<f32>

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 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 drag_context(&self) -> &DragContext

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>

Trait Implementations§

source§

impl<'a> From<&'a mut UserInterface> for BuildContext<'a>

source§

fn from(ui: &'a mut UserInterface) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> FieldValue for Twhere T: 'static,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Casts self to a &dyn Any
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

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

§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

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

§

fn vzip(self) -> V