fix(calendar): show button icons on non-Linux targets
This commit is contained in:
parent
f5f7c14f03
commit
c5df9dcf88
3 changed files with 30 additions and 10 deletions
3
res/icons/go-next-symbolic.svg
Normal file
3
res/icons/go-next-symbolic.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.8 8.61106C11.8 8.61106 12 8.37437 12 8.01163C12 7.64889 11.8 7.4122 11.8 7.4122L5.59947 1.21812C5.59947 1.21812 4.86007 0.63914 4.24935 1.36778C3.71912 1.96029 4.19936 2.61659 4.19936 2.61659L9.49979 8.01163L4.19936 13.4063C4.19936 13.4063 3.71913 14.0057 4.24936 14.6551C4.8405 15.3309 5.59947 14.8051 5.59947 14.8051L11.8 8.61106Z" fill="#232323"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 467 B |
3
res/icons/go-previous-symbolic.svg
Normal file
3
res/icons/go-previous-symbolic.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.20002 8.61106C4.20002 8.61106 4.00002 8.37437 4 8.01163C3.99998 7.64889 4.20002 7.4122 4.20002 7.4122L10.4005 1.21812C10.4005 1.21812 11.1399 0.63914 11.7507 1.36778C12.2809 1.96029 11.8006 2.61659 11.8006 2.61659L6.50021 8.01163L11.8006 13.4063C11.8006 13.4063 12.2809 14.0057 11.7506 14.6551C11.1595 15.3309 10.4005 14.8051 10.4005 14.8051L4.20002 8.61106Z" fill="#232323"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 492 B |
|
|
@ -7,6 +7,7 @@ use std::cmp;
|
|||
|
||||
use crate::iced_core::{Alignment, Length, Padding};
|
||||
use crate::widget::{Grid, button, column, grid, icon, row, text};
|
||||
use apply::Apply;
|
||||
use chrono::{Datelike, Days, Local, Months, NaiveDate, Weekday};
|
||||
|
||||
/// A widget that displays an interactive calendar.
|
||||
|
|
@ -115,19 +116,32 @@ where
|
|||
Message: Clone + 'static,
|
||||
{
|
||||
fn from(this: Calendar<'a, Message>) -> Self {
|
||||
macro_rules! icon {
|
||||
($name:expr, $on_press:expr) => {{
|
||||
#[cfg(target_os = "linux")]
|
||||
let icon = {
|
||||
icon::from_name($name)
|
||||
.apply(button::icon)
|
||||
};
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let icon = {
|
||||
icon::from_svg_bytes(include_bytes!(concat!(
|
||||
"../../res/icons/",
|
||||
$name,
|
||||
".svg"
|
||||
)))
|
||||
.symbolic(true)
|
||||
.apply(button::icon)
|
||||
};
|
||||
icon.padding([0, 12])
|
||||
.on_press($on_press)
|
||||
}};
|
||||
}
|
||||
let date = text(this.model.visible.format("%B %Y").to_string()).size(18);
|
||||
|
||||
let month_controls = row::with_capacity(2)
|
||||
.push(
|
||||
button::icon(icon::from_name("go-previous-symbolic"))
|
||||
.padding([0, 12])
|
||||
.on_press((this.on_prev)()),
|
||||
)
|
||||
.push(
|
||||
button::icon(icon::from_name("go-next-symbolic"))
|
||||
.padding([0, 12])
|
||||
.on_press((this.on_next)()),
|
||||
);
|
||||
.push(icon!("go-previous-symbolic", (this.on_prev)()))
|
||||
.push(icon!("go-next-symbolic", (this.on_next)()));
|
||||
|
||||
// Calender
|
||||
let mut calendar_grid: Grid<'_, Message> =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue