use super::*;
impl EuvInput {
#[must_use]
pub fn password(mut self, password: bool) -> Self {
self.set_password(password);
self
}
#[must_use]
pub fn disabled(mut self, disabled: bool) -> Self {
self.set_disabled(disabled);
self
}
#[must_use]
pub fn borderless(mut self, borderless: bool) -> Self {
self.set_borderless(borderless);
self
}
}
#[component]
impl EuvInput {
fn render(&self) -> NodeId {
let ctx: Context = current_context();
let base_tokens: ThemeTokens = self.get_tokens();
let init_tok: ThemeTokens = live_tokens_untracked(base_tokens);
let theme_palette: ThemePalette = init_tok.get_palette();
let theme_geometry: ThemeGeometry = init_tok.get_geometry();
let sig: Signal<String> = self.get_value();
let initial: String = sig.get_untracked();
let caret: usize = initial.len();
let password: bool = self.get_password();
let disabled: bool = self.get_disabled();
let borderless: bool = self.get_borderless();
let Self { placeholder, .. } = self;
let placeholder_owned: String = placeholder.clone();
let a11y_label: String = placeholder_owned.clone();
let card_surface: SurfaceColors = theme_palette.surface(SurfaceRole::Card);
let mut style: Style = Style::default();
style
.get_mut_layout()
.set_width(Length::Percent(100.0))
.set_height(Length::Px(theme_geometry.get_control_md()))
.set_padding(Edges::symmetric(0.0, SPACE_MD))
.set_overflow(Overflow::Hidden);
style
.get_mut_text()
.set_color(card_surface.get_fg())
.set_font_size(13.0);
if borderless {
style
.get_mut_paint()
.set_background(Some(COLOR_TRANSPARENT));
} else {
style
.get_mut_paint()
.set_background(Some(card_surface.get_bg()))
.set_border(Border::new(
theme_geometry.get_border_width(),
card_surface.get_border(),
))
.set_radius(CornerRadius::all(theme_geometry.get_radius_md().max(0.0)))
.set_focus_ring(None);
}
let on_input_change = move |ui_event: &UiEvent| {
if let UiEventKind::Change(val) = ui_event.get_kind() {
let _: bool = sig.set_if_changed(val.clone());
}
};
let node: NodeId = view! {
input {
style: style
value: initial.clone()
placeholder: placeholder_owned
caret: caret
password: password
multiline: false
disabled: disabled
role: A11yRole::TextInput
a11y_label: a11y_label.clone()
a11y_value: initial
a11y_disabled: disabled
on_change: on_input_change
}
};
let handle: SceneHandle = ctx.get_scene().clone();
let prev_key: Cell<ThemeKey> = Cell::new(init_tok.key());
let a11y_fallback: Rc<str> = Rc::from(a11y_label.as_str());
let (scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
Effect::new(move || {
let next_val: String = sig.get();
let live_tok: ThemeTokens = use_live_tokens(base_tokens);
let theme_changed: bool = prev_key.replace(live_tok.key()) != live_tok.key();
let fallback_label: Rc<str> = a11y_fallback.clone();
handle.mutate(move |tree: &mut SceneTree| {
let mut changed: bool = false;
if let Some(item_count) = tree.get_node_mut(node) {
if let NodeKind::Input(input_state) = item_count.get_mut_kind()
&& input_state.get_value() != &next_val
{
let len: usize = next_val.len();
input_state.set_value(next_val.clone());
input_state.set_caret(len);
changed = true;
}
if theme_changed {
let live_p: ThemePalette = live_tok.get_palette();
let live_g: ThemeGeometry = live_tok.get_geometry();
let surf: SurfaceColors = live_p.surface(SurfaceRole::Card);
let computed_style: &mut Style = item_count.get_mut_style();
computed_style.get_mut_text().set_color(surf.get_fg());
if !borderless {
computed_style
.get_mut_paint()
.set_background(Some(surf.get_bg()))
.set_border(Border::new(
live_g.get_border_width(),
surf.get_border(),
))
.set_focus_ring(None);
}
changed = true;
}
if let Some(a11y) = item_count.get_mut_a11y().as_mut() {
a11y.set_value(next_val);
a11y.set_disabled(disabled);
} else {
let mut next_a11y: A11yProps =
A11yProps::new(A11yRole::TextInput, fallback_label.to_string());
next_a11y.set_value(next_val);
next_a11y.set_disabled(disabled);
item_count.set_a11y(Some(next_a11y));
}
}
if changed {
tree.mark_dirty(node, DIRTY_PAINT);
}
});
})
});
ctx.get_scene().mutate(move |tree: &mut SceneTree| {
mark_theme_owned(tree, &[node]);
tree.attach_scope(node, scope);
});
node
}
}
impl EuvField {
#[must_use]
pub fn error<TextValue>(mut self, error: TextValue) -> Self
where
TextValue: Into<String>,
{
self.set_error(error.into());
self
}
}
#[component]
impl EuvField {
fn render(&self) -> NodeId {
let theme_palette: ThemePalette = live_tokens_untracked(self.get_tokens()).get_palette();
let control: NodeId = self.get_control();
let Self { label, error, .. } = self;
let column_style: Style = style! {
Width(Length::Percent(100.0))
Gap(SPACE_XS)
};
let text_quaternary_style: Style = style! {
FontSize(13.0)
FontWeight::Medium
TextColor(theme_palette.get_foreground())
};
let text_fifth_style: Style = style! {
FontSize(12.0)
TextColor(theme_palette.get_destructive())
};
view! {
column {
style: column_style
text {
style: text_quaternary_style
{ label.clone() }
}
{ control }
if !error.is_empty() {
text {
style: text_fifth_style
{ error.clone() }
}
}
}
}
}
}
#[component]
impl EuvSwitch {
fn render(&self) -> NodeId {
let ctx: Context = current_context();
let base_tokens: ThemeTokens = self.get_tokens();
let init_tok: ThemeTokens = live_tokens_untracked(base_tokens);
let theme_palette: ThemePalette = init_tok.get_palette();
let theme_geometry: ThemeGeometry = init_tok.get_geometry();
let checked: Signal<bool> = self.get_checked();
let Self { label, .. } = self;
let label_owned: String = label.clone();
let a11y_label: String = label_owned.clone();
let init_on: bool = checked.get_untracked();
let (init_track, init_thumb): (Color, Color) = Self::state_colors(theme_palette, init_on);
let mut track: NodeId = NodeId::default();
let mut thumb: NodeId = NodeId::default();
let mut label_node: NodeId = NodeId::default();
let on_toggle = move |_: &UiEvent| {
let _: bool = checked.set(!checked.get_untracked());
};
let row_quaternary_style: Style = style! {
AlignItems::Center
Padding(Edges::symmetric(SPACE_XS, SPACE_SM))
Radius(theme_geometry.get_radius_sm())
Gap(SPACE_SM)
CursorIcon::Pointer
};
let row_fifth_style: Style = style! {
Width(Length::Px(SWITCH_TRACK_WIDTH))
Height(Length::Px(SWITCH_TRACK_HEIGHT))
FlexShrink(0.0)
Padding(Edges::all(SWITCH_TRACK_INSET))
AlignItems::Center
if init_on { JustifyContent::End } else { JustifyContent::Start }
Radius(RADIUS_PILL)
Background(init_track)
};
let view_style: Style = style! {
Width(Length::Px(SWITCH_THUMB_SIZE))
Height(Length::Px(SWITCH_THUMB_SIZE))
Radius(RADIUS_PILL)
Background(init_thumb)
theme_geometry.get_shadow_xs()
};
let text_tertiary_style: Style = style! {
FlexGrow(1.0)
FontSize(13.0)
FontWeight::Medium
TextColor(theme_palette.get_foreground())
};
let row: NodeId = view! {
row {
style: row_quaternary_style
on_click: on_toggle
row {
node_ref: track
style: row_fifth_style
view {
node_ref: thumb
style: view_style
}
}
text {
node_ref: label_node
style: text_tertiary_style
{ label_owned }
}
}
};
let handle: SceneHandle = ctx.get_scene().clone();
let prev_state: Cell<(bool, ThemeKey)> = Cell::new((init_on, init_tok.key()));
let a11y_fallback: Rc<str> = Rc::from(a11y_label.as_str());
let (scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
Effect::new(move || {
let is_on: bool = checked.get();
let tok: ThemeTokens = use_live_tokens(base_tokens);
let (prev_on, prev_key): (bool, ThemeKey) = prev_state.replace((is_on, tok.key()));
if prev_on == is_on && prev_key == tok.key() {
return;
}
let live_p: ThemePalette = tok.get_palette();
let (track_bg, thumb_bg): (Color, Color) = Self::state_colors(live_p, is_on);
let thumb_shadow: Shadow = tok.get_geometry().get_shadow_xs();
let theme_changed: bool = prev_key != tok.key();
let fallback_label: Rc<str> = a11y_fallback.clone();
handle.mutate(move |tree: &mut SceneTree| {
if let Some(item_count) = tree.get_node_mut(track) {
let computed_style: &mut Style = item_count.get_mut_style();
computed_style
.get_mut_layout()
.set_justify_content(if is_on {
JustifyContent::End
} else {
JustifyContent::Start
});
computed_style
.get_mut_paint()
.set_background(Some(track_bg));
let dirty: u16 = if prev_on == is_on {
DIRTY_PAINT
} else {
let layout_dirty: u16 = DIRTY_LAYOUT | DIRTY_SUBTREE_LAYOUT;
layout_dirty | DIRTY_PAINT
};
tree.mark_dirty(track, dirty);
}
if let Some(node_entry) = tree.get_node_mut(thumb) {
node_entry
.get_mut_style()
.get_mut_paint()
.set_background(Some(thumb_bg))
.set_shadow(Some(thumb_shadow));
tree.mark_dirty(thumb, DIRTY_PAINT);
}
if theme_changed && let Some(normal_vec) = tree.get_node_mut(label_node) {
normal_vec
.get_mut_style()
.get_mut_text()
.set_color(live_p.get_foreground());
tree.mark_dirty(label_node, DIRTY_PAINT);
}
if let Some(total_len) = tree.get_node_mut(row) {
if let Some(a11y) = total_len.get_mut_a11y().as_mut() {
a11y.set_checked(Some(is_on));
} else {
let mut a11y: A11yProps =
A11yProps::new(A11yRole::Switch, fallback_label.to_string());
a11y.set_checked(Some(is_on));
total_len.set_a11y(Some(a11y));
}
}
});
})
});
ctx.get_scene().mutate(move |tree: &mut SceneTree| {
if let Some(item_count_primary) = tree.get_node_mut(row) {
let mut a11y: A11yProps = A11yProps::new(A11yRole::Switch, a11y_label);
a11y.set_checked(Some(init_on));
item_count_primary.set_a11y(Some(a11y));
}
mark_theme_owned(tree, &[track, thumb, label_node]);
tree.attach_scope(track, scope);
});
row
}
}
impl EuvSwitch {
#[must_use]
pub fn state_colors(palette: ThemePalette, is_on: bool) -> (Color, Color) {
if is_on {
(palette.get_primary(), palette.get_primary_foreground())
} else {
(palette.get_switch_track_off(), palette.get_switch_thumb())
}
}
}
#[component]
impl EuvCheckbox {
fn render(&self) -> NodeId {
let ctx: Context = current_context();
let base_tokens: ThemeTokens = self.get_tokens();
let init_tok: ThemeTokens = live_tokens_untracked(base_tokens);
let theme_palette: ThemePalette = init_tok.get_palette();
let theme_geometry: ThemeGeometry = init_tok.get_geometry();
let checked: Signal<bool> = self.get_checked();
let Self { label, .. } = self;
let label_owned: String = label.clone();
let a11y_label: String = label_owned.clone();
let init_on: bool = checked.get_untracked();
let init_bg: Color = Self::box_fill(theme_palette, init_on);
let box_radius: f32 = Self::box_radius(theme_geometry);
let mut indicator: NodeId = NodeId::default();
let mut mark: NodeId = NodeId::default();
let mut label_node: NodeId = NodeId::default();
let on_toggle = move |_: &UiEvent| {
let _: bool = checked.set(!checked.get_untracked());
};
let paint_check = move |bounds: Rect, display_list: &mut DisplayList| {
if checked.get_untracked() {
let check_fg: Color = live_tokens_untracked(base_tokens)
.get_palette()
.surface(SurfaceRole::Primary)
.get_fg();
let x0: f32 = bounds.get_x() + 1.5;
let y0: f32 = bounds.get_y() + 6.0;
let xm: f32 = bounds.get_x() + 4.8;
let ym: f32 = bounds.get_y() + 9.5;
let x1: f32 = bounds.get_x() + 10.5;
let y1: f32 = bounds.get_y() + 2.5;
display_list.push(DrawCommand::Line {
from: Point::new(x0, y0),
to: Point::new(xm, ym),
color: check_fg,
width: 2.0,
});
display_list.push(DrawCommand::Line {
from: Point::new(xm, ym),
to: Point::new(x1, y1),
color: check_fg,
width: 2.0,
});
}
};
let row_secondary_style: Style = style! {
AlignItems::Center
Padding(Edges::symmetric(SPACE_XS, SPACE_SM))
Radius(theme_geometry.get_radius_sm())
Gap(SPACE_SM)
CursorIcon::Pointer
};
let row_tertiary_style: Style = style! {
JustifyContent::Center
AlignItems::Center
Width(Length::Px(CHECKBOX_BOX_SIZE))
Height(Length::Px(CHECKBOX_BOX_SIZE))
FlexShrink(0.0)
Background(init_bg)
Border::new(theme_geometry.get_border_width(), theme_palette.get_primary())
Radius(box_radius)
};
let canvas_style: Style = style! {
Width(Length::Px(12.0))
Height(Length::Px(12.0))
};
let text_secondary_style: Style = style! {
FlexGrow(1.0)
FontSize(14.0)
TextColor(theme_palette.get_foreground())
};
let row: NodeId = view! {
row {
style: row_secondary_style
on_click: on_toggle
row {
node_ref: indicator
style: row_tertiary_style
canvas {
node_ref: mark
style: canvas_style
painter: paint_check
}
}
text {
node_ref: label_node
style: text_secondary_style
{ label_owned }
}
}
};
let handle: SceneHandle = ctx.get_scene().clone();
let prev_state: Cell<(bool, ThemeKey)> = Cell::new((init_on, init_tok.key()));
let a11y_fallback: Rc<str> = Rc::from(a11y_label.as_str());
let (scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
Effect::new(move || {
let is_on: bool = checked.get();
let tok: ThemeTokens = use_live_tokens(base_tokens);
let (prev_on, prev_key): (bool, ThemeKey) = prev_state.replace((is_on, tok.key()));
if prev_on == is_on && prev_key == tok.key() {
return;
}
let live_p: ThemePalette = tok.get_palette();
let live_g: ThemeGeometry = tok.get_geometry();
let fill: Color = Self::box_fill(live_p, is_on);
let theme_changed: bool = prev_key != tok.key();
let fallback_label: Rc<str> = a11y_fallback.clone();
handle.mutate(move |tree: &mut SceneTree| {
if let Some(item_count) = tree.get_node_mut(indicator) {
item_count
.get_mut_style()
.get_mut_paint()
.set_background(Some(fill))
.set_border(Border::new(
live_g.get_border_width(),
live_p.get_primary(),
))
.set_radius(CornerRadius::all(Self::box_radius(live_g)));
tree.mark_dirty(indicator, DIRTY_PAINT);
}
tree.mark_dirty(mark, DIRTY_PAINT);
if theme_changed && let Some(node_entry) = tree.get_node_mut(label_node) {
node_entry
.get_mut_style()
.get_mut_text()
.set_color(live_p.get_foreground());
tree.mark_dirty(label_node, DIRTY_PAINT);
}
if let Some(normal_vec) = tree.get_node_mut(row) {
if let Some(a11y) = normal_vec.get_mut_a11y().as_mut() {
a11y.set_checked(Some(is_on));
} else {
let mut a11y: A11yProps =
A11yProps::new(A11yRole::Checkbox, fallback_label.to_string());
a11y.set_checked(Some(is_on));
normal_vec.set_a11y(Some(a11y));
}
}
});
})
});
ctx.get_scene().mutate(move |tree: &mut SceneTree| {
if let Some(total_len) = tree.get_node_mut(row) {
let mut a11y: A11yProps = A11yProps::new(A11yRole::Checkbox, a11y_label);
a11y.set_checked(Some(init_on));
total_len.set_a11y(Some(a11y));
}
mark_theme_owned(tree, &[indicator, mark, label_node]);
tree.attach_scope(indicator, scope);
});
row
}
}
impl EuvCheckbox {
#[must_use]
pub fn box_fill(palette: ThemePalette, is_on: bool) -> Color {
if is_on {
palette.get_primary()
} else {
palette.get_card()
}
}
#[must_use]
pub fn box_radius(geometry: ThemeGeometry) -> f32 {
geometry.get_radius_sm().clamp(2.0, CHECKBOX_MAX_RADIUS)
}
}
#[component]
impl EuvSegmented {
fn render(&self) -> NodeId {
let mut ctx: Context = current_context();
let base_tokens: ThemeTokens = self.get_tokens();
let init_tok: ThemeTokens = live_tokens_untracked(base_tokens);
let theme_palette: ThemePalette = init_tok.get_palette();
let theme_geometry: ThemeGeometry = init_tok.get_geometry();
let selected: Signal<usize> = self.get_selected();
let Self { options, .. } = self;
let init_sel: usize = selected.get_untracked();
let track_radius: f32 = theme_geometry.get_radius_lg();
let segment_radius: f32 = concentric_radius(track_radius, CONTROL_INSET);
let hovered_idx: Signal<Option<usize>> = Signal::new(None);
let tab_pairs: Vec<(NodeId, NodeId)> = options
.iter()
.enumerate()
.map(|(idx, opt): (usize, &String)| {
let active: bool = init_sel == idx;
let on_pick = move |_: &UiEvent| {
let _: bool = selected.set_if_changed(idx);
};
let on_enter = move |_: &UiEvent| {
let _: bool = hovered_idx.set_if_changed(Some(idx));
};
let on_leave = move |_: &UiEvent| {
if hovered_idx.get_untracked() == Some(idx) {
let _: bool = hovered_idx.set_if_changed(None);
}
};
let init_surface: SurfaceColors = theme_palette.interaction_colors(
InteractionRole::SegmentedPill,
active,
false,
false,
);
let segment_pad_x: f32 = if options.len() >= 5 {
SPACE_XS
} else {
SPACE_SM
};
let segment_font_size: f32 = if options.len() >= 6 { 11.5 } else { 13.0 };
let mut tab_style: Style = style! {
FlexDirection::Row
FlexGrow(1.0)
FlexShrink(1.0)
FlexBasis(Length::Px(0.0))
MinWidth(Length::Px(0.0))
Height(Length::Px(theme_geometry.get_control_sm()))
JustifyContent::Center
AlignItems::Center
Padding(Edges::symmetric(0.0, segment_pad_x))
Overflow::Hidden
Radius(segment_radius)
CursorIcon::Pointer
};
Self::apply_segment_paint(tab_style.get_mut_paint(), init_tok, active, false);
let mut label_id: NodeId = NodeId::default();
let text_style: Style = style! {
FlexShrink(1.0)
MinWidth(Length::Px(0.0))
MaxWidth(Length::Percent(100.0))
FontSize(segment_font_size)
FontWeight::Medium
TextColor(init_surface.get_fg())
TextAlign::Center
TextOverflow::Ellipsis
Overflow::Hidden
};
let tab_id: NodeId = view! {
row {
style: tab_style
role: A11yRole::Tab
a11y_label: opt.clone()
on_click: on_pick
on_pointer_enter: on_enter
on_pointer_leave: on_leave
text {
node_ref: label_id
style: text_style
{ opt.clone() }
}
}
};
(tab_id, label_id)
})
.collect();
let tab_nodes: Vec<NodeId> = tab_pairs
.iter()
.map(|&(tab_id, _): &(NodeId, NodeId)| tab_id)
.collect();
let row_style: Style = style! {
FlexWrap::NoWrap
Width(Length::Percent(100.0))
Padding(Edges::all(CONTROL_INSET))
Gap(CONTROL_INSET)
Overflow::Hidden
Background(theme_palette.get_muted())
Radius(track_radius)
};
let root: NodeId = view! {
row {
style: row_style
role: A11yRole::TabList
}
};
if !tab_nodes.is_empty() {
ctx.append_many(root, tab_nodes.as_slice());
}
let handle: SceneHandle = ctx.get_scene().clone();
let app_state_sig: Signal<AppState> = ctx.get_app_state();
let mut owned_nodes: Vec<NodeId> = Vec::with_capacity(1 + tab_pairs.len() * 2);
owned_nodes.push(root);
for &(tab_id, label_id) in tab_pairs.iter() {
owned_nodes.push(tab_id);
owned_nodes.push(label_id);
}
let init_pairs: Vec<(NodeId, NodeId)> = tab_pairs.clone();
let shared_pairs: Rc<[(NodeId, NodeId)]> = Rc::from(tab_pairs);
let prev_state: Cell<(usize, Option<usize>, ThemeKey)> =
Cell::new((init_sel, None, init_tok.key()));
let (scope, _): (Scope, Effect) = Scope::run(|_: Scope| {
let _: Effect = Effect::new(move || {
if app_state_sig.get() != AppState::Active {
let _: bool = hovered_idx.set_if_changed(None);
}
});
Effect::new(move || {
let next_sel: usize = selected.get();
let next_hov: Option<usize> = hovered_idx.get();
let tok: ThemeTokens = use_live_tokens(base_tokens);
let (old_sel, old_hov, old_key): (usize, Option<usize>, ThemeKey) =
prev_state.replace((next_sel, next_hov, tok.key()));
if old_sel == next_sel && old_hov == next_hov && old_key == tok.key() {
return;
}
let live_p: ThemePalette = tok.get_palette();
let theme_changed: bool = old_key != tok.key();
let pairs_ref: Rc<[(NodeId, NodeId)]> = shared_pairs.clone();
handle.mutate(move |tree: &mut SceneTree| {
if theme_changed && let Some(node_ref) = tree.get_node_mut(root) {
let _: &mut PaintStyle = node_ref
.get_mut_style()
.get_mut_paint()
.set_background(Some(live_p.get_muted()));
tree.mark_dirty(root, DIRTY_PAINT);
}
for (idx, &(tab, label_id)) in pairs_ref.iter().enumerate() {
let is_active: bool = idx == next_sel;
let is_hovered: bool = next_hov == Some(idx);
let seg_surface: SurfaceColors = live_p.interaction_colors(
InteractionRole::SegmentedPill,
is_active,
is_hovered,
false,
);
if let Some(node_ref) = tree.get_node_mut(tab) {
Self::apply_segment_paint(
node_ref.get_mut_style().get_mut_paint(),
tok,
is_active,
is_hovered,
);
let _: &mut SceneNode =
node_ref.set_hover_style(Self::segment_hover_paint(tok, is_active));
tree.mark_dirty(tab, DIRTY_PAINT);
}
if let Some(label_node) = tree.get_node_mut(label_id) {
let _: &mut TextStyle = label_node
.get_mut_style()
.get_mut_text()
.set_color(seg_surface.get_fg());
tree.mark_dirty(label_id, DIRTY_PAINT);
}
}
});
})
});
ctx.get_scene().mutate(move |tree: &mut SceneTree| {
for (idx, &(tab, _)) in init_pairs.iter().enumerate() {
if let Some(node_ref) = tree.get_node_mut(tab) {
let _: &mut SceneNode = node_ref
.set_hover_style(Self::segment_hover_paint(init_tok, idx == init_sel));
}
}
mark_theme_owned(tree, owned_nodes.as_slice());
tree.attach_scope(root, scope);
});
root
}
}
impl EuvSegmented {
pub fn apply_segment_paint(
paint: &mut PaintStyle,
tokens: ThemeTokens,
active: bool,
hovered: bool,
) {
let palette: ThemePalette = tokens.get_palette();
let geometry: ThemeGeometry = tokens.get_geometry();
let surface: SurfaceColors =
palette.interaction_colors(InteractionRole::SegmentedPill, active, hovered, false);
let _: &mut PaintStyle = paint
.set_background(Some(surface.get_bg()))
.set_border(Border::new(
geometry.get_border_width(),
surface.get_border(),
))
.set_shadow(if active {
Some(geometry.get_shadow_xs())
} else {
None
});
}
#[must_use]
pub fn segment_hover_paint(tokens: ThemeTokens, active: bool) -> Option<PaintStyle> {
if active {
return None;
}
let palette: ThemePalette = tokens.get_palette();
let geometry: ThemeGeometry = tokens.get_geometry();
let segment_radius: f32 = concentric_radius(geometry.get_radius_lg(), CONTROL_INSET);
let surface: SurfaceColors =
palette.interaction_colors(InteractionRole::SegmentedPill, false, true, false);
let mut hover_paint: PaintStyle = PaintStyle::default();
let _: &mut PaintStyle = hover_paint
.set_background(Some(surface.get_bg()))
.set_radius(CornerRadius::all(segment_radius))
.set_cursor(CursorIcon::Pointer);
Some(hover_paint)
}
}