fix(context menu): use radius from theme

This commit is contained in:
Vukašin Vojinović 2024-11-05 13:21:05 +01:00 committed by Jeremy Soller
parent eba2eb38b7
commit a432f714de
4 changed files with 155 additions and 181 deletions

View file

@ -411,7 +411,8 @@ pub struct App {
find: bool,
find_search_id: widget::Id,
find_search_value: String,
term_event_tx_opt: Option<mpsc::UnboundedSender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>>,
term_event_tx_opt:
Option<mpsc::UnboundedSender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>>,
startup_options: Option<tty::Options>,
term_config: term::Config,
color_scheme_errors: Vec<String>,

View file

@ -4,12 +4,12 @@ use cosmic::widget::menu::key_bind::KeyBind;
use cosmic::widget::menu::{items as menu_items, menu_button, root as menu_root, Item as MenuItem};
use cosmic::{
iced::{
widget::{column, horizontal_rule, horizontal_space},
widget::{column, horizontal_space},
Background, Length,
},
iced_core::Border,
widget::{
self,
self, divider,
menu::{ItemHeight, ItemWidth, MenuBar, Tree as MenuTree},
segmented_button,
},
@ -59,13 +59,13 @@ pub fn context_menu<'a>(
menu_item(fl!("copy"), Action::Copy),
menu_item(fl!("paste"), Action::Paste),
menu_item(fl!("select-all"), Action::SelectAll),
horizontal_rule(1),
divider::horizontal::light(),
menu_item(fl!("clear-scrollback"), Action::ClearScrollback),
horizontal_rule(1),
divider::horizontal::light(),
menu_item(fl!("split-horizontal"), Action::PaneSplitHorizontal),
menu_item(fl!("split-vertical"), Action::PaneSplitVertical),
menu_item(fl!("pane-toggle-maximize"), Action::PaneToggleMaximized),
horizontal_rule(1),
divider::horizontal::light(),
menu_item(fl!("new-tab"), Action::TabNew),
menu_item(fl!("menu-settings"), Action::Settings),
menu_checkbox(
@ -84,7 +84,7 @@ pub fn context_menu<'a>(
text_color: Some(component.on.into()),
background: Some(Background::Color(component.base.into())),
border: Border {
radius: 8.0.into(),
radius: cosmic.radius_s().map(|x| x + 1.0).into(),
width: 1.0,
color: component.divider.into(),
},
@ -132,7 +132,7 @@ pub fn color_scheme_menu<'a>(
text_color: Some(component.on.into()),
background: Some(Background::Color(component.base.into())),
border: Border {
radius: 8.0.into(),
radius: cosmic.radius_s().map(|x| x + 1.0).into(),
width: 1.0,
color: component.divider.into(),
},

View file

@ -246,6 +246,7 @@ where
let state = tree.state.downcast_ref::<State>();
let cosmic_theme = theme.cosmic();
let radius_s = cosmic_theme.corner_radii.radius_s[0];
let scrollbar_w = f32::from(cosmic_theme.spacing.space_xxs);
let view_position = layout.position() + [self.padding.left, self.padding.top].into();
@ -279,7 +280,11 @@ where
renderer.fill_quad(
Quad {
bounds: layout.bounds(),
border: self.border,
border: Border {
radius: [0.0, 0.0, radius_s, radius_s].into(),
width: self.border.width,
color: self.border.color,
},
..Default::default()
},
Color::new(