mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-10 15:30:55 +00:00
feat(core/rust/ui): add new icons
[no changelog]
This commit is contained in:
parent
b46901bc8b
commit
c7b33e2bc0
@ -1,10 +1,6 @@
|
|||||||
#[allow(unused_macros)] // T1 doesn't use icons (yet)
|
#[allow(unused_macros)] // T1 doesn't use icons (yet)
|
||||||
macro_rules! include_res {
|
macro_rules! include_res {
|
||||||
($filename:expr) => {
|
($filename:expr) => {
|
||||||
include_bytes!(concat!(
|
include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/ui/", $filename))
|
||||||
env!("CARGO_MANIFEST_DIR"),
|
|
||||||
"/../../src/trezor/res/",
|
|
||||||
$filename,
|
|
||||||
))
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,13 @@ pub struct ScrollBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ScrollBar {
|
impl ScrollBar {
|
||||||
pub const DOT_SIZE: Offset = Offset::new(8, 8);
|
const DOT_INTERVAL: i32 = 12;
|
||||||
pub const DOT_INTERVAL: i32 = 14;
|
const ARROW_SPACE: i32 = 23;
|
||||||
|
|
||||||
|
const ICON_ACTIVE: &'static [u8] = include_res!("model_tt/res/scroll-active.toif");
|
||||||
|
const ICON_INACTIVE: &'static [u8] = include_res!("model_tt/res/scroll-inactive.toif");
|
||||||
|
const ICON_UP: &'static [u8] = include_res!("model_tt/res/scroll-up.toif");
|
||||||
|
const ICON_DOWN: &'static [u8] = include_res!("model_tt/res/scroll-down.toif");
|
||||||
|
|
||||||
pub fn vertical_right(area: Rect, page_count: usize, active_page: usize) -> Self {
|
pub fn vertical_right(area: Rect, page_count: usize, active_page: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -179,18 +184,30 @@ impl Component for ScrollBar {
|
|||||||
self.area.center().x,
|
self.area.center().x,
|
||||||
self.area.center().y - (count / 2) * interval,
|
self.area.center().y - (count / 2) * interval,
|
||||||
);
|
);
|
||||||
for i in 0..self.page_count {
|
if self.has_previous_page() {
|
||||||
display::rounded_rect(
|
display::icon(
|
||||||
Rect::from_center_and_size(dot, Self::DOT_SIZE),
|
dot - Offset::new(0, Self::ARROW_SPACE),
|
||||||
if i == self.active_page {
|
Self::ICON_UP,
|
||||||
theme::FG
|
theme::FG,
|
||||||
} else {
|
|
||||||
theme::GREY_LIGHT
|
|
||||||
},
|
|
||||||
theme::BG,
|
theme::BG,
|
||||||
theme::RADIUS,
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
for i in 0..self.page_count {
|
||||||
|
let icon = if i == self.active_page {
|
||||||
|
Self::ICON_ACTIVE
|
||||||
|
} else {
|
||||||
|
Self::ICON_INACTIVE
|
||||||
|
};
|
||||||
|
display::icon(dot, icon, theme::FG, theme::BG);
|
||||||
dot.y += interval;
|
dot.y += interval;
|
||||||
}
|
}
|
||||||
|
if self.has_next_page() {
|
||||||
|
display::icon(
|
||||||
|
dot + Offset::new(0, Self::ARROW_SPACE - interval),
|
||||||
|
Self::ICON_DOWN,
|
||||||
|
theme::FG,
|
||||||
|
theme::BG,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
core/embed/rust/src/ui/model_tt/res/cancel.toif
Normal file
BIN
core/embed/rust/src/ui/model_tt/res/cancel.toif
Normal file
Binary file not shown.
BIN
core/embed/rust/src/ui/model_tt/res/confirm.toif
Normal file
BIN
core/embed/rust/src/ui/model_tt/res/confirm.toif
Normal file
Binary file not shown.
BIN
core/embed/rust/src/ui/model_tt/res/down.toif
Normal file
BIN
core/embed/rust/src/ui/model_tt/res/down.toif
Normal file
Binary file not shown.
BIN
core/embed/rust/src/ui/model_tt/res/next.toif
Normal file
BIN
core/embed/rust/src/ui/model_tt/res/next.toif
Normal file
Binary file not shown.
BIN
core/embed/rust/src/ui/model_tt/res/scroll-active.toif
Normal file
BIN
core/embed/rust/src/ui/model_tt/res/scroll-active.toif
Normal file
Binary file not shown.
BIN
core/embed/rust/src/ui/model_tt/res/scroll-down.toif
Normal file
BIN
core/embed/rust/src/ui/model_tt/res/scroll-down.toif
Normal file
Binary file not shown.
BIN
core/embed/rust/src/ui/model_tt/res/scroll-inactive.toif
Normal file
BIN
core/embed/rust/src/ui/model_tt/res/scroll-inactive.toif
Normal file
Binary file not shown.
BIN
core/embed/rust/src/ui/model_tt/res/scroll-up.toif
Normal file
BIN
core/embed/rust/src/ui/model_tt/res/scroll-up.toif
Normal file
Binary file not shown.
BIN
core/embed/rust/src/ui/model_tt/res/space.toif
Normal file
BIN
core/embed/rust/src/ui/model_tt/res/space.toif
Normal file
Binary file not shown.
@ -38,9 +38,9 @@ pub const RADIUS: u8 = 4;
|
|||||||
pub const ICON_SIZE: i32 = 16;
|
pub const ICON_SIZE: i32 = 16;
|
||||||
|
|
||||||
// UI icons.
|
// UI icons.
|
||||||
pub const ICON_CANCEL: &[u8] = include_res!("cancel.toif");
|
pub const ICON_CANCEL: &[u8] = include_res!("model_tt/res/cancel.toif");
|
||||||
pub const ICON_CONFIRM: &[u8] = include_res!("confirm.toif");
|
pub const ICON_CONFIRM: &[u8] = include_res!("model_tt/res/confirm.toif");
|
||||||
pub const ICON_SPACE: &[u8] = include_res!("space.toif");
|
pub const ICON_SPACE: &[u8] = include_res!("model_tt/res/space.toif");
|
||||||
|
|
||||||
pub fn label_default() -> LabelStyle {
|
pub fn label_default() -> LabelStyle {
|
||||||
LabelStyle {
|
LabelStyle {
|
||||||
|
Loading…
Reference in New Issue
Block a user