pub struct EventCx<'a> { /* private fields */ }Expand description
What a widget gets while it handles an event (or is updated by the application through
Ui::update): its state, and requests to the Ui.
Implementations§
Source§impl EventCx<'_>
impl EventCx<'_>
Sourcepub fn rect(&self) -> Rect
pub fn rect(&self) -> Rect
Where the widget is, in physical pixels from the window’s top-left corner.
Sourcepub fn content_rect(&self) -> Rect
pub fn content_rect(&self) -> Rect
The widget’s rectangle inside its padding.
Sourcepub fn content_size(&self) -> Size
pub fn content_size(&self) -> Size
The size of what the widget’s children cover.
Sourcepub fn is_hovered(&self) -> bool
pub fn is_hovered(&self) -> bool
Whether the pointer is over the widget or one of its children.
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Whether the widget has keyboard focus.
Sourcepub fn is_pressed(&self) -> bool
pub fn is_pressed(&self) -> bool
Whether the widget handled a pointer press that has not been released yet.
Sourcepub fn text_system(&mut self) -> &mut TextSystem
pub fn text_system(&mut self) -> &mut TextSystem
The text system, to edit and re-lay out text.
Sourcepub fn request_paint(&mut self)
pub fn request_paint(&mut self)
Asks for the next frame to be painted.
Sourcepub fn request_layout(&mut self)
pub fn request_layout(&mut self)
Asks for the widget to be measured again: its content changed size.
Sourcepub fn request_focus(&mut self)
pub fn request_focus(&mut self)
Asks for keyboard focus, given once the event has been handled.
Sourcepub fn release_focus(&mut self)
pub fn release_focus(&mut self)
Gives keyboard focus up, if the widget has it.
Sourcepub fn release_pointer(&mut self)
pub fn release_pointer(&mut self)
Stops receiving the pointer’s moves and release after a press.
Sourcepub fn set_cursor(&mut self, cursor: Option<Cursor>)
pub fn set_cursor(&mut self, cursor: Option<Cursor>)
The cursor shown over the widget (and its children that set none); None for its
parent’s.
Sourcepub fn set_ime_area(&mut self, area: Option<Rect>)
pub fn set_ime_area(&mut self, area: Option<Rect>)
Where an input method should show its candidates while the widget has focus: the caret’s rectangle.
Sourcepub fn emit(&mut self, kind: ActionKind)
pub fn emit(&mut self, kind: ActionKind)
Reports kind to the application.
Sourcepub fn scroll_to(&mut self, offset: Point) -> Point
pub fn scroll_to(&mut self, offset: Point) -> Point
Scrolls the widget’s children by offset from their laid-out place, clamped so the
content stays in view. Returns the offset applied.
Sourcepub fn focus_within(&self, id: WidgetId) -> bool
pub fn focus_within(&self, id: WidgetId) -> bool
Whether keyboard focus is on id or a widget inside it.