|
|
|
@ -295,6 +295,7 @@ pub struct ButtonStyle {
|
|
|
|
|
|
|
|
|
|
impl ButtonStyleSheet {
|
|
|
|
|
pub fn new(
|
|
|
|
|
font: Font,
|
|
|
|
|
normal_color: Color,
|
|
|
|
|
active_color: Color,
|
|
|
|
|
with_outline: bool,
|
|
|
|
@ -304,7 +305,7 @@ impl ButtonStyleSheet {
|
|
|
|
|
) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
normal: ButtonStyle {
|
|
|
|
|
font: theme::FONT_BUTTON,
|
|
|
|
|
font,
|
|
|
|
|
text_color: normal_color,
|
|
|
|
|
with_outline,
|
|
|
|
|
with_arms,
|
|
|
|
@ -312,7 +313,7 @@ impl ButtonStyleSheet {
|
|
|
|
|
offset,
|
|
|
|
|
},
|
|
|
|
|
active: ButtonStyle {
|
|
|
|
|
font: theme::FONT_BUTTON,
|
|
|
|
|
font,
|
|
|
|
|
text_color: active_color,
|
|
|
|
|
with_outline,
|
|
|
|
|
with_arms,
|
|
|
|
@ -324,12 +325,14 @@ impl ButtonStyleSheet {
|
|
|
|
|
|
|
|
|
|
// White text in normal mode.
|
|
|
|
|
pub fn default(
|
|
|
|
|
font: Font,
|
|
|
|
|
with_outline: bool,
|
|
|
|
|
with_arms: bool,
|
|
|
|
|
fixed_width: Option<i16>,
|
|
|
|
|
offset: Offset,
|
|
|
|
|
) -> Self {
|
|
|
|
|
Self::new(
|
|
|
|
|
font,
|
|
|
|
|
theme::FG,
|
|
|
|
|
theme::BG,
|
|
|
|
|
with_outline,
|
|
|
|
@ -350,6 +353,7 @@ pub struct ButtonDetails {
|
|
|
|
|
fixed_width: Option<i16>,
|
|
|
|
|
offset: Offset,
|
|
|
|
|
pub send_long_press: bool,
|
|
|
|
|
font_normal: bool,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl ButtonDetails {
|
|
|
|
@ -363,6 +367,7 @@ impl ButtonDetails {
|
|
|
|
|
fixed_width: None,
|
|
|
|
|
offset: Offset::zero(),
|
|
|
|
|
send_long_press: false,
|
|
|
|
|
font_normal: false,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -376,6 +381,7 @@ impl ButtonDetails {
|
|
|
|
|
fixed_width: None,
|
|
|
|
|
offset: Offset::zero(),
|
|
|
|
|
send_long_press: false,
|
|
|
|
|
font_normal: false,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -469,9 +475,16 @@ impl ButtonDetails {
|
|
|
|
|
self
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn with_normal_font(mut self) -> Self {
|
|
|
|
|
self.font_normal = true;
|
|
|
|
|
self
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Button style that should be applied.
|
|
|
|
|
pub fn style(&self) -> ButtonStyleSheet {
|
|
|
|
|
let font = if self.font_normal {Font::NORMAL} else {Font::NORMAL_UPPER};
|
|
|
|
|
ButtonStyleSheet::default(
|
|
|
|
|
font,
|
|
|
|
|
self.with_outline,
|
|
|
|
|
self.with_arms,
|
|
|
|
|
self.fixed_width,
|
|
|
|
@ -539,7 +552,11 @@ impl ButtonLayout {
|
|
|
|
|
Self::new(
|
|
|
|
|
Some(ButtonDetails::from_text_possible_icon(left)),
|
|
|
|
|
Some(ButtonDetails::armed_text(middle)),
|
|
|
|
|
Some(ButtonDetails::text("i".into()).with_fixed_width(theme::BUTTON_ICON_WIDTH)),
|
|
|
|
|
Some(
|
|
|
|
|
ButtonDetails::text("i".into())
|
|
|
|
|
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
|
|
|
|
.with_normal_font(),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -548,7 +565,11 @@ impl ButtonLayout {
|
|
|
|
|
Self::new(
|
|
|
|
|
Some(ButtonDetails::cancel_icon()),
|
|
|
|
|
Some(ButtonDetails::armed_text(middle)),
|
|
|
|
|
Some(ButtonDetails::text("i".into()).with_fixed_width(theme::BUTTON_ICON_WIDTH)),
|
|
|
|
|
Some(
|
|
|
|
|
ButtonDetails::text("i".into())
|
|
|
|
|
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
|
|
|
|
.with_normal_font(),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -665,7 +686,11 @@ impl ButtonLayout {
|
|
|
|
|
Self::new(
|
|
|
|
|
Some(ButtonDetails::up_arrow_icon()),
|
|
|
|
|
Some(ButtonDetails::armed_text(text)),
|
|
|
|
|
Some(ButtonDetails::text("i".into()).with_fixed_width(theme::BUTTON_ICON_WIDTH)),
|
|
|
|
|
Some(
|
|
|
|
|
ButtonDetails::text("i".into())
|
|
|
|
|
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
|
|
|
|
.with_normal_font(),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|