Skip to main content

EventCtx

Struct EventCtx 

Source
pub struct EventCtx<'a> {
    pub phase: EventPhase,
    pub element: ElementId,
    pub state: VisualState,
    pub hover_self: bool,
    pub pos: Point,
    pub rect: Rect,
    pub environment: &'a Environment,
    pub window: WindowId,
    /* private fields */
}

Fields§

§phase: EventPhase§element: ElementId§state: VisualState§hover_self: bool§pos: Point§rect: Rect§environment: &'a Environment§window: WindowId

Implementations§

Source§

impl EventCtx<'_>

Source

pub fn local_pos(&self) -> Point

Source

pub fn stop_propagation(&mut self)

Source

pub fn handled(&mut self)

Source

pub fn capture_pointer(&mut self)

Source

pub fn release_pointer(&mut self)

Source

pub fn request_focus(&mut self)

Source

pub fn begin_drag<T: 'static>(&self, payload: T, options: DragOptions)

Source

pub fn drag_session(&self) -> Option<DragSession>

Source

pub fn drop_position(&self, modifiers: Modifiers) -> DropPosition

Source

pub fn cancel_drag(&mut self)

Source

pub fn pressure(&self) -> f32

Source

pub fn tool(&self) -> PenTool

Source

pub fn text_width(&mut self, text: &str, size: f32) -> f32

Source

pub fn text_width_weighted( &mut self, text: &str, size: f32, weight: FontWeight, ) -> f32

Source

pub fn text_width_weighted_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> f32

Source

pub fn caret_positions( &mut self, text: &str, size: f32, weight: FontWeight, ) -> Vec<f32>

Source

pub fn caret_positions_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> Vec<f32>

Source

pub fn char_index_from_x( &mut self, text: &str, size: f32, weight: FontWeight, x: f32, ) -> usize

Source

pub fn char_index_from_x_spaced( &mut self, text: &str, size: f32, weight: FontWeight, x: f32, spacing: LetterSpacing, ) -> usize

Source

pub fn shape_rich_full( &mut self, spans: &[TextSpan], size: f32, width: f32, mode: WrapMode, spacing: LetterSpacing, align: RichAlign, ) -> Rc<RichParagraph>

Source

pub fn request_frame(&self)

Source

pub fn hide_overlay(&self, id: OverlayId) -> bool

Source

pub fn has_overlay(&self, id: OverlayId) -> bool

Source

pub fn overlay_rect(&self, id: OverlayId) -> Option<Rect>

Source

pub fn overlay_set_position(&self, id: OverlayId, x: f32, y: f32) -> bool

Source

pub fn has_focus_within(&self) -> bool

Source

pub fn window_rect(&self) -> Rect

Source

pub fn window_size(&self) -> Size

Source

pub fn scale(&self) -> f32

Source

pub fn safe_insets(&self) -> Edges

Source

pub fn runtime(&self) -> &Runtime

Source

pub fn element(&self) -> ElementId

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for EventCtx<'a>

§

impl<'a> !Send for EventCtx<'a>

§

impl<'a> !Sync for EventCtx<'a>

§

impl<'a> !UnwindSafe for EventCtx<'a>

§

impl<'a> Freeze for EventCtx<'a>

§

impl<'a> Unpin for EventCtx<'a>

§

impl<'a> UnsafeUnpin for EventCtx<'a>

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.