Skip to main content

Context

Struct Context 

Source
pub struct Context {
    pub input: InputState,
    pub layout: LayoutTree,
    pub registry: StateRegistry,
    pub animations: AnimationCoordinator,
    pub time: f64,
}
Expand description

The central brain of the UZOR engine

Fields§

§input: InputState

Transient input state for the current frame

§layout: LayoutTree

Calculated layout rectangles for all widgets

§registry: StateRegistry

Persistent behavioral state (scroll, focus, etc.)

§animations: AnimationCoordinator

Animation coordinator for managing widget animations

§time: f64

Time since startup in seconds (for animations)

Implementations§

Source§

impl Context

Source

pub fn new(root_node: LayoutNode) -> Self

Source

pub fn begin_frame(&mut self, input: InputState, viewport: Rect)

Begin a new frame with updated input

Source

pub fn state<T: 'static + Send + Sync + Default>( &mut self, id: impl Into<WidgetId>, ) -> &mut T

Access persistent state for a widget

Source

pub fn widget_rect(&self, id: &WidgetId) -> Rect

Helper to get widget rectangle from computed layout

Source

pub fn button(&mut self, id: impl Into<WidgetId>) -> ButtonResponse

Calculate button interaction state

Source

pub fn checkbox( &mut self, id: impl Into<WidgetId>, checked: bool, ) -> CheckboxResponse

Calculate checkbox interaction state

Source

pub fn scroll_area( &mut self, id: impl Into<WidgetId>, content_height: f64, ) -> (Rect, ScrollState)

Calculate scroll area geometry and physics

Source

pub fn icon_button(&mut self, id: impl Into<WidgetId>) -> IconButtonResponse

Calculate interaction state for an icon button

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