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 crate::FontStyle;
use quicksilver::graphics::Graphics;
use quicksilver::{geom::Vector, Result, Window};
pub struct Text {
pub text: String,
pub font_style: FontStyle,
}
impl WidgetConfig<(), Text> for Text {
fn to_widget(self) -> (Text, ()) {
(self, ())
}
}
impl Widget for Text {
fn contains(&self, _: Vector) -> bool {
false
}
fn is_focusable(&self, _: Vector) -> bool {
false
}
fn render(&mut self, gfx: &mut Graphics, _: &Window) -> Result<()> {
self.font_style.draw(gfx, &self.text)?;
Ok(())
}
}