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
use crate::widgets::{Widget, WidgetConfig};
use quicksilver::geom::{Rectangle, Vector};
use quicksilver::graphics::Graphics;
use quicksilver::{Result, Window};
pub struct Image {
pub image: quicksilver::graphics::Image,
pub location: Rectangle,
}
impl WidgetConfig<(), Image> for Image {
fn to_widget(self) -> (Image, ()) {
(self, ())
}
}
impl Widget for Image {
fn contains(&self, _: Vector) -> bool {
false
}
fn is_focusable(&self, _: Vector) -> bool {
false
}
fn render(&mut self, gfx: &mut Graphics, _: &Window) -> Result<()> {
gfx.draw_image(&self.image, self.location);
Ok(())
}
}