Skip to main content

ContentEvent

Struct ContentEvent 

Source
pub struct ContentEvent {
    pub event_type: EventType,
    pub position: Option<(usize, usize)>,
    pub zone_id: Option<String>,
    pub data: EventData,
    pub timestamp: SystemTime,
}
Expand description

Universal event system for RenderableContent interactions Replaces direct method calls with flexible event-based architecture

Fields§

§event_type: EventType

Type of event that occurred

§position: Option<(usize, usize)>

Screen coordinates where event occurred (relative to content area)

§zone_id: Option<String>

Identifier of the content zone that was targeted

§data: EventData

Additional event-specific data

§timestamp: SystemTime

Timestamp when event occurred

Implementations§

Source§

impl ContentEvent

Source

pub fn new( event_type: EventType, position: Option<(usize, usize)>, zone_id: Option<String>, ) -> Self

Create a new content event with current timestamp

Source

pub fn new_click( position: Option<(usize, usize)>, zone_id: Option<String>, ) -> Self

Create a click event

Source

pub fn new_click_with_button( position: Option<(usize, usize)>, zone_id: Option<String>, button: MouseButton, ) -> Self

Create a click event with specific mouse button

Source

pub fn new_hover(position: (usize, usize), zone_id: Option<String>) -> Self

Create a hover event

Source

pub fn new_keypress( key: String, modifiers: Vec<KeyModifier>, zone_id: Option<String>, ) -> Self

Create a key press event

Source

pub fn new_scroll( direction: ScrollDirection, amount: i32, zone_id: Option<String>, ) -> Self

Create a scroll event

Source

pub fn new_focus(zone_id: Option<String>) -> Self

Create a focus event

Source

pub fn new_blur(zone_id: Option<String>) -> Self

Create a blur event

Source

pub fn new_resize(new_size: (usize, usize)) -> Self

Create a resize event

Source

pub fn new_custom( name: String, data: Option<String>, zone_id: Option<String>, ) -> Self

Create a custom event

Source

pub fn new_mouse_move( from_pos: Option<(usize, usize)>, to_pos: (usize, usize), zone_id: Option<String>, ) -> Self

Create a mouse move event

Source

pub fn new_mouse_drag( from_pos: (usize, usize), to_pos: (usize, usize), button: MouseButton, zone_id: Option<String>, ) -> Self

Create a mouse drag event

Source

pub fn new_hover_enter( position: (usize, usize), zone_id: String, previous_zone: Option<String>, ) -> Self

Create a hover enter event

Source

pub fn new_hover_leave( position: (usize, usize), zone_id: String, new_zone: Option<String>, ) -> Self

Create a hover leave event

Source

pub fn new_hover_move( position: (usize, usize), zone_id: String, duration: Duration, ) -> Self

Create a hover move event (within same zone)

Source

pub fn new_box_resize( resize_type: BoxResizeType, original_bounds: (usize, usize, usize, usize), new_bounds: (usize, usize, usize, usize), anchor: ResizeAnchor, state: ResizeState, ) -> Self

Create a box resize event

Source

pub fn new_title_change( old_title: Option<String>, new_title: String, source: TitleChangeSource, persist: bool, ) -> Self

Create a title change event

Source

pub fn mouse_button(&self) -> Option<&MouseButton>

Get the mouse button for click events

Source

pub fn key_info(&self) -> Option<&KeyInfo>

Get the key information for key events

Source

pub fn scroll_info(&self) -> Option<&ScrollInfo>

Get the scroll information for scroll events

Source

pub fn is_click(&self) -> bool

Check if this is a click event

Source

pub fn is_double_click(&self) -> bool

Check if this is a double-click event

Source

pub fn is_keyboard(&self) -> bool

Check if this is a keyboard event

Source

pub fn is_mouse_move(&self) -> bool

Check if this is a mouse move event

Source

pub fn is_box_resize(&self) -> bool

Check if this is a box resize event

Source

pub fn is_title_change(&self) -> bool

Check if this is a title change event

Source

pub fn mouse_move_info(&self) -> Option<&MouseMoveInfo>

Get the mouse move information

Source

pub fn hover_info(&self) -> Option<&HoverInfo>

Get the hover information

Source

pub fn box_resize_info(&self) -> Option<&BoxResizeInfo>

Get the box resize information

Source

pub fn title_change_info(&self) -> Option<&TitleChangeInfo>

Get the title change information

Source

pub fn is_drag(&self) -> bool

Check if this is a drag event

Source

pub fn is_hover_enter(&self) -> bool

Check if this is a hover enter event

Source

pub fn is_hover_leave(&self) -> bool

Check if this is a hover leave event

Source

pub fn movement_delta(&self) -> Option<(i32, i32)>

Get the movement delta for mouse move/drag events

Trait Implementations§

Source§

impl Clone for ContentEvent

Source§

fn clone(&self) -> ContentEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContentEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more