chore: use Cow instead of String for tooltips (#2838)
A QoL change to align `Tooltip` with other elements like `Label` Release Notes: - N/A
This commit is contained in:
parent
268f4b1939
commit
ffffbbea1f
13 changed files with 33 additions and 43 deletions
|
@ -303,10 +303,10 @@ impl Pane {
|
|||
let tooltip_label;
|
||||
if pane.is_zoomed() {
|
||||
icon_path = "icons/minimize_8.svg";
|
||||
tooltip_label = "Zoom In".into();
|
||||
tooltip_label = "Zoom In";
|
||||
} else {
|
||||
icon_path = "icons/maximize_8.svg";
|
||||
tooltip_label = "Zoom In".into();
|
||||
tooltip_label = "Zoom In";
|
||||
}
|
||||
|
||||
Pane::render_tab_bar_button(
|
||||
|
@ -1477,7 +1477,7 @@ impl Pane {
|
|||
index: usize,
|
||||
icon: &'static str,
|
||||
is_active: bool,
|
||||
tooltip: Option<(String, Option<Box<dyn Action>>)>,
|
||||
tooltip: Option<(&'static str, Option<Box<dyn Action>>)>,
|
||||
cx: &mut ViewContext<Pane>,
|
||||
on_click: F1,
|
||||
on_down: F2,
|
||||
|
|
|
@ -220,7 +220,7 @@ fn nav_button<A: Action, F: 'static + Fn(&mut Toolbar, &mut ViewContext<Toolbar>
|
|||
spacing: f32,
|
||||
on_click: F,
|
||||
tooltip_action: A,
|
||||
action_name: &str,
|
||||
action_name: &'static str,
|
||||
cx: &mut ViewContext<Toolbar>,
|
||||
) -> AnyElement<Toolbar> {
|
||||
MouseEventHandler::<A, _>::new(0, cx, |state, _| {
|
||||
|
@ -252,7 +252,7 @@ fn nav_button<A: Action, F: 'static + Fn(&mut Toolbar, &mut ViewContext<Toolbar>
|
|||
})
|
||||
.with_tooltip::<A>(
|
||||
0,
|
||||
action_name.to_string(),
|
||||
action_name,
|
||||
Some(Box::new(tooltip_action)),
|
||||
tooltip_style,
|
||||
cx,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue