gdk4/auto/crossing_event.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, CrossingMode, NotifyType};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// An event caused by a pointing device moving between surfaces.
10 #[doc(alias = "GdkCrossingEvent")]
11 pub struct CrossingEvent(Shared<ffi::GdkCrossingEvent>);
12
13 match fn {
14 ref => |ptr| ffi::gdk_event_ref(ptr as *mut ffi::GdkEvent),
15 unref => |ptr| ffi::gdk_event_unref(ptr as *mut ffi::GdkEvent),
16 }
17}
18
19impl StaticType for CrossingEvent {
20 fn static_type() -> glib::Type {
21 unsafe { from_glib(ffi::gdk_crossing_event_get_type()) }
22 }
23}
24
25impl CrossingEvent {
26 /// Extracts the notify detail from a crossing event.
27 ///
28 /// # Returns
29 ///
30 /// the notify detail of @self
31 #[doc(alias = "gdk_crossing_event_get_detail")]
32 #[doc(alias = "get_detail")]
33 pub fn detail(&self) -> NotifyType {
34 unsafe { from_glib(ffi::gdk_crossing_event_get_detail(self.to_glib_none().0)) }
35 }
36
37 /// Checks if the @self surface is the focus surface.
38 ///
39 /// # Returns
40 ///
41 /// [`true`] if the surface is the focus surface
42 #[doc(alias = "gdk_crossing_event_get_focus")]
43 #[doc(alias = "get_focus")]
44 pub fn gets_focus(&self) -> bool {
45 unsafe { from_glib(ffi::gdk_crossing_event_get_focus(self.to_glib_none().0)) }
46 }
47
48 /// Extracts the crossing mode from a crossing event.
49 ///
50 /// # Returns
51 ///
52 /// the mode of @self
53 #[doc(alias = "gdk_crossing_event_get_mode")]
54 #[doc(alias = "get_mode")]
55 pub fn mode(&self) -> CrossingMode {
56 unsafe { from_glib(ffi::gdk_crossing_event_get_mode(self.to_glib_none().0)) }
57 }
58}