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
impl UserInterface
pub fn new(screen_size: Vector2<f32>) -> UserInterface
pub fn keyboard_modifiers(&self) -> KeyboardModifiers
pub fn build_ctx(&mut self) -> BuildContext<'_>
pub fn capture_mouse(&mut self, node: Handle<UiNode>) -> bool
pub fn release_mouse_capture(&mut self)
pub fn get_drawing_context(&self) -> &DrawingContext
pub fn get_drawing_context_mut(&mut self) -> &mut DrawingContext
pub fn is_node_enabled(&self, handle: Handle<UiNode>) -> bool
pub fn screen_size(&self) -> Vector2<f32>
pub fn set_screen_size(&mut self, screen_size: Vector2<f32>)
pub fn update(&mut self, screen_size: Vector2<f32>, dt: f32)
pub fn cursor(&self) -> CursorIcon
pub fn draw(&mut self) -> &DrawingContext
pub fn clipboard(&self) -> Option<Ref<'_, ClipboardContext>>
pub fn clipboard_mut(&self) -> Option<RefMut<'_, ClipboardContext>>
pub fn arrange_node( &self, handle: Handle<UiNode>, final_rect: &Rect<f32> ) -> bool
pub fn measure_node( &self, handle: Handle<UiNode>, available_size: Vector2<f32> ) -> bool
pub fn cursor_position(&self) -> Vector2<f32>
pub fn hit_test_unrestricted(&self, pt: Vector2<f32>) -> Handle<UiNode>
pub fn hit_test(&self, pt: Vector2<f32>) -> Handle<UiNode>
sourcepub fn find_by_criteria_down<Func>(
&self,
node_handle: Handle<UiNode>,
func: &Func
) -> Handle<UiNode>where
Func: Fn(&UiNode) -> bool,
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.
sourcepub fn find_by_criteria_up<Func>(
&self,
node_handle: Handle<UiNode>,
func: Func
) -> Handle<UiNode>where
Func: Fn(&UiNode) -> bool,
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.
sourcepub fn is_node_child_of(
&self,
node_handle: Handle<UiNode>,
root_handle: Handle<UiNode>
) -> bool
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.
sourcepub fn is_node_direct_child_of(
&self,
node_handle: Handle<UiNode>,
root_handle: Handle<UiNode>
) -> bool
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
.
sourcepub fn find_by_name_up(
&self,
node_handle: Handle<UiNode>,
name: &str
) -> Handle<UiNode>
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.
sourcepub fn find_by_name_down(
&self,
node_handle: Handle<UiNode>,
name: &str
) -> Handle<UiNode>
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.
sourcepub fn borrow_by_name_up(
&self,
start_node_handle: Handle<UiNode>,
name: &str
) -> &UiNode
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.
sourcepub fn borrow_by_name_down(
&self,
start_node_handle: Handle<UiNode>,
name: &str
) -> &UiNode
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.
sourcepub fn borrow_by_criteria_up<Func>(
&self,
start_node_handle: Handle<UiNode>,
func: Func
) -> &UiNodewhere
Func: Fn(&UiNode) -> bool,
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.
pub fn try_borrow_by_criteria_up<Func>( &self, start_node_handle: Handle<UiNode>, func: Func ) -> Option<&UiNode>where Func: Fn(&UiNode) -> bool,
pub fn try_borrow_by_type_up<T>( &self, node_handle: Handle<UiNode> ) -> Option<(Handle<UiNode>, &T)>where T: Control,
sourcepub fn sender(&self) -> Sender<UiMessage>
pub fn sender(&self) -> Sender<UiMessage>
Returns instance of message sender which can be used to push messages into queue from other threads.
pub fn send_message(&self, message: UiMessage)
sourcepub fn poll_message(&mut self) -> Option<UiMessage>
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.
pub fn screen_to_root_canvas_space( &self, position: Vector2<f32> ) -> Vector2<f32>
pub fn captured_node(&self) -> Handle<UiNode>
sourcepub fn process_os_event(&mut self, event: &OsEvent) -> bool
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.
pub fn nodes(&self) -> &Pool<UiNode>
pub fn root(&self) -> Handle<UiNode>
pub fn push_picking_restriction(&mut self, restriction: RestrictionEntry)
pub fn remove_picking_restriction(&mut self, node: Handle<UiNode>)
pub fn picking_restriction_stack(&self) -> &[RestrictionEntry]
sourcepub fn drop_picking_restrictions(&mut self)
pub fn drop_picking_restrictions(&mut self)
Removes all picking restrictions.
pub fn top_picking_restriction(&self) -> Option<RestrictionEntry>
pub fn drag_context(&self) -> &DragContext
pub fn node(&self, node_handle: Handle<UiNode>) -> &UiNode
pub fn try_get_node(&self, node_handle: Handle<UiNode>) -> Option<&UiNode>
pub fn copy_node(&mut self, node: Handle<UiNode>) -> Handle<UiNode>
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>
impl<'a> From<&'a mut UserInterface> for BuildContext<'a>
source§fn from(ui: &'a mut UserInterface) -> Self
fn from(ui: &'a mut UserInterface) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for UserInterface
impl !Send for UserInterface
impl !Sync for UserInterface
impl Unpin for UserInterface
impl !UnwindSafe for UserInterface
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
source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere T: 'static,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.