Simplify usage of tooltip
Now you simply specify a text, an action and a style and GPUI will take of rendering it properly. This is simpler compared to always providing a custom element and should make tooltip more consistent across the UI.
This commit is contained in:
parent
9ca9f63046
commit
cc028cca78
5 changed files with 99 additions and 35 deletions
|
@ -31,7 +31,7 @@ use crate::{
|
|||
rect::RectF,
|
||||
vector::{vec2f, Vector2F},
|
||||
},
|
||||
json, DebugContext, Event, EventContext, LayoutContext, PaintContext, RenderContext,
|
||||
json, Action, DebugContext, Event, EventContext, LayoutContext, PaintContext, RenderContext,
|
||||
SizeConstraint, View,
|
||||
};
|
||||
use core::panic;
|
||||
|
@ -160,13 +160,15 @@ pub trait Element {
|
|||
fn with_tooltip<T: View>(
|
||||
self,
|
||||
id: usize,
|
||||
tooltip: ElementBox,
|
||||
text: String,
|
||||
action: Option<Box<dyn Action>>,
|
||||
style: TooltipStyle,
|
||||
cx: &mut RenderContext<T>,
|
||||
) -> Tooltip
|
||||
where
|
||||
Self: 'static + Sized,
|
||||
{
|
||||
Tooltip::new(id, self.boxed(), tooltip, cx)
|
||||
Tooltip::new(id, text, action, style, self.boxed(), cx)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue