Skip to main content

ReposeRuntime

Struct ReposeRuntime 

Source
pub struct ReposeRuntime {
Show 13 fields pub sched: Scheduler, pub scale: f32, pub modifiers: Modifiers, pub mouse_pos_px: (f32, f32), pub pointer_inside: bool, pub hover_id: Option<u64>, pub capture_id: Option<u64>, pub pressed_ids: HashSet<u64>, pub ime_preedit: bool, pub key_pressed_active: Option<u64>, pub last_focus: Option<u64>, pub frame_cache: Option<Frame>, pub textfield_states: HashMap<u64, Rc<RefCell<TextFieldState>>>, /* private fields */
}
Expand description

Embeddable Repose runtime.

Manages composition scheduling, input routing, text-field state, and pointer/key dispatch. The host owns the event loop and GPU device; this is purely the UI logic layer.

Fields§

§sched: Scheduler§scale: f32§modifiers: Modifiers§mouse_pos_px: (f32, f32)§pointer_inside: bool

Whether the pointer is currently inside the window.

§hover_id: Option<u64>§capture_id: Option<u64>§pressed_ids: HashSet<u64>§ime_preedit: bool§key_pressed_active: Option<u64>§last_focus: Option<u64>§frame_cache: Option<Frame>§textfield_states: HashMap<u64, Rc<RefCell<TextFieldState>>>

Implementations§

Source§

impl ReposeRuntime

Source

pub fn new() -> Self

Source

pub fn set_viewport(&mut self, width_px: u32, height_px: u32)

Set the logical viewport size (in device pixels).

Source

pub fn set_viewport_and_scale( &mut self, width_px: u32, height_px: u32, scale: f32, )

Set viewport size and DPI scale factor.

Source

pub fn tick_animations(&self)

Advance animations. Call before compose each frame.

Source

pub fn compose<F>( &mut self, root_fn: &mut F, render_ctx: &RenderContext, ) -> Frame
where F: FnMut(&mut Scheduler, &RenderContext) -> View,

Compose and layout a frame, returning the output for rendering.

Call tick_animations before this and cache_frame after (once you have applied any host-specific overlays like the devtools inspector).

Source

pub fn frame( &mut self, root_fn: impl FnMut(&mut Scheduler, &RenderContext) -> View, render_ctx: &RenderContext, ) -> FrameOutput

Compose a frame and return structured output for the host.

Source

pub fn cache_frame(&mut self, frame: Frame)

Store the composed frame for event hit testing.

Source

pub fn handle_pointer_move(&mut self, pos: Vec2) -> PointerMoveResult

Process a pointer-move event. Returns cursor suggestion.

Source

pub fn handle_pointer_press( &mut self, pos: Vec2, button: PointerButton, ) -> PointerButtonResult

Process a pointer button press. Returns focus/capture info.

Source

pub fn handle_pointer_release(&mut self, pos: Vec2, _button: PointerButton)

Process a pointer button release.

Source

pub fn handle_pointer_cancel(&mut self)

Cancel pointer state (focus lost, cursor left window, etc.).

Source

pub fn clear_hover(&mut self)

Clear hover state, emitting HoverLeave for the currently hovered region.

Source

pub fn reconcile_hover_from_mouse_pos(&mut self, new_frame: &Frame)

Reconcile hover state when the composed frame changes.

Source

pub fn handle_scroll(&mut self, delta: Vec2) -> bool

Process a scroll event. Returns true if consumed.

Source

pub fn handle_key(&mut self, event: &KeyEvent) -> bool

Process a keyboard key event. Returns true if consumed.

Source

pub fn handle_ime(&mut self, event: &ImeEvent)

Process an IME event.

Source

pub fn handle_focus_lost(&mut self)

Handle focus lost (window unfocused, etc.).

Source

pub fn ensure_textfield_state( &mut self, key: u64, ) -> Rc<RefCell<TextFieldState>>

Get or create a text field state by its key.

Source

pub fn tf_key_of(&self, visual_id: u64) -> u64

Look up the persistent state key for a visual hit-region id.

Source

pub fn is_textfield(&self, id: u64) -> bool

True if the given id belongs to a TextField.

Source

pub fn is_multiline(&self, id: u64) -> bool

True if the given textfield id is multiline.

Source

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

Insert text into a focused text field (used for paste).

Source

pub fn cursor_suggestion(&self) -> Option<CursorIcon>

Get the cursor suggestion (set during pointer-move handling).

Source

pub fn take_cursor_suggestion(&mut self) -> Option<CursorIcon>

Take the cursor suggestion (clears it).

Trait Implementations§

Source§

impl Default for ReposeRuntime

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> ErasedDestructor for T
where T: 'static,

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.