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: EventTypeType 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: EventDataAdditional event-specific data
timestamp: SystemTimeTimestamp when event occurred
Implementations§
Source§impl ContentEvent
impl ContentEvent
Sourcepub fn new(
event_type: EventType,
position: Option<(usize, usize)>,
zone_id: Option<String>,
) -> Self
pub fn new( event_type: EventType, position: Option<(usize, usize)>, zone_id: Option<String>, ) -> Self
Create a new content event with current timestamp
Sourcepub fn new_click(
position: Option<(usize, usize)>,
zone_id: Option<String>,
) -> Self
pub fn new_click( position: Option<(usize, usize)>, zone_id: Option<String>, ) -> Self
Create a click event
Create a click event with specific mouse button
Sourcepub fn new_hover(position: (usize, usize), zone_id: Option<String>) -> Self
pub fn new_hover(position: (usize, usize), zone_id: Option<String>) -> Self
Create a hover event
Sourcepub fn new_keypress(
key: String,
modifiers: Vec<KeyModifier>,
zone_id: Option<String>,
) -> Self
pub fn new_keypress( key: String, modifiers: Vec<KeyModifier>, zone_id: Option<String>, ) -> Self
Create a key press event
Sourcepub fn new_scroll(
direction: ScrollDirection,
amount: i32,
zone_id: Option<String>,
) -> Self
pub fn new_scroll( direction: ScrollDirection, amount: i32, zone_id: Option<String>, ) -> Self
Create a scroll event
Sourcepub fn new_resize(new_size: (usize, usize)) -> Self
pub fn new_resize(new_size: (usize, usize)) -> Self
Create a resize event
Sourcepub fn new_custom(
name: String,
data: Option<String>,
zone_id: Option<String>,
) -> Self
pub fn new_custom( name: String, data: Option<String>, zone_id: Option<String>, ) -> Self
Create a custom event
Sourcepub fn new_mouse_move(
from_pos: Option<(usize, usize)>,
to_pos: (usize, usize),
zone_id: Option<String>,
) -> Self
pub fn new_mouse_move( from_pos: Option<(usize, usize)>, to_pos: (usize, usize), zone_id: Option<String>, ) -> Self
Create a mouse move event
Sourcepub fn new_mouse_drag(
from_pos: (usize, usize),
to_pos: (usize, usize),
button: MouseButton,
zone_id: Option<String>,
) -> Self
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
Sourcepub fn new_hover_enter(
position: (usize, usize),
zone_id: String,
previous_zone: Option<String>,
) -> Self
pub fn new_hover_enter( position: (usize, usize), zone_id: String, previous_zone: Option<String>, ) -> Self
Create a hover enter event
Sourcepub fn new_hover_leave(
position: (usize, usize),
zone_id: String,
new_zone: Option<String>,
) -> Self
pub fn new_hover_leave( position: (usize, usize), zone_id: String, new_zone: Option<String>, ) -> Self
Create a hover leave event
Sourcepub fn new_hover_move(
position: (usize, usize),
zone_id: String,
duration: Duration,
) -> Self
pub fn new_hover_move( position: (usize, usize), zone_id: String, duration: Duration, ) -> Self
Create a hover move event (within same zone)
Sourcepub fn new_box_resize(
resize_type: BoxResizeType,
original_bounds: (usize, usize, usize, usize),
new_bounds: (usize, usize, usize, usize),
anchor: ResizeAnchor,
state: ResizeState,
) -> Self
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
Sourcepub fn new_title_change(
old_title: Option<String>,
new_title: String,
source: TitleChangeSource,
persist: bool,
) -> Self
pub fn new_title_change( old_title: Option<String>, new_title: String, source: TitleChangeSource, persist: bool, ) -> Self
Create a title change event
Get the mouse button for click events
Sourcepub fn scroll_info(&self) -> Option<&ScrollInfo>
pub fn scroll_info(&self) -> Option<&ScrollInfo>
Get the scroll information for scroll events
Sourcepub fn is_double_click(&self) -> bool
pub fn is_double_click(&self) -> bool
Check if this is a double-click event
Sourcepub fn is_keyboard(&self) -> bool
pub fn is_keyboard(&self) -> bool
Check if this is a keyboard event
Sourcepub fn is_mouse_move(&self) -> bool
pub fn is_mouse_move(&self) -> bool
Check if this is a mouse move event
Sourcepub fn is_box_resize(&self) -> bool
pub fn is_box_resize(&self) -> bool
Check if this is a box resize event
Sourcepub fn is_title_change(&self) -> bool
pub fn is_title_change(&self) -> bool
Check if this is a title change event
Sourcepub fn mouse_move_info(&self) -> Option<&MouseMoveInfo>
pub fn mouse_move_info(&self) -> Option<&MouseMoveInfo>
Get the mouse move information
Sourcepub fn hover_info(&self) -> Option<&HoverInfo>
pub fn hover_info(&self) -> Option<&HoverInfo>
Get the hover information
Sourcepub fn box_resize_info(&self) -> Option<&BoxResizeInfo>
pub fn box_resize_info(&self) -> Option<&BoxResizeInfo>
Get the box resize information
Sourcepub fn title_change_info(&self) -> Option<&TitleChangeInfo>
pub fn title_change_info(&self) -> Option<&TitleChangeInfo>
Get the title change information
Sourcepub fn is_hover_enter(&self) -> bool
pub fn is_hover_enter(&self) -> bool
Check if this is a hover enter event
Sourcepub fn is_hover_leave(&self) -> bool
pub fn is_hover_leave(&self) -> bool
Check if this is a hover leave event
Sourcepub fn movement_delta(&self) -> Option<(i32, i32)>
pub fn movement_delta(&self) -> Option<(i32, i32)>
Get the movement delta for mouse move/drag events
Trait Implementations§
Source§impl Clone for ContentEvent
impl Clone for ContentEvent
Source§fn clone(&self) -> ContentEvent
fn clone(&self) -> ContentEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ContentEvent
impl RefUnwindSafe for ContentEvent
impl Send for ContentEvent
impl Sync for ContentEvent
impl Unpin for ContentEvent
impl UnsafeUnpin for ContentEvent
impl UnwindSafe for ContentEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.