gdk/
event_expose.rs

1// Copyright 2016, The Gtk-rs Project Developers.
2// See the COPYRIGHT file at the top-level directory of this distribution.
3// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4
5use cairo;
6use gdk_sys;
7use glib::translate::*;
8use Rectangle;
9
10#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11pub struct EventExpose(::Event);
12
13event_wrapper!(EventExpose, GdkEventExpose);
14event_subtype!(EventExpose, gdk_sys::GDK_EXPOSE | gdk_sys::GDK_DAMAGE);
15
16impl EventExpose {
17    pub fn get_region(&self) -> Option<cairo::Region> {
18        unsafe { from_glib_none(self.as_ref().region) }
19    }
20
21    pub fn get_count(&self) -> u32 {
22        self.as_ref().count as u32
23    }
24
25    pub fn get_area(&self) -> Rectangle {
26        unsafe { from_glib_none(&self.as_ref().area as *const _) }
27    }
28}