Struct gdk::EventButton
source · [−]pub struct EventButton(_);
Expand description
Used for button press and button release events. The
type
field will be one of EventType::ButtonPress
,
[EventType::_2buttonPress
][crate::EventType::_2buttonPress], [EventType::_3buttonPress
][crate::EventType::_3buttonPress] or EventType::ButtonRelease
,
Double and triple-clicks result in a sequence of events being received. For double-clicks the order of events will be:
EventType::ButtonPress
EventType::ButtonRelease
EventType::ButtonPress
- [
EventType::_2buttonPress
][crate::EventType::_2buttonPress] EventType::ButtonRelease
Note that the first click is received just like a normal
button press, while the second click results in a [EventType::_2buttonPress
][crate::EventType::_2buttonPress]
being received just after the EventType::ButtonPress
.
Triple-clicks are very similar to double-clicks, except that
[EventType::_3buttonPress
][crate::EventType::_3buttonPress] is inserted after the third click. The order of the
events is:
EventType::ButtonPress
EventType::ButtonRelease
EventType::ButtonPress
- [
EventType::_2buttonPress
][crate::EventType::_2buttonPress] EventType::ButtonRelease
EventType::ButtonPress
- [
EventType::_3buttonPress
][crate::EventType::_3buttonPress] EventType::ButtonRelease
For a double click to occur, the second button press must occur within 1/4 of a second of the first. For a triple click to occur, the third button press must also occur within 1/2 second of the first button press.
Implementations
Methods from Deref<Target = Event>
pub fn put(&self)
pub fn axis(&self, axis_use: AxisUse) -> Option<f64>
pub fn click_count(&self) -> Option<u32>
pub fn coords(&self) -> Option<(f64, f64)>
pub fn keycode(&self) -> Option<u16>
pub fn keyval(&self) -> Option<u32>
pub fn root_coords(&self) -> Option<(f64, f64)>
pub fn scroll_direction(&self) -> Option<ScrollDirection>
pub fn scroll_deltas(&self) -> Option<(f64, f64)>
pub fn is_scroll_stop_event(&self) -> bool
pub fn state(&self) -> Option<ModifierType>
pub fn time(&self) -> u32
pub fn event_sequence(&self) -> Option<EventSequence>
pub fn seat(&self) -> Option<Seat>
pub fn scancode(&self) -> i32
pub fn is_pointer_emulated(&self) -> bool
pub fn set_screen(&mut self, screen: Option<&Screen>)
pub fn screen(&self) -> Option<Screen>
pub fn set_device(&mut self, device: Option<&Device>)
pub fn device(&self) -> Option<Device>
pub fn set_source_device(&mut self, device: Option<&Device>)
pub fn source_device(&self) -> Option<Device>
pub fn set_device_tool(&mut self, device: Option<&DeviceTool>)
pub fn device_tool(&self) -> Option<DeviceTool>
sourcepub fn event_type(&self) -> EventType
pub fn event_type(&self) -> EventType
Returns the event type.
sourcepub fn is_send_event(&self) -> bool
pub fn is_send_event(&self) -> bool
Returns whether the event was sent explicitly.
sourcepub fn downcast_ref<T: FromEvent>(&self) -> Option<&T>
pub fn downcast_ref<T: FromEvent>(&self) -> Option<&T>
Tries to downcast to a specific event type.
sourcepub fn downcast_mut<T: FromEvent>(&mut self) -> Option<&mut T>
pub fn downcast_mut<T: FromEvent>(&mut self) -> Option<&mut T>
Tries to downcast to a specific event type.
Trait Implementations
sourceimpl AsMut<GdkEventButton> for EventButton
impl AsMut<GdkEventButton> for EventButton
sourceimpl AsRef<GdkEventButton> for EventButton
impl AsRef<GdkEventButton> for EventButton
sourceimpl Clone for EventButton
impl Clone for EventButton
sourcefn clone(&self) -> EventButton
fn clone(&self) -> EventButton
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for EventButton
impl Debug for EventButton
sourceimpl Deref for EventButton
impl Deref for EventButton
sourceimpl DerefMut for EventButton
impl DerefMut for EventButton
sourceimpl FromEvent for EventButton
impl FromEvent for EventButton
sourceimpl FromGlibPtrBorrow<*mut GdkEventButton> for EventButton
impl FromGlibPtrBorrow<*mut GdkEventButton> for EventButton
sourceunsafe fn from_glib_borrow(ptr: *mut GdkEventButton) -> Borrowed<Self>
unsafe fn from_glib_borrow(ptr: *mut GdkEventButton) -> Borrowed<Self>
sourceimpl FromGlibPtrFull<*mut GdkEventButton> for EventButton
impl FromGlibPtrFull<*mut GdkEventButton> for EventButton
sourceunsafe fn from_glib_full(ptr: *mut GdkEventButton) -> Self
unsafe fn from_glib_full(ptr: *mut GdkEventButton) -> Self
sourceimpl FromGlibPtrNone<*mut GdkEventButton> for EventButton
impl FromGlibPtrNone<*mut GdkEventButton> for EventButton
sourceunsafe fn from_glib_none(ptr: *mut GdkEventButton) -> Self
unsafe fn from_glib_none(ptr: *mut GdkEventButton) -> Self
sourceimpl Hash for EventButton
impl Hash for EventButton
sourceimpl Ord for EventButton
impl Ord for EventButton
sourcefn cmp(&self, other: &EventButton) -> Ordering
fn cmp(&self, other: &EventButton) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<EventButton> for EventButton
impl PartialEq<EventButton> for EventButton
sourcefn eq(&self, other: &EventButton) -> bool
fn eq(&self, other: &EventButton) -> bool
sourceimpl PartialOrd<EventButton> for EventButton
impl PartialOrd<EventButton> for EventButton
sourcefn partial_cmp(&self, other: &EventButton) -> Option<Ordering>
fn partial_cmp(&self, other: &EventButton) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more