blob: 68753054a7a9a707254086e830d229042dafb478 (
plain)
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
|
use std::fmt::Display;
use iced::Element;
use crate::{
gui::components::{navigation, Text},
impl_focusable,
};
#[derive(Clone, Debug, PartialEq)]
pub struct DummyNavigationOption {
pub name: String,
is_focused: bool,
}
impl DummyNavigationOption {
pub fn new(name: &str) -> Self {
Self {
name: String::from(name),
is_focused: false,
}
}
}
impl<'a> From<&'a DummyNavigationOption>
for Element<'a, navigation::Message<DummyNavigationOption>>
{
fn from(option: &'a DummyNavigationOption) -> Self {
Text::new(option.name.as_str()).into()
}
}
impl Display for DummyNavigationOption {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.name)
}
}
impl_focusable!(DummyNavigationOption);
|