diff --git a/crates/font-manager/src/picker.rs b/crates/font-manager/src/picker.rs index 0a362275c..ddbf22a1c 100644 --- a/crates/font-manager/src/picker.rs +++ b/crates/font-manager/src/picker.rs @@ -21,7 +21,7 @@ use craft_ui::contract::{ Access, Bind, Common, Component, Cx, Edit as _, EditResponse, Focus as _, Input, MeasureCx, Outcome, OverlayUi, Overlays as _, PaintUi, PartsCx, Pointer as _, Props as _, Remember as _, Role, Styled as _, WordSetCx as _, }; -use craft_ui::controls::disclosure::DisclosureGlyph; +use craft_ui::controls::disclosure::{DisclosureGlyph, DropdownArrow}; use craft_ui::fonts::FontRef; use craft_ui::list::{ListRow, ThumbSize}; use craft_ui::primitives::{IconSpec, TextKey, TextOptions, TextRun}; @@ -650,12 +650,12 @@ impl<'a> FontPicker<'a> { /// The adornments at the end of the field: the missing mark when `missing`, then the chevron. The mark is a glyph /// whose part carries the note. - fn trailing(name: Label, missing: bool) -> Vec { + fn trailing(name: Label, missing: bool, arrow: DropdownArrow) -> Vec { let mut all = Vec::with_capacity(2); if missing { all.push(Adornment::glyph(IconSpec::svg(IconId::new(WARNING_ICON)))); } - all.push(Adornment::button(CHEVRON, DisclosureGlyph::dropdown(), name)); + all.push(Adornment::button(CHEVRON, DisclosureGlyph::dropdown_of(arrow), name)); all } @@ -796,14 +796,14 @@ impl Component for FontPicker<'_> { let widest = if ribbon { Vec2::new(cx.tokens.size.length.short, widest.y) } else { widest }; let name = cx.words::().list.clone(); let note = self.missing_note(current, &cx.words::()); - Vec2::new(widest.x + reserve(&cx.style.field, &[], &Self::trailing(name, note.is_some())), widest.y) + Vec2::new(widest.x + reserve(&cx.style.field, &[], &Self::trailing(name, note.is_some(), cx.env.get())), widest.y) } fn parts(&mut self, _: Rect, cx: &mut PartsCx<'_, Self>) { let name = cx.words::().list.clone(); let family = cx.value().cloned().unwrap_or_default(); let note = self.missing_note(&family, &cx.words::()); - let trailing = Self::trailing(name, note.is_some()); + let trailing = Self::trailing(name, note.is_some(), cx.env.get()); let placed = place(cx.content_rect, &cx.style.field, &[], &trailing, cx.flow.is_rtl()); if let (Some(note), Some(at)) = (note, placed.trailing.first()) { cx.part(WARNING, *at).tooltip(note); @@ -917,13 +917,13 @@ impl Component for FontPicker<'_> { let name = cx.words::().list.clone(); let family = cx.value().cloned().unwrap_or_default(); let missing = self.missing_note(&family, &cx.words::()).is_some(); - let trailing = Self::trailing(name.clone(), missing); + let trailing = Self::trailing(name.clone(), missing, cx.env.get()); let placed = place(cx.content_rect, &cx.style.field, &[], &trailing, cx.env.direction().is_rtl()); if let (true, Some(at)) = (missing, placed.trailing.first()) { let color = cx.resolve(&cx.style.warning); ui.draw().icon(*at, &IconSpec::svg(IconId::new(WARNING_ICON)).color(color)); } - ui.face(CHEVRON, IconButton::new(DisclosureGlyph::dropdown()).label(name)); + ui.face(CHEVRON, IconButton::new(DisclosureGlyph::dropdown_of(cx.env.get())).label(name)); } fn finish(self, mut cx: Cx<'_, Self>) -> FontPickerOutput { diff --git a/crates/ui-widgets/src/bars/lead.rs b/crates/ui-widgets/src/bars/lead.rs index 582ed9295..4e48efcf7 100644 --- a/crates/ui-widgets/src/bars/lead.rs +++ b/crates/ui-widgets/src/bars/lead.rs @@ -82,7 +82,7 @@ impl BarTool { /// Shows the icon, its arrow and the rule after them. pub fn show(self, ui: &mut Ui) -> BarToolOutput { let shown: ButtonOutput = IconButton::new(self.icon).label(self.label).enabled(self.enabled).show(ui); - Icon::new(DisclosureGlyph::dropdown()).enabled(self.enabled).show(ui); + Icon::new(DisclosureGlyph::dropdown_of(crate::runtime::env::Env::of(ui).get())).enabled(self.enabled).show(ui); Divider::vertical().show(ui); BarToolOutput { response: shown.response } } diff --git a/crates/ui-widgets/src/controls/disclosure.rs b/crates/ui-widgets/src/controls/disclosure.rs index 89863f9eb..6785bf03a 100644 --- a/crates/ui-widgets/src/controls/disclosure.rs +++ b/crates/ui-widgets/src/controls/disclosure.rs @@ -36,6 +36,19 @@ pub enum ArrowForm { Dropdown, } +/// Which arrow a field or a picker shows after its text ([`DisclosureGlyph::dropdown_of`]). An app sets it once at its +/// root (`RootEnv::values`); the default is the stroked chevron. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, crate::runtime::env::EnvValue, crate::contract::MemoProps)] +#[env(style)] +#[non_exhaustive] +pub enum DropdownArrow { + /// The fine stroked chevron. + #[default] + Chevron, + /// The small filled triangle pointing down, the disclosure triangle opened: PdfCraft's fields and pickers. + Triangle, +} + /// The arrow every component shows for something that opens or unfolds. The disclosure is a filled triangle that /// turns from pointing to the end of the line (closed) to pointing down (open) as `open` goes from 0 to 1; a /// dropdown's arrow is the open chevron; a submenu's is the filled arrow to the end of the line. Components name these @@ -52,8 +65,10 @@ pub struct DisclosureGlyph { pub stroke: StrokeWidth, } -/// The arrow of a field or picker: the small filled triangle pointing down. -const DROPDOWN: DisclosureGlyph = DisclosureGlyph::new(1.0); +/// The arrow of a field or picker: the fine stroked chevron. +const DROPDOWN: DisclosureGlyph = DisclosureGlyph::dropdown_form(); +/// The arrow of a field or picker under [`DropdownArrow::Triangle`]: the small filled triangle pointing down. +const DROPDOWN_TRIANGLE: DisclosureGlyph = DisclosureGlyph::new(1.0); /// The arrow of a button that opens a menu. const MENU_BUTTON: DisclosureGlyph = DisclosureGlyph { open: 1.0, form: ArrowForm::Dropdown, stroke: StrokeWidth::Medium }; /// The submenu arrow. @@ -75,11 +90,21 @@ impl DisclosureGlyph { !matches!(self.form, ArrowForm::Dropdown) } - /// The icon of the arrow after the text of a picker's face or a field with a list. + /// The icon of the arrow after the text of a picker's face or a field with a list: the chevron. A component reads + /// the app's choice through [`DisclosureGlyph::dropdown_of`]. pub fn dropdown() -> crate::primitives::IconSpec<'static> { crate::primitives::IconSpec::glyph(&DROPDOWN) } + /// The icon of the arrow after the text of a picker's face or a field with a list, in the form `arrow` names: a + /// component passes the scope's [`DropdownArrow`] (`cx.env.get::()`). + pub fn dropdown_of(arrow: DropdownArrow) -> crate::primitives::IconSpec<'static> { + match arrow { + DropdownArrow::Chevron => crate::primitives::IconSpec::glyph(&DROPDOWN), + DropdownArrow::Triangle => crate::primitives::IconSpec::glyph(&DROPDOWN_TRIANGLE), + } + } + /// The icon of the arrow after the text of a button that opens a menu: the dropdown arrow in the firmer line. pub fn menu_button() -> crate::primitives::IconSpec<'static> { crate::primitives::IconSpec::glyph(&MENU_BUTTON) diff --git a/crates/ui-widgets/src/pickers/combo_box.rs b/crates/ui-widgets/src/pickers/combo_box.rs index 8d5fd2be0..73653b742 100644 --- a/crates/ui-widgets/src/pickers/combo_box.rs +++ b/crates/ui-widgets/src/pickers/combo_box.rs @@ -134,8 +134,8 @@ impl<'a> ComboBox<'a> { options } - fn trailing(name: Label) -> [Adornment; 1] { - [Adornment::button(CHEVRON, crate::controls::disclosure::DisclosureGlyph::dropdown(), name)] + fn trailing(name: Label, arrow: crate::controls::disclosure::DropdownArrow) -> [Adornment; 1] { + [Adornment::button(CHEVRON, crate::controls::disclosure::DisclosureGlyph::dropdown_of(arrow), name)] } /// Whether any option's label matches `query`. @@ -177,13 +177,13 @@ impl Component for ComboBox<'_> { let texts = self.options.iter().filter_map(|option| option.value().map(String::as_str)).chain([current, placeholder]); let widest = texts.map(|text| cx.field_text(&TextRun::new(text))).fold(Vec2::ZERO, Vec2::max); let name = cx.words::().combo_options.clone(); - Vec2::new(widest.x + reserve(cx.style, &[], &Self::trailing(name)), widest.y) + Vec2::new(widest.x + reserve(cx.style, &[], &Self::trailing(name, cx.env.get())), widest.y) } fn parts(&mut self, _: Rect, cx: &mut PartsCx<'_, Self>) { let value = cx.value(); let name = cx.words::().combo_options.clone(); - let trailing = Self::trailing(name); + let trailing = Self::trailing(name, cx.env.get()); let placed = place(cx.content_rect, cx.style, &[], &trailing, cx.flow.is_rtl()); if let Some(at) = placed.trailing.first() { cx.part(CHEVRON, *at) @@ -332,7 +332,7 @@ impl Component for ComboBox<'_> { fn paint(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) { let name = cx.words::().combo_options.clone(); - ui.face(CHEVRON, IconButton::new(crate::controls::disclosure::DisclosureGlyph::dropdown()).label(name)); + ui.face(CHEVRON, IconButton::new(crate::controls::disclosure::DisclosureGlyph::dropdown_of(cx.env.get())).label(name)); } fn finish(self, cx: Cx<'_, Self>) -> ComboBoxOutput { diff --git a/crates/ui-widgets/src/pickers/face.rs b/crates/ui-widgets/src/pickers/face.rs index 4ae005ecd..707f6ee8a 100644 --- a/crates/ui-widgets/src/pickers/face.rs +++ b/crates/ui-widgets/src/pickers/face.rs @@ -134,8 +134,8 @@ impl<'a> SelectFace<'a> { self.leading.iter().map(|icon| Adornment::glyph(icon.clone())).collect() } - fn chevron() -> Adornment { - Adornment::glyph(crate::controls::disclosure::DisclosureGlyph::dropdown()) + fn chevron(arrow: crate::controls::disclosure::DropdownArrow) -> Adornment { + Adornment::glyph(crate::controls::disclosure::DisclosureGlyph::dropdown_of(arrow)) } } @@ -205,7 +205,7 @@ impl Component for SelectFace<'_> { (Some(_), false) => cx.style.thumb, (Some(_), true) => cx.style.thumb + cx.style.caption_gap + caption.y, }; - let beside = self.lead(cx.style, caption.x) + reserve(&cx.style.field, &self.leading_glyphs(), &[Self::chevron()]); + let beside = self.lead(cx.style, caption.x) + reserve(&cx.style.field, &self.leading_glyphs(), &[Self::chevron(cx.env.get())]); if self.fit && self.name { // A fitted box is at most a field length, padding included; a longer text elides, down to its readable // least. @@ -217,7 +217,7 @@ impl Component for SelectFace<'_> { } fn paint(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) { - let chevron = Self::chevron(); + let chevron = Self::chevron(cx.env.get()); let rtl = cx.flow.is_rtl(); let mut flow = Flow::new(cx.content_rect, rtl); let caption = self.caption_run(&cx.style.caption).map(|run| ui.draw().layout(&run.color(cx.resolve(&cx.style.caption.color)), f32::INFINITY)); diff --git a/crates/ui-widgets/src/tabs/mod.rs b/crates/ui-widgets/src/tabs/mod.rs index 9949119f5..43a3f8982 100644 --- a/crates/ui-widgets/src/tabs/mod.rs +++ b/crates/ui-widgets/src/tabs/mod.rs @@ -6,7 +6,7 @@ mod words; mod rules; pub(crate) mod tab; -pub use rules::{CloseSide, FitMode, OverflowMenu, OverflowPlace, TabKind, close_side}; +pub use rules::{CloseSide, DocumentTabLook, FitMode, OverflowMenu, OverflowPlace, TabKind, close_side}; pub use tab::{Tab, TabOutput, TabPartEvent, TabRole, TabStyle}; pub use words::TabWords; diff --git a/crates/ui-widgets/src/tabs/rules.rs b/crates/ui-widgets/src/tabs/rules.rs index 6dd45b948..3583682b3 100644 --- a/crates/ui-widgets/src/tabs/rules.rs +++ b/crates/ui-widgets/src/tabs/rules.rs @@ -3,11 +3,26 @@ use craft_behavior::fit::{TabFit, fit, fit_whole}; use craft_host::target::Os; +/// The look of document tabs ([`TabKind::Document`]) app-wide. An app sets it once at its root (`RootEnv::values`); +/// the strip and its tabs read it from the env. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, crate::runtime::env::EnvValue, crate::contract::MemoProps)] +#[env(style)] +#[non_exhaustive] +pub enum DocumentTabLook { + /// Whole titles side by side, a `*` after a modified tab's text. + #[default] + Whole, + /// PdfCraft's tabs: they shrink before they overflow (a name at most 22 digits wide, at its least a readable + /// prefix), stand the inline gap apart, and a modified tab shows the marker dot in place of the `*`. + Shrinking, +} + /// The kind of a strip. It sets the defaults below; the host picks one per strip. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum TabKind { - /// Document tabs: spaced apart, shrinking titles, a close button on every closable tab, every document in the overflow menu. + /// Document tabs: whole titles, a close button on every closable tab, every document in the overflow menu. An app + /// may give them PdfCraft's look ([`DocumentTabLook::Shrinking`]). #[default] Document, /// Panel tabs: tabs shrink before they overflow, no close button, only the hidden tabs in the overflow menu. @@ -68,14 +83,25 @@ pub enum OverflowMenu { } impl TabKind { - /// How tab widths are fitted: whole titles for text and ribbon tabs, shrinking for document and panel tabs. + /// How tab widths are fitted: whole titles for document, text and ribbon tabs, shrinking for panel tabs. pub fn fit_mode(self) -> FitMode { match self { - Self::Text | Self::Ribbon => FitMode::Whole, - Self::Document | Self::Panel => FitMode::Shrink { keep_selected: self.keeps_active_width() }, + Self::Document | Self::Text | Self::Ribbon => FitMode::Whole, + Self::Panel => FitMode::Shrink { keep_selected: self.keeps_active_width() }, } } + /// How tab widths are fitted under the app's document tab look: [`DocumentTabLook::Shrinking`] shrinks document + /// tabs as panel tabs do; every other kind and look is [`TabKind::fit_mode`]. + pub fn fit_mode_in(self, look: DocumentTabLook) -> FitMode { + if self.shrinks_in(look) { FitMode::Shrink { keep_selected: self.keeps_active_width() } } else { self.fit_mode() } + } + + /// Whether these are document tabs under [`DocumentTabLook::Shrinking`]. + pub fn shrinks_in(self, look: DocumentTabLook) -> bool { + self == Self::Document && look == DocumentTabLook::Shrinking + } + /// Whether the shown tab keeps its whole title while the other tabs shrink: panel tabs. pub fn keeps_active_width(self) -> bool { self == Self::Panel diff --git a/crates/ui-widgets/src/tabs/strip.rs b/crates/ui-widgets/src/tabs/strip.rs index b32bcceaa..69b493a59 100644 --- a/crates/ui-widgets/src/tabs/strip.rs +++ b/crates/ui-widgets/src/tabs/strip.rs @@ -1003,9 +1003,10 @@ impl Collection let (ghosts, departed) = self.reserved(cx, &keys); // Each end item is measured in this pass, with its label and icon only. let ends = self.trailing.iter().map(|end| end.fit_item(cx)).collect(); - let fitting = Fitting { selected, mode: self.kind.fit_mode(), kept, ends, gap: cx.tokens.space.gap.inline, ghosts, departed }; - // Document tabs stand apart by the inline gap; the other kinds touch. - let tab_gap = if self.kind == TabKind::Document { cx.tokens.space.gap.inline } else { 0.0 }; + let look = cx.env::(); + let fitting = Fitting { selected, mode: self.kind.fit_mode_in(look), kept, ends, gap: cx.tokens.space.gap.inline, ghosts, departed }; + // Shrinking document tabs stand apart by the inline gap; the other kinds and looks touch. + let tab_gap = if self.kind.shrinks_in(look) { cx.tokens.space.gap.inline } else { 0.0 }; StripLayout::new(count, Vec2::new(width, cx.tokens.size.bar.tab), tab_gap, fitting, self.report.clone(), cx.frame_ctx().clone()) } diff --git a/crates/ui-widgets/src/tabs/tab.rs b/crates/ui-widgets/src/tabs/tab.rs index bcc3b0d5f..6bae784b4 100644 --- a/crates/ui-widgets/src/tabs/tab.rs +++ b/crates/ui-widgets/src/tabs/tab.rs @@ -76,6 +76,9 @@ const PROGRESS: PartKey = PartKey::new("progress"); /// How many of a title's first letters a shrunk tab still shows. const MIN_LETTERS: usize = 3; + +/// The modified mark of a tab whose look shows no marker dot for it. +const MARK: &str = "*"; const CLOSE_REASON: &str = "The Close command closes the focused tab"; /// The padding on each side of a ribbon tab's label: the strip insets its sliding underline by it, so the underline @@ -131,6 +134,9 @@ pub struct TabStyle { divider: bool, close_side: CloseSide, sizes: Sizes, + /// Document tabs in [`DocumentTabLook::Shrinking`](super::DocumentTabLook::Shrinking): a name capped at + /// `MAX_NAME_DIGITS` digits' width, a readable prefix at their least, and the marker dot for a modified tab. + shrinking: bool, /// The marker dot's diameter. marker: f32, /// The marker dot of a marked tab. @@ -146,7 +152,9 @@ struct Placed { icon: Option, label: Rect, detail: Option, - /// The marker dot, after the last text: a modified tab's too. + /// The modified mark `*`, right after the last text, where the look shows no dot for it. + mark: Option, + /// The marker dot, after the last text: a modified tab's too where the look shows the dot for it. marker: Option, /// The band the label, detail and marker share. band: Rect, @@ -177,7 +185,8 @@ pub struct Tab<'a> { /// An icon before the label. #[prop(into)] icon: Option>, - /// Unsaved changes: the marker dot after the detail, or after the label without one. + /// Unsaved changes: a `*` after the detail, or after the label without one; the marker dot there under + /// [`DocumentTabLook::Shrinking`](super::DocumentTabLook::Shrinking). #[prop(flag)] modified: bool, /// Whether the tab can be closed; by default whether the kind shows a close button. @@ -237,10 +246,20 @@ impl<'a> Tab<'a> { TextRun::new(text).role(style.label.role) } - /// Whether the marker dot shows: the tab's content has something to show, or the document is modified (the one - /// modified mark of the suite is the dot). - fn dotted(&self) -> bool { - self.marked || self.modified + /// Whether the marker dot shows: the tab's content has something to show, or the document is modified and the + /// look marks a modified tab with the dot. + fn dotted(&self, style: &TabStyle) -> bool { + self.marked || (self.modified && style.shrinking) + } + + /// Whether the modified mark `*` shows: a modified tab whose look shows no dot for it. + fn starred(&self, style: &TabStyle) -> bool { + self.modified && !style.shrinking + } + + /// The modified mark, in the label's type. + fn mark_run(&self, style: &TabStyle) -> TextRun<'static> { + TextRun::new(MARK).role(style.label.role) } /// Where the parts lie in `content`, with `natural` the unbounded width of a run. `parts` registers its parts @@ -265,11 +284,13 @@ impl<'a> Tab<'a> { let band = flow.rect(); let label_natural = natural(&self.label_run(style, label)); let detail_natural = self.detail_text().map_or(0.0, |text| natural(&TextRun::new(text).role(style.detail.role))); - // The marker keeps its room; the label is cut first, then the detail. - let marker_width = if self.dotted() { sizes.gap + style.marker } else { 0.0 }; + // The marks keep their room; the label is cut first, then the detail. + let mark_width = if self.starred(style) { natural(&self.mark_run(style)) } else { 0.0 }; + let marker_width = if self.dotted(style) { sizes.gap + style.marker } else { 0.0 }; + let marks = mark_width + marker_width; let detail_gap = if detail_natural > 0.0 { sizes.gap } else { 0.0 }; - let label_width = label_natural.min((band.width() - marker_width - detail_gap - detail_natural).max(0.0)); - let detail_width = detail_natural.min((band.width() - marker_width - label_width - detail_gap).max(0.0)); + let label_width = label_natural.min((band.width() - marks - detail_gap - detail_natural).max(0.0)); + let detail_width = detail_natural.min((band.width() - marks - label_width - detail_gap).max(0.0)); let line = |rect: Rect, height: f32| { let top = if sizes.text_only && !sizes.middle { content.top() } else { content.center().y - height / 2.0 }; Rect::from_x_y_ranges(rect.x_range(), top..=top + height) @@ -281,13 +302,19 @@ impl<'a> Tab<'a> { } else { (None, rest) }; + let (mark, after) = if mark_width > 0.0 { + let (mark, after) = after.take_start(mark_width); + (Some(line(mark, sizes.label_line)), after) + } else { + (None, after) + }; let label = line(label, sizes.label_line); - let marker = self.dotted().then(|| { + let marker = self.dotted(style).then(|| { let slot = after.take_start(sizes.gap).1.take_start(style.marker).0; Rect::from_center_size(Pos2::new(slot.center().x, label.center().y), Vec2::splat(style.marker)) }); let cut = label_width < label_natural || detail_width < detail_natural; - Placed { close, icon, label, detail, marker, band, cut } + Placed { close, icon, label, detail, mark, marker, band, cut } } fn name(&self, label: &str, words: &TabWords) -> String { @@ -388,6 +415,7 @@ impl Component for Tab<'_> { divider: key.kind.trailing_divider(), close_side: close_side(cx.os, cx.direction.is_rtl()), sizes, + shrinking: key.kind.shrinks_in(cx.env::()), marker: marker.side, marker_color: marker.color, marker_edge: marker.edge, @@ -401,18 +429,14 @@ impl Component for Tab<'_> { let first: String = cx.resolved.label.chars().take(MIN_LETTERS).collect(); cx.layout_at(&self.label_run(cx.style, &first), f32::INFINITY).size().x }; - if cx.proposal == Proposal::Min && self.kind != TabKind::Document { + if cx.proposal == Proposal::Min && !cx.style.shrinking { return Vec2::new(letters(), sizes.label_line); } let width = |run: &TextRun<'_>| cx.layout_at(run, f32::INFINITY).size().x; let label_width = width(&self.label_run(cx.style, cx.resolved.label)); // A document tab never takes more than a name of `MAX_NAME_DIGITS` digits' width, as production's tabs cut a long // name short so the other tabs and the Open control keep their room; the label is cut with an ellipsis. - let capped = if self.kind == TabKind::Document { - label_width.min(width(&self.label_run(cx.style, &"0".repeat(MAX_NAME_DIGITS)))) - } else { - label_width - }; + let capped = if cx.style.shrinking { label_width.min(width(&self.label_run(cx.style, &"0".repeat(MAX_NAME_DIGITS)))) } else { label_width }; let mut natural = sizes.tail + capped; if self.icon.is_some() { natural += sizes.icon + sizes.gap; @@ -420,7 +444,10 @@ impl Component for Tab<'_> { if let Some(detail) = self.detail_text() { natural += sizes.gap + width(&TextRun::new(detail).role(cx.style.detail.role)); } - if self.dotted() { + if self.starred(cx.style) { + natural += width(&self.mark_run(cx.style)); + } + if self.dotted(cx.style) { natural += sizes.gap + cx.style.marker; } if self.shows_close() { @@ -523,6 +550,9 @@ impl Component for Tab<'_> { if let (Some(at), Some(detail)) = (placed.detail, self.detail_text()) { draw.text(at, &TextRun::new(detail).role(style.detail.role).color(cx.resolve(&style.detail.color)).elide()); } + if let Some(at) = placed.mark { + draw.text(at, &self.mark_run(style).color(cx.resolve(&style.label.color))); + } if let Some(at) = placed.marker { paint_marker(&draw, at.center(), &MarkerStyle { side: style.marker, color: style.marker_color, edge: style.marker_edge }); } diff --git a/crates/ui-widgets/src/text/number.rs b/crates/ui-widgets/src/text/number.rs index e90fcda9c..c10fabbc9 100644 --- a/crates/ui-widgets/src/text/number.rs +++ b/crates/ui-widgets/src/text/number.rs @@ -413,8 +413,8 @@ impl<'a, V: NumberValue + 'static> NumberField<'a, V> { let unit = Adornment::text(unit, cx.style.unit.role).apart().measured(cx); if shared { unit.in_column(cx.ui.ctx(), &UNITS) } else { unit } }); - let chevrons = - chevrons.iter().map(|(key, name)| Adornment::button(*key, crate::controls::disclosure::DisclosureGlyph::dropdown(), name.clone())); + let arrow = crate::controls::disclosure::DisclosureGlyph::dropdown_of(cx.env.get()); + let chevrons = chevrons.iter().map(|(key, name)| Adornment::button(*key, arrow.clone(), name.clone())); unit.into_iter().chain(chevrons).collect() } @@ -737,7 +737,7 @@ impl Component for NumberField<'_, V> { glyph.paint(ui, *at, cx.resolve(&cx.style.handle), self.options.role); } for (key, name) in chevrons { - ui.face(key, IconButton::new(crate::controls::disclosure::DisclosureGlyph::dropdown()).label(name)); + ui.face(key, IconButton::new(crate::controls::disclosure::DisclosureGlyph::dropdown_of(cx.env.get())).label(name)); } } diff --git a/crates/ui-widgets/src/text/text_field.rs b/crates/ui-widgets/src/text/text_field.rs index 2497d05c8..ea68bfa4b 100644 --- a/crates/ui-widgets/src/text/text_field.rs +++ b/crates/ui-widgets/src/text/text_field.rs @@ -310,13 +310,13 @@ impl TextField<'_, C> { } /// The adornments after the text, in reading order: the clear button when `clear` names it, then the arrow. - fn trailing(&self, clear: Option