You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/core/embed/rust/src/ui/model_tr/bootloader/menu.rs

47 lines
1.0 KiB

use crate::ui::{
component::{Child, Component, Event, EventCtx, Never, Pad},
geometry::{Point, Rect},
};
use super::super::{
bootloader::{theme::BLD_BG, title::Title},
constant::{HEIGHT, WIDTH},
};
pub struct Menu {
bg: Pad,
title: Child<Title>,
}
impl Menu {
pub fn new(bld_version: &'static str) -> Self {
let mut instance = Self {
bg: Pad::with_background(BLD_BG),
title: Child::new(Title::new(bld_version)),
};
instance.bg.clear();
instance
}
}
impl Component for Menu {
type Msg = Never;
fn place(&mut self, bounds: Rect) -> Rect {
self.bg
.place(Rect::new(Point::new(0, 0), Point::new(WIDTH, HEIGHT)));
self.title
.place(Rect::new(Point::new(10, 0), Point::new(128, 8)));
bounds
}
fn event(&mut self, _ctx: &mut EventCtx, _event: Event) -> Option<Self::Msg> {
None
}
fn paint(&mut self) {
self.bg.paint();
self.title.paint();
}
}