fix dioxus-tui events
This commit is contained in:
1 parent
0ab7a02777
commit
d06e64e5ad
19 files changed
+221
-21
No files matched your search
@@ -7,18 +7,29 @@ pub struct AnimationData {
|
||||
}
|
||||
|
||||
impl AnimationData {
|
||||
/// Create a new AnimationData
|
||||
pub fn new(inner: impl HasAnimationData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// The name of the animation
|
||||
pub fn animation_name(&self) -> String {
|
||||
self.inner.animation_name()
|
||||
}
|
||||
|
||||
/// The name of the pseudo-element the animation runs on
|
||||
pub fn pseudo_element(&self) -> String {
|
||||
self.inner.pseudo_element()
|
||||
}
|
||||
|
||||
/// The amount of time the animation has been running
|
||||
pub fn elapsed_time(&self) -> f32 {
|
||||
self.inner.elapsed_time()
|
||||
}
|
||||
|
||||
/// Downcast this event to a concrete event type
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_ref().as_any().downcast_ref::<T>()
|
||||
}
|
||||
|
||||
@@ -25,12 +25,14 @@ impl PartialEq for ClipboardData {
|
||||
}
|
||||
|
||||
impl ClipboardData {
|
||||
/// Create a new ClipboardData
|
||||
pub fn new(inner: impl HasClipboardData) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// Downcast this event to a concrete event type
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_ref().as_any().downcast_ref::<T>()
|
||||
}
|
||||
|
||||
@@ -27,6 +27,14 @@ impl PartialEq for CompositionData {
|
||||
}
|
||||
|
||||
impl CompositionData {
|
||||
/// Create a new CompositionData
|
||||
pub fn new(inner: impl HasCompositionData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// The characters generated by the input method that raised the event
|
||||
pub fn data(&self) -> String {
|
||||
self.inner.data()
|
||||
}
|
||||
|
||||
@@ -44,6 +44,13 @@ impl PartialEq for DragData {
|
||||
}
|
||||
|
||||
impl DragData {
|
||||
/// Create a new DragData
|
||||
pub fn new(inner: impl HasDragData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// Downcast this event data to a specific type
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_any().downcast_ref::<T>()
|
||||
|
||||
@@ -25,6 +25,13 @@ impl PartialEq for FocusData {
|
||||
}
|
||||
|
||||
impl FocusData {
|
||||
/// Create a new FocusData
|
||||
pub fn new(inner: impl HasFocusData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// Downcast this event data to a specific type
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_any().downcast_ref::<T>()
|
||||
|
||||
@@ -46,6 +46,13 @@ impl PartialEq for KeyboardData {
|
||||
}
|
||||
|
||||
impl KeyboardData {
|
||||
/// Create a new KeyboardData
|
||||
pub fn new(inner: impl HasKeyboardData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// The value of the key pressed by the user, taking into consideration the state of modifier keys such as Shift as well as the keyboard locale and layout.
|
||||
pub fn key(&self) -> Key {
|
||||
self.inner.key()
|
||||
|
||||
@@ -24,6 +24,13 @@ impl PartialEq for MediaData {
|
||||
}
|
||||
|
||||
impl MediaData {
|
||||
/// Create a new MediaData
|
||||
pub fn new(inner: impl HasMediaData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// Downcast this event to a concrete event type
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_any().downcast_ref::<T>()
|
||||
|
||||
@@ -13,6 +13,13 @@ impl<E: HasScrollData> From<E> for ScrollData {
|
||||
}
|
||||
|
||||
impl ScrollData {
|
||||
/// Create a new ScrollData
|
||||
pub fn new(inner: impl HasScrollData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// Downcast this event to a concrete event type
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_any().downcast_ref::<T>()
|
||||
|
||||
@@ -7,6 +7,13 @@ pub struct SelectionData {
|
||||
}
|
||||
|
||||
impl SelectionData {
|
||||
/// Create a new SelectionData
|
||||
pub fn new(inner: impl HasSelectionData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// Downcast this event to a concrete event type
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_any().downcast_ref::<T>()
|
||||
|
||||
@@ -25,6 +25,13 @@ impl PartialEq for ToggleData {
|
||||
}
|
||||
|
||||
impl ToggleData {
|
||||
/// Create a new ToggleData
|
||||
pub fn new(inner: impl HasToggleData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// Downcast this event to a concrete event type
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_any().downcast_ref::<T>()
|
||||
|
||||
@@ -32,6 +32,13 @@ impl PartialEq for TouchData {
|
||||
}
|
||||
|
||||
impl TouchData {
|
||||
/// Create a new TouchData
|
||||
pub fn new(inner: impl HasTouchData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if the "ALT" key was down when the touch event was fired.
|
||||
pub fn alt_key(&self) -> bool {
|
||||
self.inner.alt_key()
|
||||
|
||||
@@ -31,6 +31,13 @@ impl PartialEq for TransitionData {
|
||||
}
|
||||
|
||||
impl TransitionData {
|
||||
/// Create a new TransitionData
|
||||
pub fn new(inner: impl HasTransitionData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// Downcast this event to a concrete event type
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_any().downcast_ref::<T>()
|
||||
|
||||
@@ -30,6 +30,13 @@ impl PartialEq for WheelData {
|
||||
}
|
||||
|
||||
impl WheelData {
|
||||
/// Create a new WheelData
|
||||
pub fn new(inner: impl HasWheelData + 'static) -> Self {
|
||||
Self {
|
||||
inner: Box::new(inner),
|
||||
}
|
||||
}
|
||||
|
||||
/// The amount of wheel movement
|
||||
#[allow(deprecated)]
|
||||
pub fn delta(&self) -> WheelDelta {
|
||||
|
||||
Reference in new issue
Block a user