gdk/event_expose.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::Rectangle;
4use glib::translate::*;
5
6/// Generated when all or part of a window becomes visible and needs to be
7/// redrawn.
8#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
9pub struct EventExpose(crate::Event);
10
11event_wrapper!(EventExpose, GdkEventExpose);
12event_subtype!(EventExpose, ffi::GDK_EXPOSE | ffi::GDK_DAMAGE);
13
14impl EventExpose {
15 #[doc(alias = "get_region")]
16 pub fn region(&self) -> Option<cairo::Region> {
17 unsafe { from_glib_none(self.as_ref().region) }
18 }
19
20 #[doc(alias = "get_count")]
21 pub fn count(&self) -> u32 {
22 self.as_ref().count as u32
23 }
24
25 #[doc(alias = "get_area")]
26 pub fn area(&self) -> Rectangle {
27 unsafe { from_glib_none(&self.as_ref().area as *const _) }
28 }
29}