1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::CrossingMode;
use crate::Event;
use crate::NotifyType;
use glib::translate::*;
use glib::StaticType;
use std::fmt;

glib::wrapper! {
    /// An event caused by a pointing device moving between surfaces.
    #[doc(alias = "GdkCrossingEvent")]
    pub struct CrossingEvent(Shared<ffi::GdkCrossingEvent>);

    match fn {
        ref => |ptr| ffi::gdk_event_ref(ptr as *mut ffi::GdkEvent),
        unref => |ptr| ffi::gdk_event_unref(ptr as *mut ffi::GdkEvent),
    }
}

impl glib::StaticType for CrossingEvent {
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::gdk_crossing_event_get_type()) }
    }
}

impl CrossingEvent {
    /// Extracts the notify detail from a crossing event.
    ///
    /// # Returns
    ///
    /// the notify detail of @self
    #[doc(alias = "gdk_crossing_event_get_detail")]
    #[doc(alias = "get_detail")]
    pub fn detail(&self) -> NotifyType {
        unsafe { from_glib(ffi::gdk_crossing_event_get_detail(self.to_glib_none().0)) }
    }

    /// Checks if the @self surface is the focus surface.
    ///
    /// # Returns
    ///
    /// [`true`] if the surface is the focus surface
    #[doc(alias = "gdk_crossing_event_get_focus")]
    #[doc(alias = "get_focus")]
    pub fn gets_focus(&self) -> bool {
        unsafe { from_glib(ffi::gdk_crossing_event_get_focus(self.to_glib_none().0)) }
    }

    /// Extracts the crossing mode from a crossing event.
    ///
    /// # Returns
    ///
    /// the mode of @self
    #[doc(alias = "gdk_crossing_event_get_mode")]
    #[doc(alias = "get_mode")]
    pub fn mode(&self) -> CrossingMode {
        unsafe { from_glib(ffi::gdk_crossing_event_get_mode(self.to_glib_none().0)) }
    }
}

impl fmt::Display for CrossingEvent {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("CrossingEvent")
    }
}